Advanced Light and Shadow Culling Methods Eric Lengyel
- Slides: 43
Advanced Light and Shadow Culling Methods Eric Lengyel
Fully Dynamic Environment n Anything in the world can move — Can’t precompute any visibility information n Lights completely dynamic — Can’t precompute any lighting information — Shadows also completely dynamic
Problems to Be Solved at Run-time Determine the set of objects visible to the camera n Determine the set of lights that can influence the region of space visible to the camera n For each light, also determine what subset of the visible objects can be illuminated n
Problems to Be Solved at Run-time n Determine the set of objects that could possibly cast shadows into the region of space visible to the camera —A superset of the illuminated objects that are visible to the camera
Visibility Determination n Organize the world in some way — Tree structures (BSP, octree, etc. ) — Hierarchical bounding volumes — Portal system n A combination of these can work extremely well
Portal Systems n World divided into ‘zones’ —A zone is the region of space bounded by a convex polyhedron n Zones are connected by ‘portals’ —A portal is a planar convex polygon — From the front side, a portal’s vertices are wound CCW
Portal Systems During visibility determination, only have to worry about zones that can be seen through a sequence of portals n For each reachable zone, there is a convex region of space visible to the camera n
Portal Systems Camera
Portal Systems The visible regions form a tree structure n The region in the zone containing the camera is the root of the tree n Zones seen through n portals have regions at the n-th level in the tree n
Portal Systems A D C B C D A Camera B
Portal Systems Start with view frustum in zone containing the camera n Clip portals leading out of the zone against the view frustum n For any portals intersecting the view frustum, construct a new region by extruding clipped edges away from camera position n
Portal Systems n 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 n Plane normals point inward
Portal Systems n 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 region’s planes — This is the visible object set
Light Region Trees n 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
Light Region Trees n Three fundamental light types — Point light — Spot light, special case of point light — Infinite (directional) light
Light Region Trees n Point light — Omnidirectional — Has maximum range — Root illumination region bounded only be zone boundary and light’s bounding sphere
Point Light Tree B B A A D C
Spot Light Tree n Spot light almost same as point 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
Infinite Light Tree n Light rays parallel for infinite 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
Visible Light Determination n 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
Visible Light Determination A B For example, consider zone C Light 1 Light 2 C D Light 3
Visible Light Determination B D Light 1 Light 2 Light 3 A B D C A D C C B A
Visible Light Determination For any given zone, we can walk the linked list of illumination regions and collect unique lights n Repeat process for all zones referenced in the camera’s visibility tree n We now have the set of visible lights n
Illuminated Object Set n 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
Illuminated Object Set Light Camera
Illuminated Object Set n 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
Lighting Optimization n Use hardware scissor rectangle — Calculate intersections of camera regions and illumination regions — Camera-space bounding box determines scissor rectangle n GL_EXT_depth_bounds_test — Works like a z axis for scissor box
Lighting Optimization Max Depth Min Depth Image Plane Camera
Lighting Optimization n 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
Shadow Map Optimization n Same optimization can be applied from light’s perspective when rendering shadow maps — Transform vertices of region intersections into light space — Calculate scissor rectangle and depth bounds — Reduces unnecessary depth fill
Shadow Map Optimization Max Depth Min Depth Image Plane Light
Shadow-Casting Object Set n All objects in the illuminated set are also in the shadow-casting set — But an object doesn’t 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
Shadow-Casting Object Set Need to find objects between visible regions and light source n We already have a structure in place to make this easy n From an illumination region, walk up the light’s tree to the root n
Shadow-Casting Object Set A B C C Light D E Camera E B A
Shadow-Casting Object Set n Collect objects in branch of illumination tree containing visible regions — Can use lateral bounding planes of deepest visible regions
Shadow-Casting Object Set Light Camera Culled Caster
Shadow-Casting Object Set n Where illumination regions and camera regions intersect. . . — Some objects inside illumination region, but not between camera region and light source
Shadow-Casting Object Set Extra Caster
Shadow-Casting Object Set n Eliminating shadow-casting objects on wrong side of camera 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
Shadow-Casting Object Set
Demonstrations
Questions? n lengyel@terathon. com n Slides available at http: //www. terathon. com/
- Lengyel középhegység
- Csőkötszer
- Szalók csilla
- Hatrai
- Pnarc
- Udp header
- Clipping and culling
- Bgp session culling
- Occulusion culling
- Three js backface culling
- Portal culling
- Culling techniques
- Light light light chapter 23
- Into the light chapter 22
- Light light light chapter 22
- Translucent objects
- Affect specular vray
- Advanced and multivariate statistical methods
- Advanced construction techniques
- Advanced business research
- Advanced higher modern studies
- Wax pattern fabrication pdf
- Put out the light and then
- Membrane-bound organelles
- Or the bending of light and the bouncing off of light
- Which materials let light through
- Purelb
- Rain shadow effect leeward and windward
- Chapter 33 franklin d roosevelt and the shadow of war
- Once upon a time there was a girl who
- Genta shadow and bone
- Shadow and bonr
- Shadow ot
- Shining dew on every buttercup meaning
- Plasma display in computer graphics
- Etc/shadow linux
- Job shadow thank you letter
- Shadow
- Engelbert humperdinck the shadow of your smile
- Google file system paper
- Father son conflict archetype examples
- Triangle syllable type
- Stable shadow
- Shadow price