Search code examples
unity-game-enginereal-timelightning

Unity3D realtime illumination


I'm generating a dungeon out of prefabs => lightning has to be realtime. I also have a Directional light with baking set to realtime. But as you can see on this picture, it looks really bad.lightning
I have two questions now:

  • Why doesn't it illuminate the room like a real light would do?

  • Has someone some tips on real time illumination?


Solution

  • The lighting effect that you're describing is a component of a Global Illumination (GI) system. Generally, GI is a very expensive operation that can't be performed in realtime for applications such as games. However, since Unity 5 was released, the game engine offers a couple solutions for this: baked GI, and realtime (precomputed) GI.

    You're probably more likely to use the latter solution, so here's a pretty good tutorial covering the different settings available. Naturally, the Unity documentation has plenty of information on the topic too (just click through the subtopics of Global Illumination).

    The basic things to check/remember:

    • Set your objects as Static, or use Light Probes to allow them to be baked/precomputed for global illumination
    • Make sure the desired Global Illumination option is checked off in the Lighting tab