Version: 2019.1
Shadowmask
Subtractive mode

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 > Rendering > 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, then select the Quality category), 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, then select the Quality category, and navigate to the Shadows section), 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.

  • 2017–09–18 Page published with limited editorial review

  • Light Modes added in 5.6

Shadowmask
Subtractive mode
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961