From af5cda467f3edcb4e21fbe0f64af2d2ec1407ad5 Mon Sep 17 00:00:00 2001 From: Richard Zink Date: Wed, 7 Oct 2026 21:12:05 +0200 Subject: [PATCH] Fix shader rotation: align with JS corridor constants (90 deg) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When I changed GROUND_TRAVEL_COS/SIN to (0, 1) (90 deg, +Z direction) in JS, the shader still used the old (0.82, 0.57) rotation (35 deg). The corridor was built along +Z but UVs were computed as if the canvas were rotated 35 deg — meaning the corridor was effectively at 35 deg from where tiles were loaded. Tiles ended up diagonally to the flight path. --- vendor/clouds3d.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/clouds3d.js b/vendor/clouds3d.js index 93aca8c..16f08f4 100644 --- a/vendor/clouds3d.js +++ b/vendor/clouds3d.js @@ -204,7 +204,7 @@ var FRAG_SRC = [ 'vec3 hitPoint = ro + rd * tGround;', // Project hitPoint onto the corridor rotated axes (travel ~35 deg). Then divide by per-axis extent so the corridor maps to UV 0..1. The mosaic canvas is drawn in this rotated frame, so the satellite image comes out oriented correctly. 'vec2 offset = vec2(hitPoint.x, hitPoint.z) - uGroundCenter;', - 'vec2 rotated = vec2(offset.x * 0.82 + offset.y * 0.57, -offset.x * 0.57 + offset.y * 0.82);', + 'vec2 rotated = vec2(offset.x * 0.0 + offset.y * 1.0, -offset.x * 1.0 + offset.y * 0.0);', 'vec2 gUv = rotated / uGroundSize + 0.5;', 'vec3 groundCol = texture2D(uGround, gUv).rgb;', 'float fogAmount = clamp(tGround / 14.0, 0.0, 1.0);',