GDC 2005 - PowerPoint PPT Presentation

About This Presentation
Title:

GDC 2005

Description:

Advanced Light and Shadow Culling Methods Eric Lengyel Fully Dynamic Environment Anything in the world can move Can t precompute any visibility information Lights ... – PowerPoint PPT presentation

Number of Views:91
Avg rating:3.0/5.0
Slides: 44
Provided by: JamilMo4
Category:

less

Transcript and Presenter's Notes

Title: GDC 2005


1
(No Transcript)
2
Advanced Light and Shadow Culling Methods
  • Eric Lengyel

3
Fully Dynamic Environment
  • Anything in the world can move
  • Cant precompute any visibility information
  • Lights completely dynamic
  • Cant precompute any lighting information
  • Shadows also completely dynamic

4
Problems to Be Solved at Run-time
  • Determine the set of objects visible to the
    camera
  • Determine the set of lights that can influence
    the region of space visible to the camera
  • For each light, also determine what subset of the
    visible objects can be illuminated

5
Problems to Be Solved at Run-time
  • Determine the set of objects that could possibly
    cast shadows into the region of space visible to
    the camera
  • A superset of the set of the illuminated objects
    that are visible to the camera

6
Visibility Determination
  • Organize the world in some way
  • Tree structures (BSP, octree, etc.)
  • Hierarchical bounding volumes
  • Portal system
  • A combination of these can work extremely well

7
Portal Systems
  • World divided into zones
  • A zone is the region of space bounded by a convex
    polyhedron
  • Zones are connected by portals
  • A portal is a planar convex polygon
  • From the front side, a portals vertices are
    wound CCW

8
Portal Systems
  • During visibility determination, only have to
    worry about zones that can be seen through a
    sequence of portals
  • For each reachable zone, there is a convex region
    of space visible to the camera

9
Portal Systems
Camera
10
Portal Systems
  • The visible regions form a tree structure
  • The region in the zone containing the camera is
    the root of the tree
  • Zones seen through n portalshave regions at the
    n-th level in the tree

11
Portal Systems
A
D
C
B
C
D
A
B
Camera
12
Portal Systems
  • Start with view frustum in zone containing the
    camera
  • Clip portals leading out of the zone against the
    view frustum
  • For any portals intersecting the view frustum,
    construct a new region by extruding clipped edges
    away from camera position

13
Portal Systems
  • Every visibility region is bounded by a convex
    polyhedron defined by at least 4 planes
  • At least 3 lateral planes
  • A back plane
  • A front plane in non-root nodes
  • Plane normals point inward

14
Portal Systems
  • After region tree has been built...
  • Traverse the tree
  • Collect objects in each zone that intersect the
    visible region of space for that zone
  • Use any frustum/bounding volume test, but test
    against regions planes
  • This is the visible object set

15
Light Region Trees
  • Portals can be used to construct illumination
    trees
  • Similar to the visibility tree constructed for
    the camera
  • One tree for each light source
  • Only recalculated when light moves
  • Each node in the tree corresponds to a convex
    region of space

16
Light Region Trees
  • Three fundamental light types
  • Point light
  • Spot light, special case of point light
  • Infinite (directional) light

17
Light Region Trees
  • Point light
  • Omnidirectional
  • Has maximum range
  • Root illumination region bounded only be zone
    boundary and lights bounding sphere

18
Point Light Tree
B
B
A
A
D
C
D
C
19
Spot Light Tree
  • Spot light almost same aspoint light
  • Difference is the root node of the illumination
    tree
  • Spot light starts with a frustum, just like a
    camera does
  • Point light affects entire root zone

20
Infinite Light Tree
  • Light rays parallel forinfinite light
  • The lateral planes of each illumination region
    intersect at parallel lines
  • The extrusion of planes from a portal always goes
    in one direction instead of away from a point

21
Visible Light Determination
  • Each zone keeps a linked list of illumination
    regions
  • One or more region nodes for each light that can
    shine into the zone
  • Each region knows which light generated it

22
Visible Light Determination
A
B
For example, consider zone C
Light 1
Light 2
C
D
Light 3
23
Visible Light Determination
Light 1
Light 2
Light 3
D
B
A
C
B
A
D
B
C
A
C
D
24
Visible Light Determination
  • For any given zone, we can walk the linked list
    of illumination regions and collect unique lights
  • Repeat process for all zones referenced in the
    cameras visibility tree
  • We now have the set ofvisible lights

25
Illuminated Object Set
  • Given one visible zone and one visible light
    shining into that zone
  • Illuminated objects are those which intersect
    both a camera region and a light region

26
Illuminated Object Set
Light
Camera
27
Illuminated Object Set
  • Objects are often only partially within an
    illumination region
  • Lighting the whole object wastes rendering time
    due to extra fill
  • Fortunately, hardware provides an opportunity for
    optimization

28
Lighting Optimization
  • Use hardware scissor rectangle
  • Calculate intersections of camera regions and
    illumination regions
  • Camera-space bounding box determines scissor
    rectangle
  • GL_EXT_depth_bounds_test
  • Works like a z axis for scissor box

29
Lighting Optimization
Max Depth
Min Depth
Image Plane
Camera
30
Lighting Optimization
  • Scissor rectangle and depth bounds test
  • Limits rendering for a single light to the
    maximal visible extents
  • Can also be applied to stencil shadow volumes

31
Shadow Map Optimization
  • Same optimization can be applied from lights
    perspective when rendering shadow maps
  • Transform vertices of region intersections into
    light space
  • Calculate scissor rectangle and depth bounds
  • Reduces unnecessary depth fill

32
Shadow Map Optimization
Max Depth
Min Depth
Image Plane
Light
33
Shadow-Casting Object Set
  • All objects in the illuminated set are also in
    the shadow-casting set
  • But an object doesnt have to be visible to be
    casting a shadow into one of the visible camera
    regions
  • The shadow-casting set is a superset of the
    illuminated set

34
Shadow-Casting Object Set
  • Need to find objects between visible regions and
    light source
  • We already have a structure in place to make this
    easy
  • From an illumination region, walk up the lights
    tree to the root

35
Shadow-Casting Object Set
A
B
C
C
E
B
Light
A
D
E
Camera
36
Shadow-Casting Object Set
  • Collect objects in branch of illumination tree
    containing visible regions
  • Can use lateral bounding planes of deepest
    visible regions

37
Shadow-Casting Object Set
Light
Culled Caster
Camera
38
Shadow-Casting Object Set
  • Where illumination regions and camera regions
    intersect...
  • Some objects inside illumination region, but not
    between camera region and light source

39
Shadow-Casting Object Set
Extra Caster
40
Shadow-Casting Object Set
  • Eliminating shadow-casting objects on wrong side
    ofcamera region
  • Test objects against planes of camera region
    having a positive dot product with light position
  • For infinite light, use planes having a positive
    dot product with direction to light

41
Shadow-Casting Object Set
42
Demonstrations
43
Questions?
  • lengyel_at_terathon.com
  • Slides available at
  • http//www.terathon.com/
Write a Comment
User Comments (0)
About PowerShow.com