summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-10-13 11:40:37 +0200
committerGitHub <noreply@github.com>2021-10-13 11:40:37 +0200
commit9e05f80dae337202447561d9f412645e2c877d84 (patch)
tree6a43cef8a03c58b06156aec91c00232da73f01e9
parent2c46a1f327201004d631f3e25be64c56b12238fb (diff)
parentf3f64389ca4b1f55ddc161cedbae02ed746c1632 (diff)
Merge pull request #53744 from williamd67/GPULightmapper-prevent-endless-loop
-rw-r--r--modules/lightmapper_rd/lm_compute.glsl2
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/lightmapper_rd/lm_compute.glsl b/modules/lightmapper_rd/lm_compute.glsl
index 45b8ddab65..6e5c9f25ba 100644
--- a/modules/lightmapper_rd/lm_compute.glsl
+++ b/modules/lightmapper_rd/lm_compute.glsl
@@ -148,7 +148,7 @@ uint trace_ray(vec3 p_from, vec3 p_to
ivec3 icell = ivec3(from_cell);
ivec3 iendcell = ivec3(to_cell);
vec3 dir_cell = normalize(rel_cell);
- vec3 delta = abs(1.0 / dir_cell); //vec3(length(rel_cell)) / rel_cell);
+ vec3 delta = min(abs(1.0 / dir_cell), params.grid_size); // use params.grid_size as max to prevent infinity values
ivec3 step = ivec3(sign(rel_cell));
vec3 side = (sign(rel_cell) * (vec3(icell) - from_cell) + (sign(rel_cell) * 0.5) + 0.5) * delta;