Closed bdero closed 6 years ago
And maybe performance is not so critical for this, because it called usually several times at level creation step and not in process function.. Not much games uses noise for generate level chunks on fly. And for graphical part of shaders there is already existed assets in Asset library...
Any progress on this so far?
If we add 4D noise, it may be worthwhile to add 4D math types first (such as Vector4).
For note, 5D and higher noise has immense uses as well, don't just constrain it to lower dimensions. It is not hard to create an N-Dimension version of the algorithm (though I did that via C++ templates long long ago so the usages got optimized extremely well, and I think I was using perlin then...).
For 5+ D noise, it would make sense to add it since it is useful, but I would suggest only as a generic-ish function. For example, a function accepts float arrays, and passing an array of 7 floats = 7D noise.
For example, a function accepts float arrays, and passing an array of 7 floats = 7D noise.
That's what I did in C++, if it could statically know the size of the array then it generated optimized code, else it fell back to recursion (which depending on what was being done could be about the same speed or a lot slower, depending on how well SSE could be used).
I went ahead and added open-simplex-noise as a Godot module in #21569. Just commenting here in case someone wants to improve on it (maybe add 5+D noise?) since I won't be working on it in the near future. If anyone wants to work on it I'm open to answering questions.
Simplex noise was implemented in #21569, so this issue can now be closed.
Thanks for your contribution @JFonS! :tada:
Simplex Noise (also known as improved Perlin Noise) has many uses in modern game development, as it lies at the heart of procedural generation. Infinite terrain, voxel worlds, clouds, and just about any texture with realistic, natural patterns can be generated using Simplex Noise. It's commonplace in modern game engines.
Simple examples of simplex noise use:
Example implementations:
Fortunately, it's also pretty easy to implement.
The ideal implementation would involve allowing the user to set the RNG's seed somehow (whether it's set using a separate function in advance or passed as a parameter to the noise functions), and exposing the noise functions in "@GDScript", which might look something like this: