Advanced topics Advanced Multimedia Technology: Computer Graphics Yung-Yu Chuang 2006/01/04 with slides by Brian Curless, Zoran Popovic, Mario Costa Sousa and Robin Chen
Outline Mapping techniques –Texture mapping –Displacement mapping –Bump mapping Shadows Ray tracing
Texture maps How is texture mapped to the surface? –Dimensionality: 1D, 2D, 3D –Texture coordinates (s,t) Surface parameters (u,v) Projection: spherical, cylindrical, planar Reparameterization What does texture control? –Surface color and transparency –Illumination: environment maps, shadow maps –Reflection function: reflectance maps –Geometry: displacement and bump maps
Texture
History 1974 basic idea (Catmull/Williams) 1976 reflection maps (Blinn/Newell) 1978 bump mapping (Blinn) 1983 mipmap (Williams) 1984 illumination (Miller/Hoffman) 1985 solid texture (Perlin)
Texture maps
Reflection maps
Environment maps
Bump/displacement maps
Illumination maps
Solid textures
Texture mapping
(u,v) sphericalcylindricalplanar
Spherical mapping
Cylindrical mapping
Planar mapping
Spherical mapping
Cylindrical mapping
Planar mapping
Aliasing
Antialiasing
Mip maps A mipmap takes at most 1/3 more memory
Sum area table
Antialiasing
Displacement mapping
Bump mapping
Bump v.s. displacement mapping
Shadow buffer
Forward ray tracing
Precursors to ray tracing local illumination cast one ray, then shade according to light ray casting (Appel 1968) cast one eye ray + one ray to light
Whitted ray tracing algorithm
Ray tree
Shading
Outer loop
traceRay
Reflection
Refraction
Ray-sphere intersection
Ray-plane intersection
Ray-triangle intersection
Acceleration techniques Object subdivision: hierarchical bounding volume Space subdivision: –Uniform: uniform grid –Adaptive: kd-tree, octree…
Bounding volume hierarchy
1)Find bounding box of objects Bounding volume hierarchy
1)Find bounding box of objects 2)Split objects into two groups Bounding volume hierarchy
1)Find bounding box of objects 2)Split objects into two groups 3)Recurse Bounding volume hierarchy
1)Find bounding box of objects 2)Split objects into two groups 3)Recurse Bounding volume hierarchy
1)Find bounding box of objects 2)Split objects into two groups 3)Recurse Bounding volume hierarchy
1)Find bounding box of objects 2)Split objects into two groups 3)Recurse Bounding volume hierarchy
At midpoint Sort, and put half of the objects on each side Use modeling hierarchy Where to split?
BVH traversal If hit parent, then check all children (from the closer to the further?)
BVH traversal Don't return intersection immediately because the other subvolumes may have a closer intersection
Bounding volume hierarchy
Space subdivision approaches KD tree Unifrom grid
Space subdivision approaches BSP tree Quadtree (2D) Octree (3D)
Uniform grid
Preprocess scene 1.Find bounding box
Uniform grid Preprocess scene 1.Find bounding box 2.Determine grid resolution
Uniform grid Preprocess scene 1.Find bounding box 2.Determine grid resolution 3.Place object in cell if its bounding box overlaps the cell
Uniform grid Preprocess scene 1.Find bounding box 2.Determine grid resolution 3.Place object in cell if its bounding box overlaps the cell 4.Check that object overlaps cell (expensive!)
Uniform grid traversal Preprocess scene Traverse grid 3D line = 3D-DDA
A A Leaf nodes correspond to unique regions in space K-d tree
A A Leaf nodes correspond to unique regions in space B K-d tree
A B A B Leaf nodes correspond to unique regions in space K-d tree
A B A B C
A B C A B C
A B C A B C D
A B C D A B C D
A B C D A B C D Leaf nodes correspond to unique regions in space K-d tree
A B C D A B C D Leaf nodes correspond to unique regions in space K-d tree traversal
Antialiasing with supersampling
Result
Advanced ray tracing