diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-02 17:19:48 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-02 17:19:48 +0100 |
| commit | a42fba99801e7085b9e6cb7d19016e6f44b35031 (patch) | |
| tree | eff6173ae2aa595d60f86424b0a1bd348ca59275 /src/3d | |
| parent | 949ad332ae8df7a6ddd7e4005fd2e4a2540da067 (diff) | |
fix(3d): Resolve spherical distortion in floor grid texture
- Corrected world-space position calculation in SDF fragment shader.
- Transformed local hit point back to world space using the model matrix.
- Restored accurate planar p.xz mapping for the floor grid.
Diffstat (limited to 'src/3d')
| -rw-r--r-- | src/3d/renderer.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/3d/renderer.cc b/src/3d/renderer.cc index abd26de..8676db4 100644 --- a/src/3d/renderer.cc +++ b/src/3d/renderer.cc @@ -212,8 +212,8 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> { } if (!hit) { discard; } - p = ro_world + rd_world * t; // Use world t for final position let q_hit = ro_local + rd_local * t; + p = (obj.model * vec4<f32>(q_hit, 1.0)).xyz; // Correct world position // Calculate normal with bump mapping let e = vec2<f32>(0.005, 0.0); |
