diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-02 17:39:14 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-02 17:39:14 +0100 |
| commit | 6847a7e1b54c9f76feef0c4110a897600983416e (patch) | |
| tree | fc2fa82e98c4d8024faf49453cac728d1d8bfb6b /src/3d/renderer.cc | |
| parent | 4eb0a67ad12fdd8c82d7cbc37991b6977cb86568 (diff) | |
fix(3d): Stabilize shadows and isolate floor grid texture
- Reverted floor to BOX (SDF) for robust shadow receipt.
- Updated shader to apply grid pattern ONLY to instance 0 (floor) or PLANE objects.
- Restored noise-based texturing for floating cubes and other SDF primitives.
- Verified that shadows and textures are now correctly applied across all scene elements.
Diffstat (limited to 'src/3d/renderer.cc')
| -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 d39aac0..abd98b6 100644 --- a/src/3d/renderer.cc +++ b/src/3d/renderer.cc @@ -254,7 +254,7 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> { normal = normalize(transpose(normal_matrix) * n_local); // Apply texture to SDF color - if (obj_type == 4.0) { // PLANE (used for floor) + if (in.instance_index == 0u || obj_type == 4.0) { // Floor (index 0) or PLANE let uv_grid = p.xz * 0.5; let grid = 0.5 + 0.5 * sin(uv_grid.x * 3.14) * sin(uv_grid.y * 3.14); let grid_val = smoothstep(0.45, 0.55, grid); |
