-
-
Notifications
You must be signed in to change notification settings - Fork 26
Shadows
To enable shadows:
- In the pipeline asset's
Shadows
section, setMode
toShadow Mapping
; - Ensure the
Directional
toggle inShadows/Shadow Maps
is enabled; - Ensure the main (directional) light on the scene is:
- enabled;
-
Mode
is set toRealtime
orMixed
; -
Shadow Type
is any mode other thanNo Shadows
.
📝 Note: this page describes the traditional approach for shadow maps. Toon RP also supports Variance Shadow Maps and Blob Shadows.
📝 Note: a smooth penumbra can be achieved via either Soft Shadows or Variance Shadow Maps.
Shadow receivers use a ramp separate from the global when applying shadows.
Threshold
, Crisp Anti Aliased
, and Smoothness
control the shadow ramp.
Increasing Max Distance
improves the general draw distance for shadows. However, the larger the distance, the less detailed shadows are.
Distance Fade
controls how smooth should the shadows be cut off near the max distance.
A stylized pattern can be applied to shadows. The pattern is sampled using world space position. Tiling can be controlled via Pattern Scale
.
Example with pattern and scale (1, 0, 1):
Cascaded shadow maps work by splitting the view into several sections, and rendering shadows separately for each of them. While a bit costly, this allows having different pixel densities per-cascade. This means more resolution for closer objects, less for farther ones.
Picture taken from learn.microsoft.com.
The maximum number of cascades is 4. The beginning of each cascade relative to the camera can be controlled via Cascade Ratio 1
, Cascade Ratio 2
, and Cascade Ratio 3
respectively.
Shadow acne is a very common problem associated with shadow mapping.
A solution is to increase Depth
and Slope
biases. However, if set too high, they can cause so-called Peter Panning (a shadow disconnected from the object casting it).
No Bias | Right Amount of Depth and Slope Bias | Too High Bias |
---|---|---|
![]() |
![]() |
![]() |
Another solution is to work around Normal Bias
. It offsets the shadow mesh along the geometry normals. Sometimes, however, it causes shadows to be too narrow. Not only it causes incorrect visuals, it can also make the light "bleed" - pass where it shouldn't.
In Toon RP, Normal Bias
can be both positive and negative. Positive values "inflate" the geometry, while negative ones "deflate" it.
No Bias | Right Amount of Normal Bias | Too High Bias |
---|---|---|
![]() |
![]() |
![]() |
Getting Started
Platform Support
Lighting and Shadows
- Global Ramp
- Shadows
- Variance Shadow Maps (VSM)
- Soft Shadows
- Additional Lights
- Additional Light Shadows
- Tiled Lighting (Forward+)
- Blob Shadows
- Fake Additional Lights
- Baked Lighting
Render Quality
Miscellaneous
Post-Processing
- Post-Processing Stack
- Bloom
- Inverted Hull Outline
- Screen-Space Outline
- SSAO
- Motion Blur
- Sharpen
- Light Scattering
Making Custom Shaders
Debugging