Shadowmask is a version of the Shadowmask lighting mode shared by all Mixed Lights in a Scene. To set Mixed lighting to 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 lightmapA pre-rendered texture that contains the effects of light sources on static objects in the scene. Lightmaps are overlaid on top of scene geometry to create the effect of lighting. More info
See in Glossary. It stores occlusion information for up to 4 lights per texel, because Textures are limited to up to 4 channels on current GPUs.
Unity precomputes 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 other static GameObjects, and stores them in a separate Shadowmask Texture for up to 4 overlapping lights. If more than 4 lights overlap, any additional lights fall back to Baked Lighting. Which of the lights fall back to Baked Lighting is determined by the baking system and stays consistent across bakes, unless one of the lights overlapping is modified. Light Probes also receive the same information for up to 4 lights.
Light overlapping is computed independently of shadow receiving objects. So, an object can get the influence of 10 different mixed lights all from the same Shadowmask/Probe channel, as long as those light bounding volumesA closed shape representing the edges and faces of a collider or trigger. More info
See in Glossary don’t overlap at any point in space. If some lights overlap then more channels are used. And, if a light does overlap while all 4 channels have already been assigned, that light will fallback to fully baked.
In Shadowmask mode:
Static GameObjects receive shadows from other static GameObjects via the shadow mask, regardless of 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). They also receive shadows from dynamic GameObjects, but only those within the Shadow Distance.
Dynamic GameObjects receive shadows from other dynamic GameObjects within the Shadow Distance via shadow maps. They also receive shadows from static GameObjects, via Light Probes. The shadow fidelity depends on the density of Light Probes in the Scene, and the 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 mode selected on the MeshThe main graphics primitive of Unity. Meshes make up a large part of your 3D worlds. Unity supports triangulated or Quadrangulated polygon meshes. Nurbs, Nurms, Subdiv surfaces must be converted to polygons. More info
See in Glossary Renderer.
Unity automatically composites overlapping shadows from static and dynamic GameObjects, because shadow masks (which hold static GameObject lighting and shadow information) and shadow maps (which hold dynamic GameObject lighting and shadow information) only encode occlusion information.
A good example of when Shadowmask mode might be useful is if you are building an almost fully static Scene, using specular Materials, soft baked shadows and a dynamic shadow caster, not too close to the cameraA component which creates an image of a particular viewpoint in your scene. The output is either drawn to the screen or captured as a texture. More info
See in Glossary. Another good example is an open-world Scene with baked shadows up to the horizon, but without dynamic lighting such as a day/night cycle.
The following table shows how static and dynamic GameObjects cast and receive shadows when using 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 |
Light Probes | Light Probes | Shadowmask | Shadowmask |
The performance requirements of Shadowmask mode make it a good option for building to low and mid-range PCs, and mobile devices. These are the most significant advantages and disadvantages of using Shadowmask mode:
It offers the same visual effect as Realtime Lighting.
It provides real-time shadows from dynamic GameObjects onto static 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 overlapping shadows from static and dynamic GameObjects.
It has mid-to-low performance requirements, because it does not render static GameObjects into shadow maps.
It provides indirect lighting.
It only provides low-resolution shadows from static GameObjects onto dynamic GameObjects, via Light Probes.
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 the light map Texture set.
It has increased memory requirements for the shadow mask Texture.
2017–09–18 Page amended with limited editorial review
Light Modes added in 5.6
Added advice on light overlap computation in Unity 2017.1
Did you find this page useful? Please give it a rating: