Understanding Shadows in Game Graphics

Slide Note
Embed
Share

Delve into the world of shadows in game graphics, exploring punctual light algorithms, shadow volumes, shadow rays, shadow maps, shadow acne, shadow bias, and shadow resolution. Learn about directional lights, point lights, spot lights, and the various challenges and solutions associated with generating realistic shadows in game environments.


Uploaded on Oct 09, 2024 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. Shadows UMBC Graphics for Games

  2. Punctual Shadow Algorithms

  3. Punctual Lights No, not lights that are always on time For each point on the surface, the light comes from one direction Directional lights Same direction everywhere = Light is far enough away that rays are parallel Mostly special case for the sun Point lights Light radiates from a single point Spot lights Really just a point light with some masking

  4. 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

  5. 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

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

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

  8. Shadow Resolution Want about 1 shadow pixel per image 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

  9. 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

  10. 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 Umbra Penumbra

  11. Abuse Shadow Filtering For any of PCF, VSM, MSM Lie about the filter size Usually a fixed amount of softening For distance field Keep tracing if slightly shadowed Compute penumbra from smallest difference

  12. 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:

  13. Multiple Point Lights Same lights for all pixels = shadow bands Different lights for each pixel = noisy shadows Recent work [Heitz et al. 2018] combines LTC & per-pixel sampling LTC = unshadowed polygonal area light shining on a surface with an approximation to the BRDF Basically factors in how much shadows change things

More Related Content