summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2023-01-16 22:28:36 +0100
committerGitHub <noreply@github.com>2023-01-16 22:28:36 +0100
commitecfd57026e9939b6cd8197eaf06c945317f5359f (patch)
treeb838c7cee84a2a9d2c47d555b1ff52f0ec997502
parent4005fc4b8da3616dcb8575d9c0dac02977316b4e (diff)
parente0e073138d9013aaf439e74966ebe28245881ece (diff)
Merge pull request #71375 from clayjohn/LightmapGI-crash
Enforce a default minimum lightmap size hint size
-rw-r--r--scene/3d/lightmap_gi.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/scene/3d/lightmap_gi.cpp b/scene/3d/lightmap_gi.cpp
index a6d63619df..6940bad4a6 100644
--- a/scene/3d/lightmap_gi.cpp
+++ b/scene/3d/lightmap_gi.cpp
@@ -763,7 +763,15 @@ LightmapGI::BakeError LightmapGI::bake(Node *p_from_node, String p_image_data_pa
MeshesFound &mf = meshes_found.write[m_i];
- Size2i lightmap_size = mf.mesh->get_lightmap_size_hint() * mf.lightmap_scale;
+ Size2i lightmap_size = mf.mesh->get_lightmap_size_hint();
+
+ if (lightmap_size == Size2i(0, 0)) {
+ // TODO we should compute a size if no lightmap hint is set, as we did in 3.x.
+ // For now set to basic size to avoid crash.
+ lightmap_size = Size2i(64, 64);
+ }
+
+ lightmap_size *= mf.lightmap_scale;
TypedArray<RID> overrides;
overrides.resize(mf.overrides.size());
for (int i = 0; i < mf.overrides.size(); i++) {