Ayfel / PrefabLightmapping

Script for saving lightmapping data to prefabs. Used through the Assets tab in Unity. Place your prefbas in the scene with this script at the root. Set up your lighting and in the editor go to Assets->Bake Prefab Lightmaps. After is processed you can now spawn your prefabs in different scenes and they will use the lightmapping from the original scene.
618 stars 88 forks source link

Lightmap broken on android and URP #35

Closed patricksommer closed 3 years ago

patricksommer commented 3 years ago

When running on an Android device the result is not as expected. When using LightmapPrefabData the results are as below. Baked lightmapping on static objects without LightmapPrefabData works as expected.

Editor in Play mode image

Running on Android device image

patricksommer commented 3 years ago

there is the following warning, may be applicable:

The renderer GW_Corner_Out_0.012 is a part of a static batch. Setting the lightmap scale and offset will not affect the rendering. The scale and offset is already burnt into the lightmapping UVs in the static batch. UnityEngine.Renderer:set_lightmapScaleOffset (UnityEngine.Vector4) PrefabLightmapData:ApplyRendererInfo (PrefabLightmapData/RendererInfo[],int[],PrefabLightmapData/LightInfo[]) (at Assets/Scripts/PrefabLightmapData.cs:134) PrefabLightmapData:Init () (at Assets/Scripts/PrefabLightmapData.cs:104) PrefabLightmapData:OnSceneLoaded (UnityEngine.SceneManagement.Scene,UnityEngine.SceneManagement.LoadSceneMode) (at Assets/Scripts/PrefabLightmapData.cs:118) UnityEngine.SceneManagement.SceneManager:Internal_SceneLoaded (UnityEngine.SceneManagement.Scene,UnityEngine.SceneManagement.LoadSceneMode)

Ayfel commented 3 years ago

There is a know issue with URP that you can see here #28 , including those in your build/scene should solve it. But the information is good as I haven't seen any messages. I will try to reproduce it, or if you can make a repo project I could check.

Ayfel commented 3 years ago

I have just performed tests with 2020.3.5f1 and URP as well as HDRP and built to Android, no issues for me so this might be something else entirely. Let me know if you have any more information