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

Shadows/Lights

-

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

  1. 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 });
    ```

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.