From f567ebf76895db240e62261c8075372bbba8a117 Mon Sep 17 00:00:00 2001 From: Richard Zink Date: Wed, 7 Oct 2026 20:11:13 +0200 Subject: [PATCH] Reduce cloud structure: 2 layers, 3 octaves MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - fbm3: 4 -> 3 octaves - cloudDensity: 4 layers (base + mid + fine1 + fine2) -> 2 layers (base + mid at 20%) Cost per pixel: 16 noise3 -> 6 noise3 per step, ~62% cheaper. Visual: clouds still have secondary detail but the fine wispy edges are gone — back to the cleaner silhouette. --- vendor/clouds3d.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/vendor/clouds3d.js b/vendor/clouds3d.js index 230a384..f4e73d4 100644 --- a/vendor/clouds3d.js +++ b/vendor/clouds3d.js @@ -90,23 +90,21 @@ var FRAG_SRC = [ 'float fbm3(vec3 p) {', 'float v = 0.0;', 'float a = 0.5;', - 'for (int i = 0; i < 4; i++) {', + 'for (int i = 0; i < 3; i++) {', 'v += a * noise3(p);', 'p = p * 2.03 + vec3(13.7, 7.1, 19.3);', 'a *= 0.5;', '}', 'return v;', '}', - // Density at a point in the cloud layer. Multi-layer fBm: base for - // the large puffs, mid layer for secondary structure, two fine - // layers for wispy edges. Combined gives richly textured clouds - // even at low weather density. + // Density at a point in the cloud layer. Two fBm layers: the + // base one at low frequency gives the large puffs, the detail + // layer at higher frequency breaks up the silhouette so clouds + // don't look like soft blobs. 'float cloudDensity(vec3 p, float baseThresh) {', 'float n = fbm3(p * 0.35 + vec3(0.0, 0.0, uTime * 0.06));', 'float d = fbm3(p * 1.4 + vec3(uTime * 0.04, 7.3, uTime * 0.03));', - 'float f1 = fbm3(p * 3.2 + vec3(2.1, uTime * 0.02, 5.7));', - 'float f2 = fbm3(p * 6.5 + vec3(11.3, 4.7, uTime * 0.05));', - 'n = n + d * 0.35 + f1 * 0.18 + f2 * 0.10;', + 'n = n + d * 0.20;', // Cloud layer thickness: between y=-0.3 (deck bottom) // and y=1.5 (top), densest in the middle. 'float h = clamp((p.y + 0.3) / 1.8, 0.0, 1.0);',