Search Issue Tracker
By Design
Votes
0
Found in
2018.4
2019.4
2019.4.28f1c1
2020.3
2021.1
2021.2
Issue ID
1343870
Regression
No
Light brightness gets intense until the 'Lightmap Encoding' quality is changed when baking Lightmap
How to reproduce:
1. Open the attached project's Scene labeled "Test"
2. Change the 'Lightmap Encoding' to 'Normal Quality' (Edit->Project Settings->Player->Other Settings->Rendering)
3. Bake the Lightmap (BakeTools->Bake)
4. Observe the Light in the Scene View
Expected result: Light brightness is not intense and doesn't change after modifying the 'Lightmap Encoding' quality value
Actual result: Light brightness is intense and reverts to normal after modifying the 'Lightmap Encoding' quality value
Reproducible with: 2018.4.36f1, 2019.4.28f1, 2020.3.13f1, 2021.1.13f1, 2021.2.0b1
Note:
- Reproducible with macOS and Windows
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Memory leak when a lot of UI elements are spawned and despawned
- Warnings are not logged in the Console window when using external code analyzers
- Errors “TLS Allocator ALLOC_TEMP_TLS, underlying allocator ALLOC_TEMP_MAIN has unfreed allocations, size 288“ appear constantly when Prefab is open
- Crash on PPtr<Shader>::operator or NullException errors spammed in console when calling Dispose() on null GraphicsBuffer with baked Reflection Probes
- “EndRenderPass: Not inside a Renderpass” and other Render Graph errors in the Player when Render Graph is enabled and Overlay UI is used
Resolution Note (2022.1.X):
Lightmap Encoding is not exactly an input to light baking. It affects the texture importers for lightmaps, and thus causes lightmaps to be reimported when the setting is changed in the Project Settings window. The setting is relevant primarily after baking.
When you change this setting in said window the internal Lightmapping.OnUpdateLightmapEncoding(BuildTargetGroup) is called immediately after, which, among other actions, will reimport lightmaps. If you want to use reflection to change the lightmap encoding setting, you should also use reflection to call this method like shown in the snippet below.
Doing this before baking, however, does not make much sense, since as soon as you change the project setting, the chosen encoding will be used for all lightmaps in the project. Lightmap encoding being per-bake or per-lightmap is currently not supported.
Snippet of how to call OnUpdateLightmapEncoding:
```
typeof(Lightmapping).GetMethod("OnUpdateLightmapEncoding", BindingFlags.NonPublic | BindingFlags.Static).Invoke(null, new object[] { EditorUserBuildSettings.selectedBuildTargetGroup });
```