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.
624 stars 89 forks source link

Having realtime shadows on the baked prefabs #20

Closed FedericoCara closed 3 years ago

FedericoCara commented 3 years ago

Hi, I made the bake on some prefabs, and now when I try them in a new scene they are affected by the directional light as if they have not been baked. I tried changing the layer of the meshes inside the prefabs so that I set the directional light in the scene to that the culling mask don't affect them. It solves the "double" lighting issue, but now shadows are not casted onto them (which makes sense...) I suppose there must be a way of making the prefabs behave as already baked.

Ayfel commented 3 years ago

I recommend playing with mixed lighting https://docs.unity3d.com/2018.3/Documentation/Manual/LightMode-Mixed.html to get the effect you want. You can also remove the the directional light from the scene and only have lights inside the prefabs. Many ways to achieve what you might want to show.