diff --git a/vendor/clouds3d.js b/vendor/clouds3d.js index 548a34b..0f76e69 100644 --- a/vendor/clouds3d.js +++ b/vendor/clouds3d.js @@ -92,8 +92,8 @@ var FRAG_SRC = [ 'float cloudDensity(vec3 p, float baseThresh) {', 'float n = fbm3(p * 0.35 + vec3(0.0, 0.0, uTime * 0.06));', // Cloud layer thickness: between y=-0.3 (deck bottom) - // and y=1.8 (top), densest in the middle. - 'float h = clamp((p.y + 0.3) / 2.1, 0.0, 1.0);', + // and y=1.5 (top), densest in the middle. + 'float h = clamp((p.y + 0.3) / 1.8, 0.0, 1.0);', 'float profile = 4.0 * h * (1.0 - h); // bell curve', 'profile = max(profile, 0.0);', 'return smoothstep(baseThresh, baseThresh + 0.18, n) * profile;', @@ -118,9 +118,12 @@ var FRAG_SRC = [ // cloud deck like an airliner cockpit. pow(...,n) shapes the // sin into short dips so we occasionally skim the cloud top. 'float drift = uTime * uSpeed * 0.45;', - 'float diveT = pow(0.5 + 0.5 * sin(uTime * 0.10), 5.0);', - // Cloud layer tops around y≈1.8. Cruise just above it. - 'float camY = mix(2.0, 0.9, diveT);', + // pow(...,8) keeps dives rare: most of the time diveT≈0, + // and only spikes briefly to 1. + 'float diveT = pow(0.5 + 0.5 * sin(uTime * 0.10), 8.0);', + // Cruise at y=2.6 (well above cloud ceiling y=1.5), dive to + // y=1.2 — close enough to skim the cloud top, never deep inside. + 'float camY = mix(2.6, 1.2, diveT);', 'vec3 ro = vec3(drift, camY, drift * 0.7);', // Ray direction: nearly level, like looking out a cockpit // window. Horizon sits around the middle of the frame. @@ -135,13 +138,13 @@ var FRAG_SRC = [ // 'stormy' -> low (overcast deck). 'float baseThresh = mix(0.72, 0.40, uDensity);', // Skip the gap between camera and cloud top so we don't waste - // steps marching through clear sky. ray-Y = 2.0 = cloud ceiling. - 'float t = (ro.y > 2.0 && rd.y < -0.001) ? (ro.y - 2.0) / -rd.y : 0.0;', + // steps marching through clear sky. ray-Y = 1.5 = cloud ceiling. + 'float t = (ro.y > 1.5 && rd.y < -0.001) ? (ro.y - 1.5) / -rd.y : 0.0;', 'float stepSize = 0.85;', 'float trans = 1.0;', 'for (int i = 0; i < 18; i++) {', 'vec3 p = ro + rd * t;', - 'if (p.y > 2.0 || p.y < -0.4) break;', + 'if (p.y > 1.5 || p.y < -0.4) break;', 'float d = cloudDensity(p, baseThresh);', 'if (d > 0.005) {', // Cloud shading: bottom = shadow, top = lit