This PR implements .bake() for script usage on LightmapGI.
Implementation notes:
As .exr files cannot be imported at runtime, I save as a .res. This is also because when the lightmapper is available in exported projects, we can use .res files, while we can't save .exr files
The radiance changes setting to Radiance 128, and then resetting back to what it was, is because the lightmaps were not generating correctly at runtime using the Scene/Custom Sky environment options. Setting it to 128 fixes this. I am not sure what is causing this, possibly something related to environment_bake_panorama or sky_bake_panorama. There is a related Size2i parameter for this radiance size, but setting that to 256 while using a radiance size of 256 doesn't fix this issue.
module_lightmapper_rd_enabled build parameter has to be enabled for runtime baking to work
module_xatlas_unwrap_enabled, build parameter has to be enabled for runtime unwrapping to work
Hi ReDot community 👋
This PR implements
.bake()
for script usage on LightmapGI.Implementation notes:
module_lightmapper_rd_enabled
build parameter has to be enabled for runtime baking to workmodule_xatlas_unwrap_enabled
, build parameter has to be enabled for runtime unwrapping to workDemo video:
https://github.com/user-attachments/assets/542a1b5e-07b9-4b0d-a7df-668516359543
Project for testing: https://github.com/sourcelocation/lightmapruntimebakingtest/
Originally made for Godot, but their latest decision lead me to contribute to ReDot instead.