Presentation is loading. Please wait.

Presentation is loading. Please wait.

UMBC Graphics for Games

Similar presentations


Presentation on theme: "UMBC Graphics for Games"— Presentation transcript:

1 UMBC Graphics for Games
Shadows UMBC Graphics for Games

2 Punctual Shadow Algorithms

3 Shadow Volumes Seldom used now
Find silhouette faces (extend triangle including light & edge) Increment counter for front-facing Hardware has a stencil buffer that is perfect for this Decrement counter for back-facing Lit if not 0 Problems & Variations Eye inside volume Adapt starting count, or count from ∞ Lots of pixels to fill Clipping & culling helps, but this is shadow volume’s biggest problem -1 +1 +1

4 Shadow Rays Trace rays through some representation of the geometry
Ray tracing’s primary shadow method Distance Field Shadows Pre-process 3D grid of distances to closest object Ray march (like volume shadows) At each step, can go at least as far as the distance stored there before you hit anything

5 Shadow Map Most common method Render objects from camera at light
Each pixel has 3D position, of the first thing the light sees from shadow map pixel position from stored depth value Render objects (or deferred pass) Each pixel has 3D position, from pixel position, from pixel depth Transform to light space, compare to

6 Shadow Acne & Shadow Bias
Numerical error for closest surface = self shadowing sometimes says yes when should equal Appears as random spots of shadow Bias Rather than , use Too little, still get artifacts Too much, and objects seem to float Some methods adjust per pixel

7 Shadow Resolution Want about 1 shadow pixel per pixel
Warped shadow space Non-linear shadow map pixel spacing Works for lights perpendicular to view, but not head lights Cascaded shadow maps Multiple shadow maps at different resolutions for each depth range This is the choice for most games UE4 shadow atlas

8 Shadow Aliasing Blending depths doesn’t work
Blending near & far depths gives a hard aliased shadow at a depth between them Percentage Closer Filtering (PCF) Evaluate shadow (0) or not (1) at four shadow texels Blend these intensities Variance Shadow Maps (VSM), [Moment Shadow Maps (MSM)] Average Z, Z2, [Z3, Z4] Estimate variance and shadow coverage Prone to precision problems & light leaks (assumes Gaussian-distributed depths) Exponential (& others): like VSM, but different distribution assumptions

9 Soft Shadows Area lights give soft-edged shadows Umbra (full shadow)
Penumbra (partial shadow) Contact hardening Penumbra size depends on how close blocker is to surface Penumbra Umbra

10 Abuse Shadow Filtering
For any of PCF, VSM, MSM Lie about the filter size Usually a fixed amount of softening

11 Percentage Closer Soft Shadows (PCSS)
Realistic penumbra width and contact hardening Assumes a spherical light Sample shadow map to estimate blocker distance Turn to per-pixel filter radius for PCF, VSM, MSM, etc. Similar triangles:

12 Multiple Point Lights Same lights for all pixels = shadow bands
Different lights for each pixel = noisy shadows Recent work combines LTC & per-pixel sampling Basically factors in how much shadows change things


Download ppt "UMBC Graphics for Games"

Similar presentations


Ads by Google