Skip to content

Commit 5320dd7

Browse files
committed
Normalize strands noise output range to [0,1] in GLSL and WGSL
1 parent 2adc450 commit 5320dd7

2 files changed

Lines changed: 2 additions & 4 deletions

File tree

src/webgl/shaders/functions/noise3DGLSL.glsl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,5 @@ float noise(vec3 st, int octaves, float ampFalloff) {
104104
frequency *= 2.0;
105105
amplitude *= ampFalloff;
106106
}
107-
108-
return result;
107+
return (result + 1.0) * 0.5;
109108
}

src/webgpu/shaders/functions/noise3DWGSL.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,5 @@ fn noise(st: vec3<f32>, octaves: i32, ampFalloff: f32) -> f32 {
102102
frequency *= 2.0;
103103
amplitude *= ampFalloff;
104104
}
105-
106-
return result;
105+
return result * 0.5 + 0.5;
107106
}`;

0 commit comments

Comments
 (0)