perf: reduce cloud noise octaves

This commit is contained in:
Richard Zink committed 2026-10-13 20:35:23 +02:00
1 parent b4d44079ea
commit 99ca1b069c
1 file changed
+10 -12
+10 -12
View File
@@ -194,19 +194,18 @@ var FRAG_SRC = [
'mix(hash3(i + vec3(0,1,1)), hash3(i + vec3(1,1,1)), f.x), f.y),', 'mix(hash3(i + vec3(0,1,1)), hash3(i + vec3(1,1,1)), f.x), f.y),',
'f.z);', 'f.z);',
'}', '}',
// Four octaves (the name stayed): the extra high-frequency octave breaks // Three octaves: cheaper cloud noise while keeping the base coverage
// up the iso-surfaces that made the deck read as stacked slabs. Sum is // range near 0.875. The detail octave in cloudDensity still breaks up
// renormalised to the old 0.875 range so baseThresh still means the same // close silhouettes.
// cloud coverage.
'float fbm3(vec3 p) {', 'float fbm3(vec3 p) {',
'float v = 0.0;', 'float v = 0.0;',
'float a = 0.5;', 'float a = 0.5;',
'for (int i = 0; i < 4; i++) {', 'for (int i = 0; i < 3; i++) {',
'v += a * noise3(p);', 'v += a * noise3(p);',
'p = p * 2.03 + vec3(13.7, 7.1, 19.3);', 'p = p * 2.03 + vec3(13.7, 7.1, 19.3);',
'a *= 0.5;', 'a *= 0.5;',
'}', '}',
'return v * 0.93333;', 'return v;',
'}', '}',
// Density at a point in the cloud layer. Two fBm layers: the // Density at a point in the cloud layer. Two fBm layers: the
// base one at low frequency gives the large puffs, the detail // base one at low frequency gives the large puffs, the detail
@@ -826,19 +825,18 @@ var CLOUD_SAMPLER_GLSL = [
'mix(hash3(i + vec3(0,1,1)), hash3(i + vec3(1,1,1)), f.x), f.y),', 'mix(hash3(i + vec3(0,1,1)), hash3(i + vec3(1,1,1)), f.x), f.y),',
'f.z);', 'f.z);',
'}', '}',
// Four octaves (the name stayed): the extra high-frequency octave breaks // Three octaves: cheaper cloud noise while keeping the base coverage
// up the iso-surfaces that made the deck read as stacked slabs. Sum is // range near 0.875. The detail octave in cloudDensity still breaks up
// renormalised to the old 0.875 range so baseThresh still means the same // close silhouettes.
// cloud coverage.
'float fbm3(vec3 p) {', 'float fbm3(vec3 p) {',
'float v = 0.0;', 'float v = 0.0;',
'float a = 0.5;', 'float a = 0.5;',
'for (int i = 0; i < 4; i++) {', 'for (int i = 0; i < 3; i++) {',
'v += a * noise3(p);', 'v += a * noise3(p);',
'p = p * 2.03 + vec3(13.7, 7.1, 19.3);', 'p = p * 2.03 + vec3(13.7, 7.1, 19.3);',
'a *= 0.5;', 'a *= 0.5;',
'}', '}',
'return v * 0.93333;', 'return v;',
'}', '}',
// Height field lookup on the same grid the mesh was built from, so a // Height field lookup on the same grid the mesh was built from, so a
// ridge occludes exactly the ridge you can see. // ridge occludes exactly the ridge you can see.