SplitPlane Shadow Volumes - PowerPoint PPT Presentation

About This Presentation
Title:

SplitPlane Shadow Volumes

Description:

SplitPlane Shadow Volumes – PowerPoint PPT presentation

Number of Views:54
Avg rating:3.0/5.0
Slides: 42
Provided by: tomas77
Category:

less

Transcript and Presenter's Notes

Title: SplitPlane Shadow Volumes


1
Split-Plane Shadow Volumes
  • Samuli Laine

Helsinki University of Technology Hybrid
Graphics, Ltd.
2
Shadow Volumes
  • Shadow volume Closed volume that is in shadow
  • Constructed by extruding silhouette edges
  • Rendering a shadow volume Identifying the
    pixels that are inside it
  • After this, we have shadow information in stencil
    buffer
  • Rendering shadow volumes is slow
  • Our goal is to make it faster

3
Z-Pass Algorithm
  • Count enter/exit events along a ray from the eye
  • Update stencil when SV primitive is in front of
    pixel
  • Problems with near plane clipping fixed recently
    ZP algorithm Hornus et al. 2005

Eye
4
Z-Fail Algorithm
  • Count enter/exit events along a ray from infinity
  • Update stencil when SV primitive is behind pixel

Eye
5
Lets Render a 2D Shadow Volume
  • 2D analog for a volume is a polygon
  • Easier to illustrate, since I only have 2D slides

Eye at Infinity
Stencil buffer
Contents of the depth buffer
6
Z-Pass Algorithm Example
  • Render 4-sided 2D shadow volume one side at a time

Eye at Infinity
Stencil buffer
Contents of the depth buffer
7
Z-Fail Algorithm Example
  • The same situation

Eye at Infinity
Stencil buffer
Contents of the depth buffer
8
When is Z-Pass Good?
  • No stencil updates where SV primitives are behind
    geometry

Good
Redundant update region
Eye at Infinity
Not good
Stencil buffer
Contents of the depth buffer
9
When is Z-Fail Good?
  • No stencil updates where SV primitives are in
    front of geometry

Redundant update region
Not good
Eye at Infinity
Good
Stencil buffer
Contents of the depth buffer
10
Meanwhile in 3D ...
11
Previous Solution Depth Bounds
  • The depth bounds hardware extension NVIDIA
    bounds the update regions
  • Application specifies min and max depth values
    for the update regions for each shadow volume
  • If pixels are outside these bounds, no updates
    performed
  • Problem bounds are often quite conservative

12
Depth Bounds Example 1
  • Best case no updates are needed

Eye at Infinity
Stencil buffer
Contents of the depth buffer
13
Depth Bounds Example 2
  • Unfortunately, it doesnt always work that well
  • This is a commoncase in 3D

Eye at Infinity
Stencil buffer
Contents of the depth buffer
14
Introducing the Split Plane
  • Count enter/exit events either from eye or from
    infinity, depending on which side of plane pixel
    is
  • ? Combination of Z-Pass and Z-Fail

Eye
Split plane
15
Mathematically Speaking
  • The formula for stencil buffer updates
  • Test between zfrag and zpixel is the depth test
  • Test between zpixel and zsplit is the new split
    test
  • Split test chooses between Z-Pass and Z-Fail

16
Why Is This A Good Idea?
  • The update region is limited between SV primitive
    and the split plane

Eye at Infinity
Split plane
17
Split Line Example
  • Works well with the problematic shadow volume
  • Assuming that we have chosen the split plane
    wisely

Eye at Infinity
Stencil buffer
Contents of the depth buffer
18
Z-Pass Updates
Z-Fail Updates
Split Plane Shown
SPSV Updates
19
Computing the Split Test
  • How should we actually perform the split test?
  • Naive Compute zsplit and compare against zpixel
  • Better Construct the point representing the
    pixel and classify against plane equation P of
    the split plane

20
Constructing the Split Plane
  • The choice of the split plane is important
  • Goal is to have the split depth inside the shadow
    volume
  • Two heuristic methods presented in the paper
  • Method 1 Point-Camera-Light
  • Method 2 Point-Point-Light

21
Method 1 Point-Camera-Light
  • Span the split plane according to
  • Pre-selected point p inside the object
  • Position of the light source l
  • Orient the plane so that it is maximally
    orthogonal to the ray from camera position c to
    light source l

22
Method 1 Example
23
Method 2 Point-Point-Light
  • Span the split plane according to
  • Two pre-selected points p1 and p2 inside the
    object
  • Position of the light source l
  • Camera position not taken into account

24
Method 2 Example
Method 1 Point-Camera-Light
Method 2 Point-Point-Light
25
Shadow Caster Decomposition
  • Optimization that is useful in conjunction with
    the split-plane shadow volume algorithm
  • Decompose shadow-casting object into a number of
    sub-objects
  • Assign individual split plane for each sub-object
  • Can give a significant reduction in number of
    stencil updates
  • Actually, it also helps a bit with depth bounds

26
Shadow Caster Decomposition, part 2
  • Example a tree decomposed into 49 sub-objects
  • 71 avg. reduction in pixel processing counts

Scene with shadows
Decomposed
Single object
27
Per-Tile Split Test
  • As such, we can only avoid stencil updates
  • Still the same number of pixels processed ?
  • Solution low-res split test in e.g. 88 pixel
    tiles
  • Safe, since we are just choosing between Z-Pass
    and Z-Fail
  • Then use either zmin or zmax from low-resolution
    Z buffer for early Z culling
  • Instead of (zpixel vs. zsplit) we thus have
    (ztile vs. zsplit)

28
Hardware Modifications
  • What do we need?
  • Compute the result of the split test for each
    rasterized tile
  • 3 MULs and 3 ADDs per tile
  • Low precision is OK
  • We are just choosing between Z-Pass and Z-Fail
  • Both work, so the image will always be correct

29
Hardware Modifications, part 2
  • Low-res rasterizer needs to have the split plane
  • Proposition split plane is given to the low-res
    rasterizer by the vertex shader
  • Thus, split plane would not be a part of the
    rendering state (unlike depth bounds)
  • No state changes would be required when changing
    the split plane
  • Split planes could be fed to GPU via auxiliary
    vertex streams

30
Results
  • Split-plane shadow volumes compared against
    Z-Pass and Z-Fail, both with depth bounds
  • Statistics gathered from animation sequences,
    1024768 resolution
  • Per-tile split test and early culling done in 88
    pixel tiles

31
Knight
Ratios between comparison algorithms and
split-plane shadow volumes
32
16Knights
Ratios between comparison algorithms and
split-plane shadow volumes
33
Tree
Ratios between comparison algorithms and
split-plane shadow volumes
34
Tree-Decomposed
Ratios between comparison algorithms and
split-plane shadow volumes
35
(No Transcript)
36
Per-Frame Pixel Processing Counts
37
(No Transcript)
38
Per-Frame Pixel Processing Counts
39
Discussion
  • The method can be applied whenever we need to
    identify pixels inside a polyhedral volume
  • Shadow volumes being the most prominent
    application
  • Only small hardware modifications required
  • Two-stage implementation might also be feasible
  • 1. render the split test results into 1-bit
    low-res buffer
  • 2. render shadow volume, fetching the results
    from buffer
  • Could use any kind of split surface or other
    heuristics

40
Future Work
  • Better understanding of how the split planes
    should be constructed new algorithms for that!
  • The two methods in the paper are just a starting
    point
  • Automatic shadow caster decomposition
  • Trade-off between better split planes vs. more
    silhouettes
  • Perhaps even dynamic on-the-fly decomposition
    based on light and camera positions?

41
Thank You!
  • Questions
  • Thanks go to
  • 3Dr group at HUT, especially Timo Aila, for
    discussions
  • National Technology Agency of Finland, Bitboys,
    Hybrid Graphics, Nokia and Remedy Entertainment
    for the cash
Write a Comment
User Comments (0)
About PowerShow.com