Photon Mapping Photon Mapping Combines “backward”/ “reverse” ray tracing with stochastic ray tracing Used to simulate the interaction of light with a variety transparent substances (caustics) Glass Water Diffuse Inter-reflections between illuminated objects Effects of particulate matter Smoke Water vapor 1
Photon Mapping - Motivation Without With Photon Mapping Henrik Wann Jensen 95/96 Simulates the transport of individual photons emitted from light sources Photons bounce off specular surfaces Photons deposited on diffuse surfaces Photons collected by ray tracing from eye http://www.ypoart.com/ 2
Spatial Subdivision The collected photons will need to be stored in an efficient, 3D accessible data structure Spatial subdivision algorithms subdivide the 3D space for quick and easy query. Spatial Subdivision Subdivide your scene volume into hierarchical regions Octrees BSP Trees K-D Trees Create a tree structure that indicates for each region: if the region is empty the object present at that particular region Used in Ray Tracing Collision detection (animation) Photon Mapping 3
Spatial Subdivision Subdivision algorithm Recursively subdivide volume If subregion is empty or contains a predefined # of objects, then stop Otherwise, further subdivide. Continue until each subregion is empty or contains a predefined #of objects. Use tree to represent subdivision hierarchy Octrees Volume is subdivided into 4 equal regions. Each iteration results in 8 subdivisions. 4
Octrees [Foley/Van Dam] Oct(quad)trees Subdivisions represented as a tree [Watt/Watt,244] 5
Oct(quad)trees Quadtree applet http://donar.umiacs.umd.edu/quadtree/ points/prquad.html Octrees Images from http://www.flipcode.com/tutorials/tut_octrees.shtml 6
Octrees Octrees 7
BSP Trees Binary Space Partitioning Trees (BSP Trees) Like Octrees but divides space into a pair of subregions Subregions need not be equally spaced Planes separating regions can be placed at object boundaries. Spatial Subdivision Octrees vs BSP Trees [Watt/Watt,246] 8
BSP Trees BSP Trees – Each non-terminal node represents a single partitioning plane that divides space in two [Watt/Watt,247 ] K-d Trees K-d Tree is a BSP where dividing planes are axis aligned K-d Tree applet http://donar.umiacs.umd.edu/quadtree/ points/kdtree.html 9
Spatial Subdivision Advantages Efficient means for finding objects within your space Compact representation Disadvantages Preprocessing required If scene changes, must rebuild your tree Not foolproof Spatial Subdivision Octrees vs BSP trees BSP Trees are generally more balanced than Octrees BSP Traversal more efficient BSP Trees have additional storage overhead as must store subdivision planes Now back to photon mapping 10
Photon Mapping Pass 1 – Shoot and Store Photons photons are shot from the light into the scene. Photons are allowed to interact with objects in the environment Where photons fall are stored in a special data structure called a “photon map” 1000s of photons not billions Statistical approximation based on density Photon Mapping Shooting photons point directional square general [Jensen 2002] 11
Photon Mapping Photon Scattering [Jensen 2002] Photon Map The photon Placed in k-d tree for efficient access 12
Photon Mapping Pass 2 – Gather illumination Use ray tracing Direct illumination determined by ray tracing Indirect illumination determined by stochastically sampling photon map Gather photon within a volume in the required direction. Monte Carlo methods Driven by chance / randomness Rendering and Monte Carlo Multiple rays per pixel See how many reach a light Multiple rays from light See how many reach the eye Photon Mapping Goes from both sides 13
Photon Mapping - Caustics Pattern of light focused on a surface after having original light path bent by intermediate surface. [Jensen] Caustics Reflective caustics Refractive caustics Yves Poissant 14
Photon Mapping Three separate photon maps Global – photon emitted toward all objects Caustics – specular to diffuse interactions Volume – for volumetric effects Photon Mapping caustic global 15
Example [Jensen 1996] Example -- Caustics [Jensen 1996] 16
The Light of Mies van der Rohe 2000ET Photon Mapping in real time But doesn’t this take a long time. No, grasshopper…not with GPUs… Let’s go to the video. 17
Want to learn more? Summary Fixing ray tracing Spawning complex structures (cones, cylinders, etc.) Stochastic sampling (distributed ray tracing, monte carlo) “backwards” ray tracing (Photon Mapping) Questions 18
Recommend
More recommend