From 6847a7e1b54c9f76feef0c4110a897600983416e Mon Sep 17 00:00:00 2001 From: skal Date: Mon, 2 Feb 2026 17:39:14 +0100 Subject: 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. --- src/3d/renderer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/3d') 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 { 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); -- cgit v1.2.3