diff options
| author | skal <pascal.massimino@gmail.com> | 2026-03-08 11:36:04 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-03-08 11:36:04 +0100 |
| commit | ba7ea27ddee4398afa98a0e45b9e227bbcfae906 (patch) | |
| tree | 09f8bb60c324aad53c829d79f50f56497cd1d7be /src/effects/ntsc.wgsl | |
| parent | 1ad5057ce8e68e57340aae3442b2c6b787409ad3 (diff) | |
fix: negate Y in perspective() to correct rasterized 3D orientation
The fullscreen post-process VS uses Y-up UVs (uv.y=0 = bottom), so
textureSample() Y-flips any rasterized offscreen texture. SDF effects
author their content Y-down and look correct after the flip. Rasterized
effects (RotatingCube, Hybrid3D) must pre-flip their geometry:
- mat4::perspective(): m[5] = -t (negated Y scale)
- Pipelines with cullMode=Back: frontFace = WGPUFrontFace_CW (Y-flip
reverses winding, so CW becomes the visible face)
- Remove incorrect transposes from GlobalUniforms::make(),
ObjectData::make(), and Uniforms::make() — mini_math is column-major,
no transpose needed for GPU upload
- Document the convention in doc/3D.md under "Rasterized 3D and the
Y-flip rule"
handoff(Gemini): Y-flip rule now documented; all rasterized 3D pipelines
must follow it.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'src/effects/ntsc.wgsl')
| -rw-r--r-- | src/effects/ntsc.wgsl | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/effects/ntsc.wgsl b/src/effects/ntsc.wgsl index 5c27695..4e72f0a 100644 --- a/src/effects/ntsc.wgsl +++ b/src/effects/ntsc.wgsl @@ -2,6 +2,7 @@ #include "sequence_uniforms" #include "render/fullscreen_uv_vs" #include "math/noise" +#include "debug/debug_print" const vignetteRounding = 160.0f; const vignetteSmoothness = 0.7f; @@ -68,5 +69,6 @@ fn vignette(uv: vec2f) -> f32 { col.g *= 1.01; col.b *= 0.94; + col = debug_f32(col, in.position.xy / uniforms.resolution, vec2f(10., 10.), 3.2); return vec4f(clamp(col, vec3f(0.0), vec3f(1.0)), 1.0); } |
