Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BakedLightmap crashes when baking in a large scene with hundreds of 3D objects #62222

Closed
sanyi12 opened this issue Jun 19, 2022 · 5 comments
Closed

Comments

@sanyi12
Copy link

sanyi12 commented Jun 19, 2022

Godot version

3.4.4 stable

System information

Windows 10 GLES3 Nvidia version 512.95

Issue description

Baking lightmaps crashes Godot.
The scene has 4 omnilights and hundreds of 3d objects from a single GLTF file. BakedLightmap node is default except the quality which was set to low to speed up the baking time.

Steps to reproduce

This is what the console says before crashing:

Godot Engine v3.4.4.stable.official.419e713a2 - https://godotengine.org
OpenGL ES 3.0 Renderer: NVIDIA GeForce RTX 3070 Laptop GPU/PCIe/SSE2
OpenGL ES Batching: ON

ERROR: FATAL: Index p_index = 5 is out of bounds (count = 4).
   at: operator[] (./core/local_vector.h:162)
ERROR:ERROR: FATAL: Index p_index = 5 is out of bounds (count = 4).
 FATAL: Index p_index = 5 is out of bounds (count = 4).
   at: ERROR:   at: operator[] (./core/local_vector.h:162)
 FATAL: Index p_index = 5 is out of bounds (count = 4).
operator[] (./core/local_vector.h:162)
   at: operator[] (./core/local_vector.h:162)

Minimal reproduction project

Sadly the project has more than 4GBs.

@Calinou
Copy link
Member

Calinou commented Jun 19, 2022

3.3.4 stable

Godot 3.3.x is not supported for bug fixes anymore, so please upgrade to 3.4.4 and check if the issue still occurs there.

Also, I'd try 3.5.rc3 as it supports multiple images in atlases when baking lightmaps. (Make backups of your project files before upgrading!)

@Calinou Calinou added this to the 3.x milestone Jun 19, 2022
@Calinou Calinou changed the title Bake lightmap crash BakedLightmap crashes when baking in a large scene with hundreds of 3D objects Jun 19, 2022
@sanyi12
Copy link
Author

sanyi12 commented Jun 21, 2022

sorry my bad - I am using 3.4.4 I edited the initial issue.
I tried 3.5 and crashes as well. Because this is very strange I managed to put the gltf file online so you guys can take a look at it.
(please use it for testing purposes only)
https://we.tl/t-NzixzwWvzE

@sanyi12
Copy link
Author

sanyi12 commented Jun 21, 2022

I also tested this in G4 and crashes. I do need to test it more as I am not sure on the testing method.

@Calinou
Copy link
Member

Calinou commented Jun 21, 2022

I also tested this in G4 and crashes. I do need to test it more as I am not sure on the testing method.

On Godot 4, this is likely the same cause as #45296.

On both Godot 3 and 4, you probably need to increase the lightmap's texel size to reduce the generated texture size. This will also lead to smaller file sizes. The default value of 0.1 in Godot 3.x and 0.2 in Godot 4.0 is tuned for small-scale levels, not massive open worlds. In large levels, you probably want to use a value between 0.5 and 2.0 (if not more). To do so, select your glTF scenes in the FileSystem dock, go to the Import dock, increase Lightmap Texel Size, click Reimport and bake lightmaps again.

@Calinou
Copy link
Member

Calinou commented Apr 30, 2023

@Calinou Calinou closed this as not planned Won't fix, can't repro, duplicate, stale Apr 30, 2023
@Calinou Calinou removed this from the 3.x milestone Apr 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants