You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This project is cool. Looks like a useful tech demo! I do have some pointers to offer regarding the way you implement and teach noise, if you're open to them.
Looking at the code here, in ChunkData.cpp, I see that you present a function which hashes grid coordinates into pseudorandom values, one that interpolates between them, and one that sums multiple layers (octaves) of the noise. There is also an intermediate step to smooth the values. This technique with the naming you have has made its rounds around the internet, but there are a few important things I would say are worth considering regarding it.
You have the method which sums up multiple octaves of noise labeled as "Perlin Noise", when in reality this technique is more accurately named "fractal Brownian motion" or "fractal noise". Perlin noise itself is a specific algorithm for generating what could be the individual layers of noise, however the underlying function you have is actually a Value noise implementation. Perlin chooses gradients at each grid vertex, Value chooses values.
Further, Perlin and Value as underlying noise functions are IMO not necessarily the best thing to use (in unmitigated form) in most cases, or to teach without context and clarification. A problem that defines both Perlin and Value noise to different degrees is their tendency to produce mostly features aligned with the grid. Ideally, a noise function should be as un-directionally-biased as possible, so that you see roughly the same patterns of mountains and valleys coming and going regardless of whether you look in an aligned or unaligned direction, and so that terrain features can be oriented along a wide variety of directions. The way I see it, we should teach people about Simplex-type noise, and specifically 3D+ Perlin which has been domain-rotated to remove its square bias from the horizontal worldplane. Both provide fewer compromises in more use cases.
I see that the project isn't particularly new. However if it is still used as part of a curriculum or to teach people, then this might be worth looking into, to better setup your students to produce higher quality procedural content and avoid making some of the same oversights that lot of the internet does.
My recommendation is to use FastNoiseLite. This is based on the results it produces, as well as the implementation details I contributed to it. To use the library, configure its frequency, noise type, and setRotationType3D (domain rotation) if you're using the 3D noise rotation. If you don't want to include the whole library, you can copy and paste this function (faster) or this function (smoother) + all its dependencies, uncomment the skew transform, and sub it in for your skew noise. Then rename the PerlinNoise method to FractalNoise and also update the readme. To add the MIT license for the code, you can paste it in a comment and note that it applies specifically to the noise implementation.
Would also be happy to submit a PR when I get time if you would like!
This project is cool. Looks like a useful tech demo! I do have some pointers to offer regarding the way you implement and teach noise, if you're open to them.
Looking at the code here, in ChunkData.cpp, I see that you present a function which hashes grid coordinates into pseudorandom values, one that interpolates between them, and one that sums multiple layers (octaves) of the noise. There is also an intermediate step to smooth the values. This technique with the naming you have has made its rounds around the internet, but there are a few important things I would say are worth considering regarding it.
You have the method which sums up multiple octaves of noise labeled as "Perlin Noise", when in reality this technique is more accurately named "fractal Brownian motion" or "fractal noise". Perlin noise itself is a specific algorithm for generating what could be the individual layers of noise, however the underlying function you have is actually a Value noise implementation. Perlin chooses gradients at each grid vertex, Value chooses values.
Further, Perlin and Value as underlying noise functions are IMO not necessarily the best thing to use (in unmitigated form) in most cases, or to teach without context and clarification. A problem that defines both Perlin and Value noise to different degrees is their tendency to produce mostly features aligned with the grid. Ideally, a noise function should be as un-directionally-biased as possible, so that you see roughly the same patterns of mountains and valleys coming and going regardless of whether you look in an aligned or unaligned direction, and so that terrain features can be oriented along a wide variety of directions. The way I see it, we should teach people about Simplex-type noise, and specifically 3D+ Perlin which has been domain-rotated to remove its square bias from the horizontal worldplane. Both provide fewer compromises in more use cases.
I see that the project isn't particularly new. However if it is still used as part of a curriculum or to teach people, then this might be worth looking into, to better setup your students to produce higher quality procedural content and avoid making some of the same oversights that lot of the internet does.
My recommendation is to use FastNoiseLite. This is based on the results it produces, as well as the implementation details I contributed to it. To use the library, configure its frequency, noise type, and
setRotationType3D
(domain rotation) if you're using the 3D noise rotation. If you don't want to include the whole library, you can copy and paste this function (faster) or this function (smoother) + all its dependencies, uncomment the skew transform, and sub it in for your skew noise. Then rename thePerlinNoise
method toFractalNoise
and also update the readme. To add the MIT license for the code, you can paste it in a comment and note that it applies specifically to the noise implementation.Would also be happy to submit a PR when I get time if you would like!
EDIT: Since you're using GLM already, you could actually use its inbuilt simplex(vec2) implementation and not have to bring in any extra code.
The text was updated successfully, but these errors were encountered: