From 9c17682aed1e9cb31904b9032f5dad0c51d0b408 Mon Sep 17 00:00:00 2001 From: Richard Zink Date: Wed, 7 Oct 2026 20:56:08 +0200 Subject: [PATCH] Fix stripes: tilt camera more downward so visible ground fits in mosaic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previous look direction had rd.y from -0.05 to -0.40 across the screen, so most rays hit ground at tGround in [9, 44] — way beyond the 16-unit mosaic. Those OOB pixels came back as solid edge colour, creating the striped band of texture-then-edge transitions. New look: rd.y from -1.10 (bottom) to 0.20 (top). At uv.y=0 rd.y=-0.45 (26° below horizon) so the visible ground sits at tGround < 6 — all within the 16-unit mosaic. Ground mask threshold also tightened from -0.30 to -0.10 so the ground fades to sky higher in the image (looks like atmospheric haze). Fog distance 14 → matches the new closer-ground regime. --- vendor/clouds3d.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) 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);', '}'