I'm trying to optimize my Unity game.
I have static objects, dynamic objects and (only) static lights. I wish to fully pre-compute lighting and shadows for the static objects while still maintaining realtime lighting and shadows for dynamic objects, and making them work together seamlessly.
From the documentation:
- Realtime: "Unity calculates and updates the lighting of Realtime Lights every frame during run time. No Realtime Lights are precomputed." So, If I set it to realtime, I'm not really optimizing anything, am I?
- Mixed: "Unity can calculate some properties of Mixed Lights during run time, but only within strong limitations. Some Mixed Lights are precomputed." It's unclear what "some properties" are and what would the consequences be.
- Baked: "Unity pre-calculates the illumination from Baked Lights before run time, and does not include them in any run-time lighting calculations. All Baked Lights are precomputed." This will work for static objects. However, dynamic objects will look as if there are no lights in the scene.
From what I see, Mixed would be what I need, but I would still have to adjust its sub-modes in the Lighting window which is non-trivial for me:
- Subtractive: Its description suggests it would solve all my problems and still be a nice optimization. However, static objects don't seem to receive dynamic objects' shadows or the other way around either.
- Baked Indirect, or Shadowmask: Does not seem to pre-compute direct lighting for static objects, throwing away performance gains.
The final question is: what method will lead me to the best performance in Unity with these requirements:
- There are static and dynamic objects that both need to be lit by direct lighting
- Both static and dynamic objects should be able to cast and receive shadows from each other
- All lights are static
- Indirect lighting is not important in this case