I’m using URP. I have a bunch of static objects (houses, tree, terrain), one dynamic object (a capsule) and a point light. I want the static objects to use a baked lightmap and I want the dynamic objects to cast realtime shadows.
I’ve tried to set the point light type to mixed, but it behaves just as a realtime. The FPS drop and I can see, that the baked lightmap is not used at all (can see it, because I test baking with low res lightmap)
I’ve switched the lighting mode (global lighting settings) from Shadowmask to Subtractive, but then the dynamic object has no shadow.
This is how it looks with lighting mode “shadowmask” (it doesn’t use the lightmap)
Did I misunderstand the concept of mixed lights?
How can I make Unity use the lightmap for static objects (saving me FPS) and realtime shadows for dynamic objects at the same time?
There are generally 3 kinds of mixed lighting (excluding Baked Indirect mode, which just disables mixed lighting).
Distance shadowmask: When close to the camera, renderers use realtime shadows. When far from the camera, renderers use the lightmap (shadowmask). The idea is to only pay the price of realtime shadows for renderers where you close enough to notice the difference. This seems to be the mode you are using in the first pic. If you move the camera further from the scene, you may see the change to shadowmasks, though depending on the selected distance threshold, it may be hard to see (this is kind of the point).
Regular shadowmask: Renderers always use the lightmap (shadowmask) regardless of distance.
Subtractive: Sort of similar to Regular shadowmask mode, but you only get realtime shadows from a single directional light. This is why you don’t see any shadows from the point light on the last image. Subtractive is meant for very low-end platforms.
Hope this clears it up a bit. Let me know if you still have questions.
Thanks @DevDunk and @Pema-Malling for your replies. I’ve read the docs meanwhile and have a better understanding of the different settings now.
I just still don’t know, how to archive my goal (having lightmap-shadows for static objects and realtime shadows for non-static objects)
If you want dynamic objects to only cast realtime shadows, and static objects to only cast baked shadows, the mode you want is Shadowmask mode (not Distance Shadowmask mode). In this mode, static objects cast only baked shadows, and dynamic objects cast only realtime shadows:
Shadows cast by dynamic objects onto static objects use realtime shadowmapping.
Shadows cast by dynamic objects onto dynamic objects use realtime shadowmapping.
Shadows cast by static objects onto static objects use shadowmasks (lightmapped shadows).
Shadows cast by static objects onto dynamic objects use occlusion stored in nearby light probes (aka probe occlusion).
Of course, all of this only applies to shadows cast by Lights that are set to Mixed Mode.
In URP you can select this mode under the Quality tab of the Project Settings