- Home /
No lightmap with mixed light
Simple scene:
A floor
A sphere above it
A directional light
The floor and the sphere has the "Lightmap static" enabled.
Case A: The "Mode" property of the light is set to "Baked". As per the docs, we now have only lightmap on the two objects. This works perfectly whereever I go with my camera.
Case B: The "Mode" property of the light is set to "Realtime". As per the docs, we now have only realtime shadow that is visible only within a given distance. So I have to approach the objects and look at them closely enough to see the realtime shadows. Despite they are marked as "Lightmap static", Unity renders realtime shadows for them.
Case C: The "Mode" property of the light is set to "Mixed". Here my problems come. As per the docs, this way a single light is able to take care of both static and dynamic objects shadows. However if I use this option, the shadow of my static objects is only visible from a close distance. Why? I realized that actually it renders only the realtime shadows for the static objects too.
To be honest I don't really understand this approach. Let's say I have a few buildings on a terrain and a character that I control from a 3rd person camera.
My questions
How can I set up my scene, to see both the cheap static lightmap on the ground even from greater distances and the more expensive shadows of the dynamic objects that are close to the camera?
Is it possible with a single directional light?
Why is it called mixed, if it's not using the baked lightmap, but the dynamic shadow map only?
I really appreciate your help. I might seem to be a beginner and you are totally right, so I hope the solution is just a few easily understandable sentence. :)
Answer by Firas4d · Mar 26, 2018 at 08:54 AM
1- The key you are looking for is "subtractive" lighting mode which can be reached from the lighting settings -> mixed lighting section. This mode will allow the lights marked as mixed to provide baked shadows to static object while still providing a real-time shadows to non static objects.
2- Of course.
3- Well it's a bit confusing since there are 2 places to change the lighting mode from (the light itself and the lighting settings). By default shadow mask mode is already selected which means the mixed lights will provide only run time shadows to both static and non static objects in addition to baked indirect illumination (hence this is why it's called mixed) and by the way shadows are result of direct lighting calculations not the other way around.
Hope this answers your questions :)
Answer by Noblauch · Apr 14, 2018 at 01:57 PM
Oh my god. Firas4d, you saved me scene. Was messing around with lighting for days now and after hours of baking this is the setting that fixed everything! Thanks 4 that! :)
Your answer
Follow this Question
Related Questions
Light only generates shadows on realtime and mixed mode, not on baked 0 Answers
Unity 5 Lightmapping 0 Answers
White Spots after baking lights 0 Answers
Baked + Real-Time Shadows 6 Answers
Windows build is much darker than Editor 0 Answers