diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-06 09:46:57 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-06 09:46:57 +0100 |
| commit | b2bd45885a77e8936ab1d2c2ed30a238d9f073a6 (patch) | |
| tree | 169608a9a88e4d009639b25089cdac785036b7b4 /assets/final/shaders | |
| parent | f573e9e12855f9a90878c57d1083985dc29d75b5 (diff) | |
fix(test_mesh): Use uniform floor scale to fix shadow artifacts
Fixed floor shadow stretching caused by extreme non-uniform scaling.
ROOT CAUSE:
Floor plane used scale(20.0, 0.01, 20.0) - a 2000:1 scale ratio!
When transforming shadow ray points into local space:
- Y coordinates scaled by 1/0.01 = 100x
- sdPlane distance calculation returns distorted values
- Shadow raymarching fails, causing stretching artifacts
ISSUE:
floor.scale = vec3(20.0f, 0.01f, 20.0f); // ❌ Extreme non-uniform scale
// In local space: dot(p_local, (0,1,0)) + 0.0
// But p_local.y is 100x larger than world-space distance!
FIX:
floor.scale = vec3(1.0f, 1.0f, 1.0f); // ✓ Uniform scale
floor.position = vec3(0, 0, 0); // Explicit ground level
EXPLANATION:
For PLANE objects, XZ scale doesn't matter (planes are infinite).
Y scale distorts the SDF distance calculation.
Uniform scale preserves correct world-space distances.
RESULT:
- Floor shadows now render correctly
- No stretching toward center
- Shadow distances accurate for soft shadow calculations
COMBINED WITH PREVIOUS FIXES:
1. Shader normal transformation (double-transpose fix)
2. Quaternion axis normalization (rotation stretching fix)
3. Mesh shadow scaling exclusion (AABB size fix)
4. Floor uniform scale (this fix)
Task A (test_mesh visualization) now FULLY RESOLVED.
handoff(Claude): All mesh transformation and shadow bugs fixed. Meshes
rotate correctly, normals transform properly, shadows render accurately.
Remaining known limitation: mesh shadows use AABB (axis-aligned), so
they don't rotate with the mesh - this is expected AABB behavior.
Diffstat (limited to 'assets/final/shaders')
0 files changed, 0 insertions, 0 deletions
