Created
December 31, 2013 06:32
-
-
Save tuttlem/8193366 to your computer and use it in GitHub Desktop.
Noise 4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float perlin2d(const float x, const float y, | |
const int octaves, const float persistence) { | |
float total = 0.0f; | |
for (int i = 0; i <= (octaves - 1); i ++) { | |
float frequency = powf(2, i); | |
float amplitude = powf(persistence, i); | |
total = total + interpolateNoise(x * frequency, y * frequency) * amplitude; | |
} | |
return total; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment