We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 08eb850 commit 0bd6239Copy full SHA for 0bd6239
src/webgpu/shaders/functions/noise3DWGSL.js
@@ -91,15 +91,16 @@ fn baseNoise(v: vec3<f32>) -> f32 {
91
dot(p2_norm,x2), dot(p3_norm,x3) ) );
92
}
93
94
-fn noise(st: vec3<f32>) -> f32 {
+fn noise(st: vec3<f32>, octaves: i32, ampFalloff: f32) -> f32 {
95
var result = 0.0;
96
var amplitude = 1.0;
97
var frequency = 1.0;
98
99
- for (var i = 0; i < 4; i++) {
+ for (var i = 0; i < 8; i++) {
100
+ if (i >= octaves) { break; }
101
result += amplitude * baseNoise(st * frequency);
102
frequency *= 2.0;
- amplitude *= 0.5;
103
+ amplitude *= ampFalloff;
104
105
106
return result;
0 commit comments