Advanced Light and Shadow Culling Methods Eric Lengyel.

Slides:



Advertisements
Similar presentations
Computer Graphics - Rasterization -
Advertisements

Visible-Surface Detection(identification)
Clipping Covers chapter 10 of Computer Graphics and Virtual Environments (Slater, Steed and Chrysanthou) . See ©Yiorgos Chrysanthou.
Technische Universität München Computer Graphics SS 2014 Graphics Effects Rüdiger Westermann Lehrstuhl für Computer Graphik und Visualisierung.
Christian Lauterbach COMP 770, 2/16/2009. Overview  Acceleration structures  Spatial hierarchies  Object hierarchies  Interactive Ray Tracing techniques.
Optimized Stencil Shadow Volumes
Intersection Testing Chapter 13 Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology.
CSE 681 Bounding Volumes. CSE 681 Bounding Volumes Use simple volume enclose object(s) tradeoff for rays where there is extra intersection test for object.
10/10/02 (c) 2002 University of Wisconsin, CS 559 Last Time Finished viewing: Now you know how to: –Define a region of space that you wish to view – the.
Building a Dynamic Lighting Engine for Velvet Assassin Christian Schüler.
CHAPTER 12 Height Maps, Hidden Surface Removal, Clipping and Level of Detail Algorithms © 2008 Cengage Learning EMEA.
CSE 381 – Advanced Game Programming Scene Management
Shadow Rendering Techniques A point is in the shadow of a light source if it can not be “seen” by the light source, i.e. the line segment that connects.
Ray Tracing & Radiosity Dr. Amy H. Zhang. Outline  Ray tracing  Radiosity.
Korea Univ. Graphics Lab. 3D Game Engine Design Chapter 12. Spatial Sorting Chung Ji Hye
Projection Matrix Tricks Eric Lengyel Outline  Projection Matrix Internals  Infinite Projection Matrix  Depth Modification  Oblique Near Clipping.
Introduction to 3D Graphics Lecture 5: From Realism to Real-Time Anthony Steed University College London.
Object-Space Visibility Culling Anthony Steed University College London Based upon material presented by Claudio T. Silva at Eurographics 1999 Slides,
Informationsteknologi Thursday, November 22, 2007Computer Graphics - Class 111 Today’s class Clipping Parametric and point-normal form of lines Intersecting.
Chapter 6: Vertices to Fragments Part 2 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Mohan Sridharan Based on Slides.
Vertices and Fragments I CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Course Website: Computer Graphics 9: Clipping In 3D.
Hidden Surface Elimination Wen-Chieh (Steve) Lin Institute of Multimedia Engineering I-Chen Lin’ CG Slides, Rich Riesenfeld’s CG Slides, Shirley, Fundamentals.
1 Dynamic Shadows and Lighting for Walkthrus of Large Models Brandon Lloyd COMP 258 December 2002.
Visibility culling – Clipping. The visibility problem What polygons are visible? There are few visible polygons. –Avoid redundant processing Three classes.
1 Advanced Scene Management System. 2 A tree-based or graph-based representation is good for 3D data management A tree-based or graph-based representation.
© 2004 Tomas Akenine-Möller1 Shadow Generation Hardware Vision day at DTU 2004 Tomas Akenine-Möller Lund University.
10/11/2001CS 638, Fall 2001 Today Kd-trees BSP Trees.
10/02/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Octrees.
Introduction to 3D Graphics John E. Laird. Basic Issues u Given a internal model of a 3D world, with textures and light sources how do you project it.
Hidden Surface Removal
1 Occlusion Culling ©Yiorgos Chrysanthou, , Anthony Steed, 2004.
Computer Graphics 2 Lecture x: Acceleration Techniques for Ray-Tracing Benjamin Mora 1 University of Wales Swansea Dr. Benjamin Mora.
10/29/02 (c) 2002 University of Wisconsin, CS559 Today Hidden Surface Removal Exact Visibility.
Spatial Data Structures Jason Goffeney, 4/26/2006 from Real Time Rendering.
10/09/2001CS 638, Fall 2001 Today Spatial Data Structures –Why care? –Octrees/Quadtrees –Kd-trees.
02/26/02 (c) 2002 University of Wisconsin, CS 559 Last Time Canonical view pipeline Orthographic projection –There was an error in the matrix for taking.
CS 325 Introduction to Computer Graphics 03 / 08 / 2010 Instructor: Michael Eckmann.
The Visibility Problem In many environments, most of the primitives (triangles) are not visible most of the time –Architectural walkthroughs, Urban environments.
Visible-Surface Detection Jehee Lee Seoul National University.
1 Advanced Scene Management. 2 This is a game-type-oriented issue Bounding Volume Hierarchies (BVHs) Binary space partition trees (BSP Trees) “Quake”
2 COEN Computer Graphics I Evening’s Goals n Discuss application bottleneck determination n Discuss various optimizations for making programs execute.
1Computer Graphics Implementation II Lecture 16 John Shearer Culture Lab – space 2
Implementation II Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Binary Space Partitioning Trees Ray Casting Depth Buffering
Implementation II.
1 Visiblity: Culling and Clipping Computer Graphics COMP 770 (236) Spring 2009 January 21 & 26: 2009.
David Luebke11/26/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
Basic Perspective Projection Watt Section 5.2, some typos Define a focal distance, d, and shift the origin to be at that distance (note d is negative)
Constructive Solid Geometry Ray Tracing CSG Models
Maths & Technologies for Games Spatial Partitioning 2
Computer Graphics I, Fall 2010 Implementation II.
1 Projection: Completing the Camera Model ©Yiorgos Chrysanthou 2001, Anthony Steed
Real-Time Dynamic Shadow Algorithms Evan Closson CSE 528.
1 CSCE 441: Computer Graphics Hidden Surface Removal Jinxiang Chai.
Game Engine Design Quake Engine Presneted by Holmes 2002/12/2.
Computer Graphics Inf4/MSc 1 Computer Graphics Lecture 5 Hidden Surface Removal and Rasterization Taku Komura.
RENDERING : Global Illumination
1 Advanced Scene Management. 2 This is a game-type-oriented issue Bounding Volume Hierarchies (BVHs) Binary space partition trees (BSP Trees) “Quake”
09/23/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Reflections Shadows Part 1 Stage 1 is in.
Computer Graphics Implementation II
Advanced D3D Programming Sim Dietrich
3D Rendering Pipeline Hidden Surface Removal 3D Primitives
Implementation II Ed Angel Professor Emeritus of Computer Science
CS679 - Fall Copyright Univ. of Wisconsin
Introduction to Computer Graphics with WebGL
Clipping University of British Columbia CPSC 314 Computer Graphics
Implementation II Ed Angel Professor Emeritus of Computer Science
Presentation transcript:

Advanced Light and Shadow Culling Methods Eric Lengyel

Fully Dynamic Environment Anything in the world can move Anything in the world can move — Can’t precompute any visibility information Lights completely dynamic 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 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 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 For each light, also determine what subset of the visible objects can be illuminated

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

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

Portal Systems World divided into ‘zones’ World divided into ‘zones’ — A zone is the region of space bounded by a convex polyhedron Zones are connected by ‘portals’ 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 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 For each reachable zone, there is a convex region of space visible to the camera

Portal Systems Camera

The visible regions form a tree structure The visible regions form a tree structure The region in the zone containing the camera is the root of the tree The region in the zone containing the camera is the root of the tree Zones seen through n portals have regions at the n-th level in the tree Zones seen through n portals have regions at the n-th level in the tree

Portal Systems Camera A B C D A BC D

Start with view frustum in zone containing the camera Start with view frustum in zone containing the camera Clip portals leading out of the zone against the view frustum 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 For any portals intersecting the view frustum, construct a new region by extruding clipped edges away from camera position

Portal Systems Every visibility region is bounded by a convex polyhedron defined by at least 4 planes 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 Plane normals point inward

Portal Systems After region tree has been built... 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 Portals can be used to construct illumination 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

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

Light Region Trees Point light Point light — Omnidirectional — Has maximum range — Root illumination region bounded only be zone boundary and light’s bounding sphere

Point Light Tree A B C D B AD C

Spot Light Tree Spot light almost same as point light 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 Light rays parallel for infinite light 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 Each zone keeps a linked list of illumination regions 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 AB CD Light 1 Light 2 Light 3 For example, consider zone C

Visible Light Determination B AD C A BC D D CB A Light 1 Light 2 Light 3

Visible Light Determination For any given zone, we can walk the linked list of illumination regions and collect unique lights 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 camera’s visibility tree Repeat process for all zones referenced in the camera’s visibility tree We now have the set of visible lights We now have the set of visible lights

Illuminated Object Set Given one visible zone and one visible light shining into that zone… 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

Objects are often only partially within an illumination region 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 Use hardware scissor rectangle Use hardware scissor rectangle — Calculate intersections of camera regions and illumination regions — Camera-space bounding box determines scissor rectangle GL_EXT_depth_bounds_test GL_EXT_depth_bounds_test — Works like a z axis for scissor box

Lighting Optimization Camera Image Plane Max Depth Min Depth

Lighting Optimization Scissor rectangle and depth bounds test 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 Same optimization can be applied from light’s perspective when rendering shadow maps 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 Light Image Plane Max Depth Min Depth

Shadow-Casting Object Set All objects in the illuminated set are also in the shadow-casting set 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 Need to find objects between visible regions and light source We already have a structure in place to make this easy We already have a structure in place to make this easy From an illumination region, walk up the light’s tree to the root From an illumination region, walk up the light’s tree to the root

Shadow-Casting Object Set Camera Light ABC DE C EB A

Collect objects in branch of illumination tree containing visible regions Collect objects in branch of illumination tree containing visible regions — Can use lateral bounding planes of deepest visible regions

Shadow-Casting Object Set Camera Light CulledCaster

Where illumination regions and camera regions intersect... Where illumination regions and camera regions intersect... — Some objects inside illumination region, but not between camera region and light source

Shadow-Casting Object Set ExtraCaster

Eliminating shadow-casting objects on wrong side of camera region 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? Slides available at Slides available athttp://