godotengine / godotengine/godot
Baking Lightmaps with LightmapGI breaks meshlibrary (Gridmap) transforms.
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
- Reproducible in 4.3 rc3
- Reproducible in 4.2.2 stable
### System information
Godot v4.3.rc3 - Fedora Linux 40 (KDE Plasma) - Wayland - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3080 (nvidia; 555.58.02) - 11th Gen Intel(R) Core(TM) i9-11900K @ 3.50GHz (16 Threads)
### Issue description
When baking lightmaps with LightmapGI, (VoxelGI untested) all transforms that I had saved into my meshlib revert, until I interact with the Gridmap again. Note that these transforms aren't the rotation I placed the grids with, rather the rotations I made while making the meshlibrary so they would all be properly aligned.
### Steps to reproduce
1. Get a random MeshInstance, doesn't matter where, it happened with GLTF files too.
2. Rotate it while creating the MeshLibrary and Unwrap the UV2 for Lightmaps
3. Save the MeshLibrary with the transforms you just made.
4. Put a Gridmap in another scene and place some of that tile from the MeshLibrary
5. Place a DirectionalLight, LightmapGI
6. Bake lights on the LightmapGI and watch the rotated tiles ignore the MeshLibrary transforms.
7. To undo the effect, interact with the GridMap, this will also destroy the Baked lights.
### Minimal reproduction project (MRP)
Note: Created in 4.3 rc3
Just open level.tscn and bake the lights on LightmapGI, the effect should immediately become visible.
[Archive.zip](https://github.com/user-attachments/files/16590233/Archive.zip)
Contributor guide
Research direction
Start by opening the provided Archive.zip and level.tscn, then reproduce the issue by baking LightmapGI lighting and comparing the GridMap tile transforms before and after baking. The fix is complete when saved MeshLibrary transforms remain applied after baking and no GridMap interaction is needed to restore them.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics, game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100