Merge pull request #86583 from reduz/lightmapper-dda-fix

Tiny fix for lightmapper DDA
This commit is contained in:
Rémi Verschelde 2024-01-11 17:37:45 +01:00
commit 9e967ebdf9
No known key found for this signature in database
GPG Key ID: C3336907360768E1
2 changed files with 11 additions and 2 deletions

View File

@ -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.")); EditorNode::get_singleton()->show_warning(TTR("Lightmap data is not local to the scene."));
} break; } break;
case LightmapGI::BAKE_ERROR_TEXTURE_SIZE_TOO_SMALL: { 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; } break;
case LightmapGI::BAKE_ERROR_LIGHTMAP_TOO_SMALL: { 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.")); 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."));

View File

@ -264,7 +264,16 @@ uint trace_ray(vec3 p_from, vec3 p_to, bool p_any_hit, out float r_distance, out
break; 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; side += vec3(mask) * delta;
icell += ivec3(vec3(mask)) * step; icell += ivec3(vec3(mask)) * step;
iters++; iters++;