91378246
91378246

Reputation: 508

Lighting an instantiated prefab, baked versus realtime

I'm generating a dungeon out of prefabs which means I design a room, save it in the resource folder and instantiate it at a random position with a random rotation while the game is running.

The problem I have is the lighting.

Because of the above mentioned generation process it has to be dynamic but it doesn't seem to work. Below you can see the comparison between a baked and realtime rendered room:

Baked (I also don't know where these strange lighting borders (on the walls), which are looking like someone painted the light with watercolors are coming from):

Backed

Realtime:

Realtime

As you can see, the realtime room doesn't seem to reflect light in any way. These are my lighting settings:

Settings

And this is my 'sun':
enter image description here

What am I doing wrong?

Upvotes: 0

Views: 3662

Answers (1)

HalpPlz
HalpPlz

Reputation: 701

Your lighting settings have Ambient Light set to 0- with realtime lighting, this means nothing that can directly see the source of a light will be lit at all. The screenshot with baked lighting looks different because it has a baked lightmap.

If you're trying to get the real-time lighting to look exactly like the baked, soyy, but Unity refuses to bake lightmaps at runtime. The closest you can probably get is by setting your Ambient Light to a color and its intensity above zero. Playing around with Light Probes probably won't be much good, since you need to light an entire room in a vacuum.

An alternate solution, depending on how well you know Unity, would be to Frankenstein together different scenes, which is mentioned briefly in Unity's Intro to Global Illumination, though I can't find it anywhere else.

Relevant links:

Baked Lightmaps: http://docs.unity3d.com/Manual/GIIntro.html

Light Probes: http://docs.unity3d.com/Manual/LightProbes.html

Ambient Light: http://docs.unity3d.com/Manual/GlobalIllumination.html

Upvotes: 2

Related Questions