public FractalBillowDeriv(T noise, int octaves, float lacunarity = 1.99f, float gain = 0.5f, float weightedStrength = 0) { mNoise = noise; this.octaves = octaves; this.lacunarity = lacunarity; this.gain = gain; this.weightedStrength = weightedStrength; offset = real3.zero; fractalBounding = CalculateFractalBounding(octaves, gain); }
public real GetValue(int mSeed, real3 point) { int seed = mSeed; float amp = fractalBounding; float freq = warpFrequency; for (int i = 0; i < octaves; i++) { real3 ps = point; warp.Warp(warpSeed, warpFrequency, warpAmp, ps, ref point); seed++; amp *= amp; freq *= warpFrequency; } return(noise.GetValue(seed, point)); }
public real GetValue(int mSeed, real3 point) { int seed = mSeed; real sum = 0; real amp = fractalBounding; real3 offset = this.offset; for (int i = 0; i < octaves; i++) { real noise = abs(mNoise.GetValue(seed, point)) * 2 - 1; sum += noise * amp; amp *= lerp(1.0f, (noise + 1) * 0.5f, weightedStrength); point = point * lacunarity + offset; amp *= gain; offset *= lacunarity; } return(sum); }
public real GetValue(int mSeed, real3 point) { int seed = mSeed; real sum = 0; real amp = fractalBounding; real3 offset = this.offset; for (int i = 0; i < octaves; i++) { real noise = PingPong((mNoise.GetValue(seed++, point) + 1) * pingPongStength); sum += (noise - 0.5f) * 2 * amp; amp *= lerp(1.0f, noise, weightedStrength); point = point * lacunarity + offset; amp *= gain; offset *= lacunarity; } return(sum); }
public real GetValue(int mSeed, real3 point, out real3 dsum) { int seed = mSeed; real sum = 0; real amp = fractalBounding; real3 offset = this.offset; dsum = real3.zero; for (int i = 0; i < octaves; i++) { real noise = abs(mNoise.GetValue(seed, point, out var deriv)) * 2 - 1; dsum += deriv; sum += noise * amp / (1 + dot(dsum, dsum)); amp *= lerp(1.0f, (noise + 1) * 0.5f, weightedStrength); point = point * lacunarity + offset; amp *= gain; offset *= lacunarity; } return(sum); }
public real GetValue(int mSeed, real3 point) { return(GetValue(mSeed, point, out _)); }
public static real GetValue <T>(this T noise, int seed, float frequency, real3 point) where T : struct, INoise3D { point *= frequency; return(noise.GetValue(seed, point)); }
public real GetValue(int seed, real3 point) { warp.Warp(warpSeed, warpFrequency, warpAmp, point, ref point); return(noise.GetValue(seed, point)); }