Implement perlin noise with turbulance

This commit is contained in:
CJSatnarine
2024-07-09 21:17:13 -04:00
parent 176c33bcd7
commit 498b86180a
5 changed files with 358547 additions and 358533 deletions

View File

@@ -47,6 +47,20 @@ class perlin {
return perlinInterpolation(c, u, v, w);
}
double turbulance(const point3& p, int depth) const {
auto accum = 0.0;
auto temporaryP = p;
auto weight = 1.0;
for (int i = 0; i < depth; i++) {
accum += weight * noise(temporaryP);
weight *= 0.5;
temporaryP *= 2;
}
return fabs(accum);
}
private:
static const int pointCount = 256;
vec3* randVector;