0

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?

91378246
  • 488
  • 6
  • 14

1 Answers1

1

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
Serlite
  • 12,130
  • 5
  • 38
  • 49
  • Thank you for you answer, but this doesn't help in this case as everything gets generated ingame => The room hasn't to be in this position, it can be rotated or be placed anywhere. – 91378246 Feb 02 '16 at 13:48
  • If you're lighting the scene with a directional light (so the positions of the rooms won't affected the lighting), one workaround to this is to instantiate all of the prefabs in a scene, bake their lightmaps, extract the lightmap data to store in the prefab instances, and update the original prefab reference. Not a very simple solution, but it's a current limitation of Unity 5. Here's the [related thread](http://forum.unity3d.com/threads/problems-with-instantiating-baked-prefabs.324514/). See Page 1 for the sample project, Page 4 for the most updated script. – Serlite Feb 02 '16 at 16:08
  • Thank you again, but I couldn't get it working, it's a bit too complicated for me (I don't know much about lightning). Isn't there a simpler solution? [And why doesn't unity want to fix it?](https://issuetracker.unity3d.com/issues/prefabs-dont-store-ligthtmap-information-correctly) – 91378246 Feb 02 '16 at 19:01
  • Sorry, but I haven't found any other resources online that suggest a better way to do this. A different option would be to lightmap these room models in a 3D modelling software like Maya or Blender, and use the generated textures for your models in Maya. Then you can fiddle with their render settings to not be lit by the actual lights in Unity. That's all I can think of at the moment. (Can't speak for the Unity team's priorities, so not sure why they haven't fixed this yet.) – Serlite Feb 02 '16 at 20:59