Legacy Documentation: Version 2018.2 (Go to current version)
Shadowmask
Subtractive mode
Other Versions

Distance Shadowmask

Distance Shadowmask is a version of the ShadowmaskA Texture that shares the same UV layout and resolution with its corresponding lightmap. More info
See in Glossary
lighting mode. It is shared by all Mixed Lights in a Scene. To set Mixed lightingA Light Mode for creating indirect lighting, shadowmasks and subtractive lighting. Indirect lighting gets baked into lightmaps and light probes. Shadowmasks and light probes occlusion get generated for baked shadows. More info
See in Glossary
to Distance Shadowmask:

  • Open the Lighting window (menu: Window > RenderingThe process of drawing graphics to the screen (or to a render texture). By default, the main camera in Unity renders its view to the screen. More info
    See in Glossary
    > Lighting Settings), click the SceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
    See in Glossary
    tab, navigate to Mixed Lighting, and set the Lighting Mode to Shadowmask.
  • Next, open the Quality Settings (menu: Edit > Project SettingsA broad collection of settings which allow you to configure how Physics, Audio, Networking, Graphics, Input and many other areas of your Project behave. More info
    See in Glossary
    > 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 modesA Light property that defines the use of the Light. Can be set to Realtime, Baked and Mixed. More info
See in Glossary
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 GameObjectsThe fundamental object in Unity scenes, which can represent characters, props, scenery, cameras, waypoints, and more. A GameObject’s functionality is defined by the Components attached to it. More info
See in Glossary
onto dynamic GameObjects.

Within the Shadow Distance (menu: Edit > Project Settings > Quality > ShadowsA UI component that adds a simple outline effect to graphic components such as Text or Image. It must be on the same GameObject as the graphic component. More info
See in Glossary
), 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 ProbesLight probes store information about how light passes through space in your scene. A collection of light probes arranged within a given space can improve lighting on moving objects and static LOD scenery within that space. More info
    See in Glossary
    .

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 receiverA dynamic GameObject that is receiving a shadow from another static or dynamic GameObject More info
See in Glossary

A dynamic GameObject that is receiving a shadow from another static or dynamic GameObject
Static receiverA static GameObject that is receiving a shadow from another static or dynamic GameObject More info
See in Glossary

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 ShaderA small script that contains the mathematical calculations and algorithms for calculating the Color of each pixel rendered, based on the lighting input and the Material configuration. More info
    See in Glossary
    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

对文档有任何疑问,请移步至开发者社区提问,我们将尽快为您解答