diff options
| author | skal <pascal.massimino@gmail.com> | 2026-03-08 10:38:19 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-03-08 10:38:19 +0100 |
| commit | 21b061b951ec3a65bc479fabeb2d9565e08a807e (patch) | |
| tree | 24755d905463c8a507a34624ab3edf7295c8e0c5 /src/effects/ntsc.wgsl | |
| parent | 5f64a20daa81a6182d4898dcd6f86870ad0bf9d5 (diff) | |
fix: transpose matrices on GPU upload (row-major → column-major)
mini_math mat4 is row-major; WGSL mat4x4f is column-major. Matrices
uploaded without transposing were interpreted as their own transpose on
the GPU, causing RotatingCube and Renderer3D to render upside-down.
- Add gpu_upload_mat4() to post_process_helper for standalone uploads
- Add Uniforms::make() to RotatingCube::Uniforms (handles transpose)
- Add GlobalUniforms::make() and ObjectData::make() to renderer.h
- Update renderer_draw.cc and visual_debug.cc to use make()
handoff(Gemini): matrix layout bug fixed across all rasterized effects.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'src/effects/ntsc.wgsl')
| -rw-r--r-- | src/effects/ntsc.wgsl | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/effects/ntsc.wgsl b/src/effects/ntsc.wgsl index 6c9fa37..5c27695 100644 --- a/src/effects/ntsc.wgsl +++ b/src/effects/ntsc.wgsl @@ -5,6 +5,7 @@ const vignetteRounding = 160.0f; const vignetteSmoothness = 0.7f; +const fisheyeStrength = vec2f(.1, .24); @group(0) @binding(0) var input_sampler: sampler; @group(0) @binding(1) var input_texture: texture_2d<f32>; @@ -13,7 +14,7 @@ const vignetteSmoothness = 0.7f; // Barrel (fisheye) distortion: strength > 0 = barrel, < 0 = pincushion fn fisheye(uv: vec2f, strength: f32) -> vec2f { let r2 = uv * uv; - return uv * 1.05 * (1.0 + vec2f(.1, .24) * strength * r2); + return uv * 1.2 * (1.0 + fisheyeStrength * strength * r2); } fn vignette(uv: vec2f) -> f32 { @@ -32,7 +33,7 @@ fn vignette(uv: vec2f) -> f32 { // Black outside screen edges if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) { - discard; // return vec4f(0.0, 0.0, 0.0, 1.0); + return vec4f(0.0, 0.0, 0.0, 1.0); } // Chroma separation (horizontal RGB bleeding) |
