-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Perlin and Simplex noise #15877
base: master
Are you sure you want to change the base?
Add Perlin and Simplex noise #15877
Conversation
a2280dd
to
e223be0
Compare
f38fb77
to
452a011
Compare
IMO it's weird for Perlin and Simplex noise implementations to be accessible by passing flags to a value noise implementation (especially considering they're clearly conflicting), even though |
Well, I did not want to break any compatibility by introducing a new API. New mapgens may use Perlin or Simplex noise by default, with new default scales that work well with standard parameters. Note that Simplex noise is about 15% finer than Perlin noise by design, so ultimately mapgen developers will likely focus on one of them (most likely Simplex, although it is a bit slower than Perlin noise unless this higher density allows us to reduce the number of octaves). As for clutter, some of the code duplication is intentional to make it easier for the compiler to inline, e.g., have the conditionals rather outside of hot loops and duplicate the loop code. |
Break compatibility is caused by renaming |
@kno10 Sorry, my error I miss line |
Fixes luanti-org#15775: Perlin noise is not Perlin noise, but fractal value noise. A simpler noise algorithm that does not put gradients but values on the corners of a grid, then interpolates inbetween. This does *not* change the noise, only the method and class names.
0fb2626
to
ab59c31
Compare
Add Perlin and Simplex noise using the FastNoiseLite library (did not try alternatives such as FastNoise2).
Incorporates #15858
Closes #11468
To test, set
flags = perlin, compat
orflags = simplex, compat
(absvalue
is also supported).For
compat
, I tried to get scaling somewhat consistent with the vaule noise currently used, but it's not perfect.First of all, the library limits the noise to -1:+1, whereas the Luanti code did not include any such rescaling. Secondly, Simplex noise is "by design" more dense than Perlin or value noise. So if you use existing
scale
parameters, it is suggested to usecompat
. But for a new use case (e.g., a new mapgen), I would suggest not using this.You can have terrain as weird as before when the mountain generator is active:

but the axis-aligned artifacts of value noise are gone. For mountains, this makes them look too blob-like IMHO. Works well with valleys generator, too.
With the current value noise, because it interpolates between points sampled on a grid, such artifacts arise frequently (most visible in mountains, as these use fewer octaves -- the grid is very visible on the minimap, too):
