0
\$\begingroup\$

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
\$\endgroup\$
  • \$\begingroup\$ Do you have a specific performance problem with realtime lighting that you've measured through profiling? "Best" overall has a way of obscuring your requirements, while "what settings solve this specific problem" tends to get more focused, applicable answers. \$\endgroup\$ – DMGregory Nov 18 '19 at 12:52
  • 1
    \$\begingroup\$ "Both static and dynamic objects should be able to cast and receive shadows from each other" That basically means all your lighting should be real-time. Baked lighting is infused into textures, and won't affect non-static objects afaik. \$\endgroup\$ – John Hamilton Nov 21 '19 at 10:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.