From 9d114ae4fec465baed381de7782ef42ca77e734b Mon Sep 17 00:00:00 2001 From: skal Date: Sun, 8 Mar 2026 09:13:57 +0100 Subject: fix(shaders): enforce y-up screen-space convention + document coordinate conventions - Add textureSampleYUp() helper to fullscreen_uv_vs.wgsl to correct y-flip when sampling WebGPU textures with y-up UV coordinates - Use textureSampleYUp() in passthrough, gaussian_blur, combined_postprocess - Fix skybox.wgsl: remove erroneous (1.0 - uv.y) flip (double-flip bug) - Document world/view/screen conventions in doc/3D.md, camera_common.wgsl, and fullscreen_uv_vs.wgsl Co-Authored-By: Claude Sonnet 4.6 --- src/shaders/skybox.wgsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/shaders/skybox.wgsl') diff --git a/src/shaders/skybox.wgsl b/src/shaders/skybox.wgsl index 075eeb6..652743f 100644 --- a/src/shaders/skybox.wgsl +++ b/src/shaders/skybox.wgsl @@ -10,7 +10,7 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4f { // Convert UV to NDC let ndc_x = in.uv.x * 2.0 - 1.0; - let ndc_y = (1.0 - in.uv.y) * 2.0 - 1.0; // Un-flip Y for NDC (Y-up) + let ndc_y = in.uv.y * 2.0 - 1.0; // uv is y-up, matches NDC directly // Unproject to find world direction // We want the direction from camera to the far plane at this pixel -- cgit v1.2.3