0

So my understanding of perlin noise is you need to a noise function that works in 2 dimensions then you use a method like the ones below to get smooth noise.

float random(float2 st) {
    return frac(sin(dot(st,float2(12.9898, 78.233))) * 43758.5453123);
}

float noise2D(float2 p) { float2 i = floor(p); float2 f = frac(p);

// Four corners in 2D of a tile
float a = random(i);
float b = random(i + float2(1.0, 0.0));
float c = random(i + float2(0.0, 1.0));
float d = random(i + float2(1.0, 1.0));

float2 u = f * f * (3.0 - 2.0 * f);

return lerp(a, b, u.x) +
    (c - a) * u.y * (1.0 - u.x) +
    (d - b) * u.x * u.y;

}

Issue as I see it is the Perlin Noise space is fairly small. Maybe +/- 43758.5453123. I've tried making the domain value larger but it appears I don't have enough resolution inside a 32-bit float.

Any idea how I can get a much larger noise space on GPU? I know some game worlds claim billions of unique values so I'm just curious if it is possible to get a much larger unique noise space with 32-bit floats.

user2927848
  • 119
  • 2
  • I Guess what you are after is actually what your doing, the only thing other people do are repeating their noise and use multiple noises to make more permutations. Imagine having p = X+Y+Z all using your perlin function (x,y,z), how many combinations is that? a few billion right? – Tordin Dec 08 '21 at 08:07
  • Guess I can have multiple 32 bit noise methods used together to emulate higher order noise if i'm understanding what you are suggesting. Essentially use random offsets between [-50k,50k] and normalize them together to create a new noise value. In that case would each run of noise I think would only net me 50k. I might be able to use some xorshift based methods to get better resolution that scales exponentially rather than linearly. Guess that's what I should look into. – user2927848 Dec 08 '21 at 08:23
  • Yeah, I Think you are understanding that correct. Basically, if you add x(t1) + y(t2) + z(t3) should give you some more random value. where t1,t2,t3 are different times/locations on the perlin noise. – Tordin Dec 08 '21 at 08:43
  • You may be interested in How to generate or smooth really large procedural terrain? — in an answer there, I discuss how you're not limited to floating point precision. Since Perlin noise works on an integer grid, you can store an integer offset in that grid, and measure your floating point coordinates relative to that offset, so you always have high precision where you need it. You can use more sophisticated hashing algorithms to get distinct values at those grid cells — garbling some sine is not the only option. – DMGregory Dec 08 '21 at 11:37

0 Answers0