-
-
Notifications
You must be signed in to change notification settings - Fork 28
Variance Shadow Maps (VSM)
Variance Shadow Maps (VSM) is an alternative to Percentage-Closer Filtering (PCF), which are both used to achieve smooth penumbra.
While PCF works by sampling the shadow map multiple times and averaging the result during lighting computation, VSM blurs the shadow map as a whole. Thus, VSM does not require any complex sampling during the main geometry pass.
Generally, VSM is more expensive. But since it requires less resolution to fight aliasing, it can sometimes be preferred over traditional shadow mapping.
⚠️ Warning: VSM requires a valid background for proper blurring. Make sure to add a shadow-casting ground mesh.
⚠️ Warning: VSM suffers from lack of precision when used with theHalf
precision mode. Some platforms might not even support full precision for render targets required by VSM. In such cases, it is strongly recommended to use cascades or higher shadow map resolutions to mask the artifacts.
💡 Tip: because shadow acne is not a problem with VSM, positive
Normal Bias
can be used to fix light bleeding or even give shadows a more stylized "blobby" shape.
To enable VSM, Blur
should be set to any value other than None
in the Shadows/Shadow Maps
sub-section of the pipeline asset.
-
Box
: 2x2 blur with equal weights; -
Gaussian Low Quality
: a separable Gaussian blur with 3 horizontal and vertical samples; -
Gaussian High Quality
: a separable Gaussian blur with 5 horizontal and vertical samples.
Used to make the blur more intensive. Higher values, however, introduce obvious artifacts.
Full Gaussian High Quality
takes 5 samples. Blur Early Bail
makes it skip the remaining two if the average of the first two is below the provided threshold. The higher the threshold, the more values we skip, but it can also cause artifacting.
Low values make the shadows smoother, while high values help preventing light bleeding, which is an very common issue for VSM.
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