Distance Shadowmask mode is a lighting mode 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 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 hybrid Mixed Lighting mode which combines the Baked Indirect and Shadowmask modes. Unlike Shadowmask mode, Distance Shadowmask includes high quality shadows cast from static GameObjects onto dynamic GameObject.
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:
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.
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 |
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:
2017–06–08 Page published with limited editorial review - Leave page feedback
Light Modes added in 5.6