diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-06 09:56:26 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-06 09:56:26 +0100 |
| commit | 2b4ce2eed8fc4333b2c623836e7969b66b7be6e4 (patch) | |
| tree | 2d1798b9b5e3190ca27274bb0997241c2a7d5f59 /assets | |
| parent | a5229022b0e500ac86560e585081f45293e587d2 (diff) | |
Revert "fix(shaders): Correct plane distance scaling for non-uniform transforms"
This reverts commit a5229022b0e500ac86560e585081f45293e587d2.
Diffstat (limited to 'assets')
| -rw-r--r-- | assets/final/shaders/render/scene_query_bvh.wgsl | 11 | ||||
| -rw-r--r-- | assets/final/shaders/render/scene_query_linear.wgsl | 11 |
2 files changed, 6 insertions, 16 deletions
diff --git a/assets/final/shaders/render/scene_query_bvh.wgsl b/assets/final/shaders/render/scene_query_bvh.wgsl index f70a389..61efe49 100644 --- a/assets/final/shaders/render/scene_query_bvh.wgsl +++ b/assets/final/shaders/render/scene_query_bvh.wgsl @@ -45,15 +45,10 @@ fn map_scene(p: vec3<f32>, skip_idx: u32) -> f32 { // IMPORTANT: Plane (type 4.0) and Mesh (type 5.0) should not be scaled by 's'. // The 's' factor is meant for unit primitives (sphere, box, torus) that are // scaled by the model matrix. Meshes already have correct local-space extents. - // For planes with non-uniform scaling, we need to correct the distance by the - // scale along the normal direction (Y for horizontal planes). - if (obj.params.x == 4.0) { // Plane - let plane_scale = length(obj.model[1].xyz); // Y scale for horizontal plane - d = min(d, get_dist(q, obj.params) * plane_scale); - } else if (obj.params.x == 5.0) { // Mesh - d = min(d, get_dist(q, obj.params)); - } else { // Unit primitives + if (obj.params.x != 4.0 && obj.params.x != 5.0) { // Not plane, not mesh d = min(d, get_dist(q, obj.params) * s); + } else { + d = min(d, get_dist(q, obj.params)); } } else { // Internal if (stack_ptr < 31) { diff --git a/assets/final/shaders/render/scene_query_linear.wgsl b/assets/final/shaders/render/scene_query_linear.wgsl index 881a939..ab3845a 100644 --- a/assets/final/shaders/render/scene_query_linear.wgsl +++ b/assets/final/shaders/render/scene_query_linear.wgsl @@ -45,15 +45,10 @@ fn map_scene(p: vec3<f32>, skip_idx: u32) -> f32 { // IMPORTANT: Plane (type 4.0) and Mesh (type 5.0) should not be scaled by 's'. // The 's' factor is meant for unit primitives (sphere, box, torus) that are // scaled by the model matrix. Meshes already have correct local-space extents. - // For planes with non-uniform scaling, we need to correct the distance by the - // scale along the normal direction (Y for horizontal planes). - if (obj.params.x == 4.0) { // Plane - let plane_scale = length(obj.model[1].xyz); // Y scale for horizontal plane - d = min(d, get_dist(q, obj.params) * plane_scale); - } else if (obj.params.x == 5.0) { // Mesh - d = min(d, get_dist(q, obj.params)); - } else { // Unit primitives + if (obj.params.x != 4.0 && obj.params.x != 5.0) { // Not plane, not mesh d = min(d, get_dist(q, obj.params) * s); + } else { + d = min(d, get_dist(q, obj.params)); } } else { // Internal if (stack_ptr < 31) { |
