diff --git a/vendor/clouds3d.js b/vendor/clouds3d.js index 2ad500b..15b0990 100644 --- a/vendor/clouds3d.js +++ b/vendor/clouds3d.js @@ -140,9 +140,11 @@ var FRAG_SRC = [ // Fixed altitude well above the cloud ceiling (y=1.5). 'float camY = 2.2;', '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. - 'vec3 rd = normalize(vec3(uv.x * 0.55, -0.05 + uv.y * 0.35, 1.0));', + // Ray direction: tilt more downward so the visible ground fits + // within the mosaic. At uv.y = 0 the ray goes ~26° below + // horizontal, putting the visible ground at tGround < 5 + // (well inside the 16x16 mosaic at most camera altitudes). + 'vec3 rd = normalize(vec3(uv.x * 0.55, -0.45 + uv.y * 0.65, 1.0));', // Sky gradient based on ray Y (background). 'float skyT = clamp(rd.y * 0.7 + 0.5, 0.0, 1.0);', 'vec3 col = mix(uBg, uSky, skyT);', @@ -197,7 +199,7 @@ var FRAG_SRC = [ // remain visible against a deep but not void-black sky. 'float skyDarkness = nightFactor * 0.55;', 'col = mix(col, col * (1.0 - skyDarkness), 1.0 - cloud);', - '// Horizon: cast the ray onto the ground plane (y=0) and sample the satellite image at that world (x,z) coordinate. As the camera drifts forward over time the texture scrolls past, giving the illusion of flying over real terrain. Distant ground fades toward sky colour (atmospheric perspective).', + '// Horizon: cast the ray onto the ground plane (y=0) and sample the satellite image at that world (x,z) coordinate. As the camera drifts forward over time the texture scrolls past, giving the illusion of flying over real terrain. Distant ground fades toward sky colour (atmospheric perspective). 'float tGround = (ro.y > 0.0 && rd.y < -0.001) ? -ro.y / rd.y : -1.0;', 'vec3 hitPoint = ro + rd * tGround;', // UV from world (hitPoint - centre) / size + 0.5 — the @@ -205,10 +207,10 @@ var FRAG_SRC = [ 'vec2 gUv = vec2(hitPoint.x, hitPoint.z);', 'gUv = (gUv - uGroundCenter) / uGroundSize + 0.5;', 'vec3 groundCol = texture2D(uGround, gUv).rgb;', - 'float fogAmount = clamp(tGround / 12.0, 0.0, 1.0);', + 'float fogAmount = clamp(tGround / 14.0, 0.0, 1.0);', 'groundCol = mix(groundCol, uBg, fogAmount);', // Ground mask: full ground when looking down, none when up. - 'float gmask = (tGround > 0.0) ? smoothstep(0.0, -0.30, rd.y) : 0.0;', + 'float gmask = (tGround > 0.0) ? smoothstep(0.0, -0.10, rd.y) : 0.0;', 'col = mix(col, groundCol, gmask);', 'gl_FragColor = vec4(col, 1.0);', '}'