Distance Shadowmask
Distance Shadowmask is a version of the Shadowmask lighting mode. It is shared by all Mixed Lights in a Scene. To set Mixed lighting to Distance Shadowmask:
- Open the Lighting window (menu: Window > Lighting > Settings), click the Scene tab, navigate to Mixed Lighting, and set the Lighting Mode to Shadowmask.
- Next, open the Quality Settings (menu: Edit > Project Settings > Quality), navigate to Shadowmask Mode and set it to Distance Shadowmask.
See documentation on Mixed lighting to learn more about this lighting mode, and see documentation on Light modes to learn more about the other modes available.
A shadow mask is a Texture that shares the same UV layout and resolution with its corresponding light map. It stores occlusion information for up to 4 lights per texel, because Textures are limited to up to 4 channels on current GPUs.
The Distance Shadowmask mode is a version of the Shadowmask lighting mode that includes high quality shadows cast from static GameObjects onto dynamic GameObjects.
Within the Shadow Distance (menu: Edit > Project Settings > Quality > Shadows), Unity renders both dynamic and static GameObjects into the shadow map, allowing static GameObjects to cast sharp shadows onto dynamic GameObjects. For this reason, Distance Shadowmask mode has higher performance requirements than Shadowmask mode, because all static GameObjects in the scene are rendered into the shadow map.
Beyond the Shadow Distance:
- Static GameObjects receive high-resolution shadows from other static GameObjects via the precomputed shadow mask.
- Dynamic GameObjects receive low-resolution shadows from static GameObjects via Light Probes.
A good example of when Distance Shadowmask mode might be useful is if you are building an open world Scene with shadows up to the horizon, and complex static Meshes casting real-time shadows on moving characters.
Shadows
The following table shows how static and dynamic GameObjects cast and receive shadows when using Distance Shadowmask mode:
|
Dynamic receiver A dynamic GameObject that is receiving a shadow from another static or dynamic GameObject |
|
Static receiver A static GameObject that is receiving a shadow from another static or dynamic GameObject |
|
Within Shadow Distance |
Beyond Shadow Distance |
Within Shadow Distance |
Beyond Shadow Distance |
Dynamic caster A dynamic GameObject that is casting a shadow |
Shadow map |
- |
Shadow map |
- |
Static caster A static GameObject that is casting a shadow |
Shadow map |
Light Probes |
Shadow map |
Shadow mask |
Advantages and disadvantages of Distance Shadowmask mode
The performance requirements of Distance Shadowmask mode make it a good option for building to high-end PCs and current generation consoles. These are the most significant advantages and disadvantages of using Distance Shadowmask mode:
Advantages
- It provides the same visual effect as Realtime Lighting.
- It provides real-time shadows from dynamic GameObjects onto static GameObjects, and static GameObjects onto dynamic GameObjects.
- One Texture operation in the Shader handles all lighting and shadows between static GameObjects.
- It automatically composites dynamic and static shadows.
- It provides indirect lighting.
Disadvantages
- It only allows up to 4 overlapping light volumes (see documentation under the ‘Technical details’ section of Mixed lighting for more information).
- It has increased memory requirements for light map Texture sets.
- It has increased memory requirements for shadow mask Textures.
- It has increased performance requirements, because Unity renders light and shadow from static GameObjects into shadow maps.
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Is something described here not working as you expect it to? It might be a Known Issue. Please check with the Issue Tracker at issuetracker.unity3d.com.
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thanks for helping to make the Unity documentation better!