Reduce cloud structure: 2 layers, 3 octaves
- 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.
This commit is contained in:
1 parent
7cb04686c7
commit
f567ebf768
1 file changed
+6
-8
Vendored
+6
-8
@@ -90,23 +90,21 @@ var FRAG_SRC = [
|
|||||||
'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;',
|
'return v;',
|
||||||
'}',
|
'}',
|
||||||
// Density at a point in the cloud layer. Multi-layer fBm: base for
|
// Density at a point in the cloud layer. Two fBm layers: the
|
||||||
// the large puffs, mid layer for secondary structure, two fine
|
// base one at low frequency gives the large puffs, the detail
|
||||||
// layers for wispy edges. Combined gives richly textured clouds
|
// layer at higher frequency breaks up the silhouette so clouds
|
||||||
// even at low weather density.
|
// don't look like soft blobs.
|
||||||
'float cloudDensity(vec3 p, float baseThresh) {',
|
'float cloudDensity(vec3 p, float baseThresh) {',
|
||||||
'float n = fbm3(p * 0.35 + vec3(0.0, 0.0, uTime * 0.06));',
|
'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 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));',
|
'n = n + d * 0.20;',
|
||||||
'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;',
|
|
||||||
// Cloud layer thickness: between y=-0.3 (deck bottom)
|
// Cloud layer thickness: between y=-0.3 (deck bottom)
|
||||||
// and y=1.5 (top), densest in the middle.
|
// and y=1.5 (top), densest in the middle.
|
||||||
'float h = clamp((p.y + 0.3) / 1.8, 0.0, 1.0);',
|
'float h = clamp((p.y + 0.3) / 1.8, 0.0, 1.0);',
|
||||||
|
|||||||
Reference in new issue
Block a user