Skip to content

Instantly share code, notes, and snippets.

@tuttlem
Created December 31, 2013 06:32
Show Gist options
  • Save tuttlem/8193366 to your computer and use it in GitHub Desktop.
Save tuttlem/8193366 to your computer and use it in GitHub Desktop.
Noise 4
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