I created a scene from scratch in 2019.3.7f1. So the relevant lighting settings are default:
- Default Skybox
Shadowmask Baked Gl setting enabled
Intensity Multiplier set to 1 for both Env Lighting and Reflections
Bounces set to 1 for Env Reflections
In addition, like any default scene, there is one Directional Light set to Mixed mode.
I added a cube in an enclosed room (made up of 6 cubes stitched together so that no light can pass through).
The following is the lighting situation inside the room without baking. All objects are non-static:
Now I make all the walls static (and leave the enclosed cube dynamic). I would expect Unity to calculate the same light situation and simply apply it as a lightmap. Instead what I get is a proper dark room.
The questions are the following:
- Why the difference?
- Why the enclosed room is so bright in the non-static example in the first place? Nothing should get through and the only light should be the Ambient.
- How do I make so that the dynamic object inside the enclosed environment will receive the shadows from the walls/ceiling?
What you’re seeing here aren’t shadows; this is global illumination (GI). In reality, light doesn’t just stop once it hits something - some is bounced, some is absorbed, etc. In this case, the light you are seeing is ambient lighting from the environment/skybox. That doesn’t really make sense, because you can’t actually see the skybox from inside the room - no light can enter from the outside, so the room should be black. GI is fairly difficult to do in realtime due to the sheer amount of information processing required, so most GI has to be baked and can therefore only effect static objects. More recently some new realtime GI techniques have been proposed, but this is still emerging technology. If you want your dynamic objects to be effected by global illumination, you can use light probes;
You can think of these as small pre-baked panoramic captures of the scenes static lighting - place a group of them and a dynamic object is able to blend between the closest probes to approximate local GI.
Thanks @Namey5 ! I have been doing some more reading and experimenting in the meanwhile and mixing that to your answer I think I get it.
In the first case nothing is baked so even if my Directional Light is set to Mixed, there is basically no GI impact in the scene; at that stage it is behaving like a Realtime Light and therefore contributing only direct lighting to my Scene.
Then, when I set objects to static and go through the baking process, GI is applied. This contributes to much richer details (indirect light is now part of the game) and the scene looks darker. At this point changing any Ambient light setting will only affect Dynamic objects as the rest is just a texture.
So Answers are:
- Because of the impact of GI which is visible only after baking the lights.
- Because it is lit by the Skybox without GI at all. Apparently the Skybox only produces indirect light that it is not at all considered unless some sort of GI is enabled.
- Using light probes!