summaryrefslogtreecommitdiff
path: root/assets/final/shaders/render
diff options
context:
space:
mode:
Diffstat (limited to 'assets/final/shaders/render')
-rw-r--r--assets/final/shaders/render/scene_query_bvh.wgsl8
-rw-r--r--assets/final/shaders/render/scene_query_linear.wgsl8
2 files changed, 8 insertions, 8 deletions
diff --git a/assets/final/shaders/render/scene_query_bvh.wgsl b/assets/final/shaders/render/scene_query_bvh.wgsl
index d040c1b..61efe49 100644
--- a/assets/final/shaders/render/scene_query_bvh.wgsl
+++ b/assets/final/shaders/render/scene_query_bvh.wgsl
@@ -42,10 +42,10 @@ fn map_scene(p: vec3<f32>, skip_idx: u32) -> f32 {
let obj = object_data.objects[obj_idx];
let q = (obj.inv_model * vec4<f32>(p, 1.0)).xyz;
let s = min(length(obj.model[0].xyz), min(length(obj.model[1].xyz), length(obj.model[2].xyz)));
- // IMPORTANT: Plane (type 4.0) should not be scaled by 's' in this way.
- // The sdPlane function expects its own scale/offset implicitly handled by the model matrix.
- // The 's' factor is meant for primitives whose SDFs are defined relative to a unit size.
- if (obj.params.x != 4.0) { // Only scale if not a plane
+ // 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.
+ 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));
diff --git a/assets/final/shaders/render/scene_query_linear.wgsl b/assets/final/shaders/render/scene_query_linear.wgsl
index 30a0371..ab3845a 100644
--- a/assets/final/shaders/render/scene_query_linear.wgsl
+++ b/assets/final/shaders/render/scene_query_linear.wgsl
@@ -42,10 +42,10 @@ fn map_scene(p: vec3<f32>, skip_idx: u32) -> f32 {
let obj = object_data.objects[obj_idx];
let q = (obj.inv_model * vec4<f32>(p, 1.0)).xyz;
let s = min(length(obj.model[0].xyz), min(length(obj.model[1].xyz), length(obj.model[2].xyz)));
- // IMPORTANT: Plane (type 4.0) should not be scaled by 's' in this way.
- // The sdPlane function expects its own scale/offset implicitly handled by the model matrix.
- // The 's' factor is meant for primitives whose SDFs are defined relative to a unit size.
- if (obj.params.x != 4.0) { // Only scale if not a plane
+ // 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.
+ 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));