summaryrefslogtreecommitdiffstats
path: root/modules/lightmapper_rd
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2023-12-28 17:51:19 +0100
committerJuan Linietsky <reduzio@gmail.com>2024-01-10 10:39:56 +0100
commitcaef2be758e52ecbe5234d2e5fe941619cd1c4f8 (patch)
treef2abb6b9742becaa9b0fd20281aab154d8214117 /modules/lightmapper_rd
parent13a0d6e9b253654f5cc2a44f3d0b3cae10440443 (diff)
downloadredot-engine-caef2be758e52ecbe5234d2e5fe941619cd1c4f8.tar.gz
Tiny fix for lightmapper DDA
- Ensures only one axis advances at a time - This fixes extremely corner cases where the DDA may skip over geometry
Diffstat (limited to 'modules/lightmapper_rd')
-rw-r--r--modules/lightmapper_rd/lm_compute.glsl11
1 files changed, 10 insertions, 1 deletions
diff --git a/modules/lightmapper_rd/lm_compute.glsl b/modules/lightmapper_rd/lm_compute.glsl
index a2a480043a..21e039396d 100644
--- a/modules/lightmapper_rd/lm_compute.glsl
+++ b/modules/lightmapper_rd/lm_compute.glsl
@@ -264,7 +264,16 @@ uint trace_ray(vec3 p_from, vec3 p_to, bool p_any_hit, out float r_distance, out
break;
}
- bvec3 mask = lessThanEqual(side.xyz, min(side.yzx, side.zxy));
+ // There should be only one axis updated at a time for DDA to work properly.
+ bvec3 mask = bvec3(true, false, false);
+ float m = side.x;
+ if (side.y < m) {
+ m = side.y;
+ mask = bvec3(false, true, false);
+ }
+ if (side.z < m) {
+ mask = bvec3(false, false, true);
+ }
side += vec3(mask) * delta;
icell += ivec3(vec3(mask)) * step;
iters++;