summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-01-11 17:37:45 +0100
committerRémi Verschelde <rverschelde@gmail.com>2024-01-11 17:37:45 +0100
commit9e967ebdf90e32fb93a7895a19a4111e72d9c660 (patch)
tree46c7953279d86116f55fa3b70bc3f939a1fa6b50
parent3dcf9059ae375f0cbee472d9dbc2f15aaa27e216 (diff)
parentcaef2be758e52ecbe5234d2e5fe941619cd1c4f8 (diff)
downloadredot-engine-9e967ebdf90e32fb93a7895a19a4111e72d9c660.tar.gz
Merge pull request #86583 from reduz/lightmapper-dda-fix
Tiny fix for lightmapper DDA
-rw-r--r--editor/plugins/lightmap_gi_editor_plugin.cpp2
-rw-r--r--modules/lightmapper_rd/lm_compute.glsl11
2 files changed, 11 insertions, 2 deletions
diff --git a/editor/plugins/lightmap_gi_editor_plugin.cpp b/editor/plugins/lightmap_gi_editor_plugin.cpp
index 3b1b1e47cb..335498dff9 100644
--- a/editor/plugins/lightmap_gi_editor_plugin.cpp
+++ b/editor/plugins/lightmap_gi_editor_plugin.cpp
@@ -105,7 +105,7 @@ void LightmapGIEditorPlugin::_bake_select_file(const String &p_file) {
EditorNode::get_singleton()->show_warning(TTR("Lightmap data is not local to the scene."));
} break;
case LightmapGI::BAKE_ERROR_TEXTURE_SIZE_TOO_SMALL: {
- EditorNode::get_singleton()->show_warning(TTR("Maximum texture size is too small for the lightmap images."));
+ EditorNode::get_singleton()->show_warning(TTR("Maximum texture size is too small for the lightmap images.\nWhile this can be fixed by increasing the maximum texture size, it is recommended you split the scene into more objects instead."));
} break;
case LightmapGI::BAKE_ERROR_LIGHTMAP_TOO_SMALL: {
EditorNode::get_singleton()->show_warning(TTR("Failed creating lightmap images. Make sure all meshes selected to bake have `lightmap_size_hint` value set high enough, and `texel_scale` value of LightmapGI is not too low."));
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++;