Inverted Normal Studio

Sharp Stencil Shadows

Documentation for Sharp Stencil Shadows, a URP renderer feature for hard, pixel-exact stencil shadow volumes.

Demo Scenes

Home › Getting Started

Both demos need the renderer feature installed on the active URP asset. The welcome window's preset buttons switch to a bundled sample asset that already has it. See Sample URP pipeline assets.

Stencil Shadow Demo

Demo/Scenes/StencilShadowDemo.unity is a compact scene: static, overlapping, and non-uniformly scaled casters, an animated skinned caster, an alpha-clipped grate, and a stained-glass pane over flat, stepped, and vertical receivers. A spot light over the grate and a point light over the glass cast shadows in URP Lighting mode.

Controls and statistics

The top-left panel shows live backend, atlas, and light statistics and switches settings:

Key Switch
1, 2, 3 Backend: Auto, CPU, GPU
D Debug volume view
T Transparent caster mode
L Lighting mode
C Colored sun transmittance
G Point and spot light transmittance

Shadow Odyssey showcase

Showcase/Scenes/ShadowOdyssey.unity is a cinematic tour with one chapter per feature. Unity's own light shadows are off in the scene, so every shadow comes from Sharp Stencil Shadows.

Chapters

  1. Caster Court: hard shadows and self-cancellation.
  2. Wiggle Worms: skinned mesh casters.
  3. Grass Field with Banners and Fragment Ball: GPU-deformed meshes.
  4. Stained Glass Array: textured translucent casters.
  5. Grate Array: alpha-clipped cutout casters.
  6. Physics Funnel: dynamic rigidbody casters.
  7. Pulsating Pillar Array: many animated casters.
  8. Mini City: orthographic camera support.
  9. Cage Lanterns, Spot Lights Through Grates, Stained Glass Chandelier, and Planetary System: point and spot light shadows and colored transmittance in the dark.

On-screen settings

In Play Mode the showcase starts with every feature on. Your renderer's own settings are restored when Play Mode ends.

Key Switch Options
L Lighting mode Overlay, URP Lighting
C Colored sun transmittance Off, On
G Point and spot light transmittance Off, On
T Transparent casters Off, Uniform, Textured
S Atlas tile sizing Caster, Receivers
D Debug volume view Off, On
1, 2, 3 Volume generation Auto, CPU, GPU
M GPU-deformed meshes Off, On
V Rendering path Forward, Forward+, Deferred, Deferred+
None (panel only) Graphics API DX12, DX11, Vulkan (Windows); Vulkan, OpenGL ES (Android)

The Graphics API switch works in Windows and Android players and restarts the player. Android devices that Unity's Vulkan device filter excludes stay on OpenGL ES. The rendering path switch works with the PC and Mobile sample pipelines, which each include all four renderers. While the tour runs, it raises the active URP asset's Max Distance to 100 m for its wide shots and restores it afterwards. Point and spot light shadows need URP Lighting. In Overlay, the vault's lights shine unshadowed.

Tour controls

Key Action
Space, P Pause everything
Shift+P Pause the camera only; the scene keeps moving
Left, Right Previous or next shot
R Restart
F Frame rate limit: unlimited, 30, 60, 120
H Hide the overlay

On phones and tablets, use the Prev, Pause, Next, and Hide UI buttons in the bottom-right corner, or tap the left or right side of the screen, away from the panels, to skip shots. The frame rate limit is in the settings panel's Rendering section. The tour starts with no frame rate limit on every platform.

Each shot is a ShowcaseShot marker in the hierarchy, which can be moved or retimed.

Sample URP pipeline assets

Settings contains preconfigured URP assets. The welcome window's preset buttons assign one to the current quality level in Project Settings > Quality. The change persists until you assign another asset.

Preset Renderers Render scale Lighting mode Backend
PC Forward+ Forward+, Forward, Deferred, Deferred+ 100% URP Lighting GPU
PC Deferred Deferred 100% URP Lighting GPU
PC Deferred+ Deferred+ 100% URP Lighting GPU
Mobile Forward Forward, Forward+, Deferred, Deferred+ 80% Overlay Auto

The Mobile renderers carry no screen-space ambient occlusion.

Repair bundled sample renderers reinstalls the feature on all eight sample renderer assets.