Creating ridged perlin noise
Hi, I'm trying to figure out how I can create a ridged perlin noise function. If I unterstood correctly, you have to substract the abs value of perlin noise from 1 to create a ridged noise value. This is my code:
int size = 1024;
int mountainSeed = 0;
float mountainScale = 42.7f;
public float[,] createMountainMap(){
float[,] data = new float[size, size];
for(int x = 0;x < size;x++){
for(int y = 0;y < size;y++){
float noise = 0.0f;
float gain = 1.0f;
for(int i = 0;i < mountainOctaves;i++){
noise += (1f - Mathf.Abs(Mathf.PerlinNoise(x * gain / mountainScale + mountainSeed, y * gain / mountainScale + mountainSeed)));
gain *= 2.0f;
}
data[x, y] = noise;
}
}
return data;
}
But the result isn't as expected:
I expected something like this image:
I don't know what I'm doing wrong or how to get the wanted result. How can I do it? Thankful for any help!
If this is not for educational purposes I would recommend that you use the Unity port of LibNoise which includes a ridged fractal noise function. You can read more about LibNoise at their website.
The problem is that the LibNoise license says that I have to publish it as open source... This isn't an option for me. But thanks anyway!
Your answer
Follow this Question
Related Questions
I need your help to make procedural floating islands! 0 Answers
How do I get better Perlin Noise? 2 Answers
Surface Nets for Smooth Voxel Terrain 0 Answers
Help with improving perlin noise function! 0 Answers
Can you use the superformula in unity? 0 Answers