Hello! I’m Dieg, and I’m a scripter that likes a lot to mess with terrain generation.
I’ve recently started working on a game that requires Perlin Noise to generate its terrain, and I decided to quit my usual unorganized fashion of scripting and make a Module. Surprisingly, it’s very easy to use and get used to, so I decided to release it publicly!
Now, you might ask, what’s so special about this module? It supports 4 axes, meaning that you can either get 4-dimensional Perlin Noise or set a seed for 3D noise! Amazing!
How to use
The module only has one function:
PerlinNoise.new({X, Y, Z, W}, amplitude, octaves, persistence)
{X, Y, Z, W}
Table with the coordinates in order. You can leave any of these axes blank and it’ll consider them 0 by default. WARNING: The W axis is kind of wonky, so if you’re not interested in the 4th dimension I’d recommend leaving it to ensure you don’t get weird results.
amplitude
Number that specifies the amplitude of the noise. Default is 10.
octaves
Number of Perlin noises overlayed on top of eachother to get a more realistic result. Default is 1, which is regular noise.
persistence
Number that specifies how much octaves influence the original result. It’s set to .5 by default, and I recommend leaving it to that unless you know what you’re doing, as not even I know for sure how it modifies the noise 100%. From what I’ve tested, the closer the number is to 0 the more octaves influence the noise, but for some reason, really small numbers give weird results.
EXAMPLE USE: print(PerlinNoise.new({5,4,6},15,3,0.5)
Screenshots!
4 dimensional noise!
Octaves!
Waves/Clouds!
Embarrassing picture 😔
Why you shouldn’t use the W axis if it’s not needed!
Tried my best to fix this, as you can see once the W axis is different than 0 it generates weird lines, and I believe the result is symmetrical, but it looks cool!
EDIT: This is my first public module/contribution to the community, so any sort of feedback is appreciated!