csce 441: computer graphics ray tracing
DESCRIPTION
Ray Tracing Is a global illumination technique Provides rendering method with Refraction/Transparent surfaces Reflective surfaces Shadows Image taken from http://www.tjhsst.edu/~dhyatt/superap/samplex.jpgTRANSCRIPT
![Page 1: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/1.jpg)
CSCE 441: Computer Graphics Ray Tracing
Jinxiang Chai
![Page 2: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/2.jpg)
Ray Tracing
Is a global illumination technique
Provides rendering method with Refraction/Transparent surfaces Reflective surfaces Shadows
Image taken from http://www.tjhsst.edu/~dhyatt/superap/samplex.jpg
![Page 3: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/3.jpg)
Ray Tracing
Is a global illumination technique
Provides rendering method with Refraction/Transparent surfaces Reflective surfaces Shadows
Image taken from http://www.tjhsst.edu/~dhyatt/superap/samplex.jpg
Any difference for rendering three pixels?
![Page 4: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/4.jpg)
Local Illumination vs. Ray Tracing
- Reflective surface- Realistic shadows
![Page 6: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/6.jpg)
Overview
Ray Tracing Algorithm Shadows, Reflection, Refraction
Surface Intersection Infinite planes, spheres, polygons
OptimizationsReadings: HB 21-1
![Page 7: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/7.jpg)
Essential Information for Ray Tracing
Eye pointScreen position/orientationObjects
Material properties Reflection/Refraction coefficients Index of refraction
Light sources
![Page 8: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/8.jpg)
Direct and Indirect Light
![Page 9: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/9.jpg)
Ray Tracing Assumption
The illumination of a point is determined by - illumination/shadow ray (direct lighting
from light sources)
![Page 10: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/10.jpg)
Ray Tracing Assumption
The illumination of a point is determined by - illumination/shadow ray (direct lighting
from light sources)
![Page 11: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/11.jpg)
Ray Tracing Assumption
The illumination of a point is determined by - illumination/shadow ray (direct lighting
from light sources) - reflection ray (light reflected by an object)
![Page 12: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/12.jpg)
Ray Tracing Assumption
The illumination of a point is determined by - illumination/shadow ray (direct lighting
from light sources) - reflection ray (where the angle of reflection equals the angle
of incidence) - transparent ray (light passing through an
object)
![Page 13: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/13.jpg)
Ray Tracing Assumption
The illumination of a point is determined by - illumination/shadow ray (direct lighting
from light sources) - reflection ray (where the angle of reflection equals the angle
of incidence) - transparent ray (light passing through an
object)
![Page 14: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/14.jpg)
Ray Tracing Assumption
The illumination of a point is determined by - illumination/shadow ray (direct lighting
from light sources) - reflection ray (where the angle of reflection equals the angle
of incidence) - transparent ray (light passing through an
object)
![Page 15: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/15.jpg)
Illumination / Shadow Rays
A ray is cast from an object’s surface towards a light.
If the light is not occluded, then the light contributes to the object’s surface color.
If the light is occluded, then the light does not contribute to the object’s surface color.
If ray hits a semi-transparent object, scale the contribution of that light and continue to look for intersections
Occluder
Pixels
![Page 16: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/16.jpg)
Reflected Rays
A ray is cast from the surface of an object based on its material properties.
The contribution results in the specular reflection.
![Page 17: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/17.jpg)
Transparency/transmission/refracted Rays
Some objects are transparent or translucent.The transmitted light also contributes to the
surface color, called specular transmission.The ray can be refracted based on the
object’s composition.
![Page 18: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/18.jpg)
Recursive Ray Tracing
1
2
3
4
L1
L2
![Page 19: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/19.jpg)
Recursive Ray Tracing
1
2
3
4
L1
L2
![Page 20: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/20.jpg)
Recursive Ray Tracing
1
2
3
4
L1
L2
![Page 21: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/21.jpg)
Recursive Ray Tracing
refractedareflectededirect IIII 1
2
3
4
L1
L2
![Page 22: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/22.jpg)
Recursive Ray Tracing
refractedareflectededirect IIII 1
2
3
4
L1
L2
![Page 23: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/23.jpg)
Recursive Ray Tracing
refractedareflectededirect IIII 1
2
3
4
L1
L2
speculardiffuseambientdirect IIII
![Page 24: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/24.jpg)
Recursive Ray Tracing
refractedareflectededirect IIII 1
2
3
4
L1
L2
![Page 25: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/25.jpg)
Recursive Ray Tracing
1
2
3
4
L1
L2
![Page 26: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/26.jpg)
Recursive Ray Tracing
1
2
3
4
L1
L2
![Page 27: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/27.jpg)
Recursive Ray Tracing
1
2
3
4
L1
L2
What are real light paths?
![Page 28: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/28.jpg)
Recursive Ray Tracing and Light path
1
2
3
4
L1
L2
Ray tracing paths just reverses real light paths!
![Page 29: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/29.jpg)
Recursive Ray Tracing and Light path
1
2
3
4
L1
L2
Ray tracing paths just reverses real light paths!
![Page 30: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/30.jpg)
Recursive Ray Tracing and Light path
1
2
3
4
L1
L2
Ray tracing paths just reverses real light paths!
![Page 31: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/31.jpg)
Recursive Ray Tracing and Light path
1
2
3
4
L1
L2
Ray tracing paths just reverses real light paths!
![Page 32: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/32.jpg)
Recursive Ray Tracing and Light path
1
2
3
4
L1
L2
Ray tracing paths just reverses real light paths!
![Page 33: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/33.jpg)
Recursive Ray Tracing and Light path
1
2
3
4
L1
L2
Ray tracing paths just reverses real light paths!
![Page 34: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/34.jpg)
Ray Tree
Object 1 L2
Shadow of Obj 4
Object 3
Reflection
ReflectionL2
L1Object 2
Transmission
ReflectionL2
L1
Eye
![Page 35: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/35.jpg)
Recursive Ray Tracing
For each pixel Intersect ray from eye through pixel with
all objects in scene Find closest (positive) intersection to eye Compute lighting at intersection point Recur for reflected and refracted rays (if
necessary)
![Page 36: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/36.jpg)
Recursive Ray Tracing
refractedareflectededirect IIII
speculardiffuseambientdirect IIII
directI
reflectedI refractedI
refractedIrefractedIreflectedI reflectedI
e
e e
a
aa
![Page 37: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/37.jpg)
Termination Criterion
1. The ray intersects no surfaces
2. The ray intersects a light source that is not a reflecting surface
3. The tree has been generated to its maximum allowable depth.
![Page 38: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/38.jpg)
Three Issues
Ray-object intersection - hidden surface removalReflection direction - mirror directionRefraction direction - Snell’s law
![Page 39: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/39.jpg)
Ray-object Intersection
eye
screen
Similar to ray casting!
![Page 40: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/40.jpg)
Ray-object Intersection
eye
screen
Similar to ray casting!
But how to determine the intersection point between a ray and an object such as sphere or triangle?
![Page 41: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/41.jpg)
Ray Casting
Implementation - Parameterize each ray as - Each object Ok returns tk>0 such that first intersection with ok occurs at r(tk) - Q: given the set {tk}, what is the first intersection point?
)()( cptctr ij
![Page 42: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/42.jpg)
Ray-Sphere Intersection
![Page 43: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/43.jpg)
Ray-Triangle Intersection
• First, intersecting the ray with plane
• Then, check if point is in triangle
![Page 44: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/44.jpg)
Ray-Plane Intersection
![Page 45: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/45.jpg)
Ray-Triangle Intersection
Check if point is inside triangle algebraically
For each side of triangle evaluate if the intersection point P is above or below the
plane(P-P0)∙N1=0P on the
equation:P above the plane:
(P-P0)∙N1>0
P below the plane:
(P-P0)∙N1<0
![Page 46: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/46.jpg)
Ray-Triangle Intersection
Check if point is inside triangle algebraically
For each side of triangle
00
// P is outside triangle
![Page 47: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/47.jpg)
Reflection
Mirror-like/Shiny objects
V
N
Surface
R
VNNVR )(2
![Page 48: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/48.jpg)
Refraction
Bending of light caused by different speeds of light in different medium
Each (semi-)transparent object has an index of refraction ni
Use Snell’s law to find refracted vector
Image taken from http://hyperphysics.phy-astr.gsu.edu/hbase/geoopt/refr2.html
![Page 49: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/49.jpg)
Snell’s Law
V N1
Surface
2
N R
1
2
2
1
2
1
)sin()sin(
nn
cc
![Page 50: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/50.jpg)
How to compute Transmission Ray?
V N1
Surface
2
N R
n1
n2
Given V and N, as well as n1 and n2, how to compute R?
![Page 51: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/51.jpg)
Snell’s Law
V N1
Surface
2
N R
)sin()sin(
2
1
2
1
ccV
||V
![Page 52: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/52.jpg)
Snell’s Law
N1
Surface
2
N R
)sin()sin(
2
1
2
1
cc
||)sin())(cos( 22 VVNR
V V
||V
![Page 53: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/53.jpg)
Snell’s Law
N1
Surface
2
N R
)sin()sin(
2
1
2
1
cc
||)sin())(cos( 22 VVNR
V V
||V
![Page 54: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/54.jpg)
Snell’s Law
N1
Surface
2
N R
)sin()sin(
2
1
2
1
cc
||)sin())(cos( 22 VVNR
V V
||V
![Page 55: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/55.jpg)
Snell’s Law
V N1
Surface
2
N R
)sin()sin(
2
1
2
1
cc
||)()sin())(cos( 22 V
VNNVNR
![Page 56: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/56.jpg)
Snell’s Law
V N1
Surface
2
N R
)sin()sin(
2
1
2
1
cc
)sin()()sin())(cos(
122
VNNVNR
![Page 57: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/57.jpg)
Snell’s Law
V N1
Surface
2
N R
)sin()sin(
2
1
2
1
cc
))(())(cos(1
22 VNNV
ccNR
![Page 58: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/58.jpg)
Snell’s Law
V N1
Surface
2
N R
)sin()sin(
2
1
2
1
cc
))(()()sin(11
222 VNNV
ccNR
![Page 59: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/59.jpg)
Snell’s Law
V N1
Surface
2
N R
)sin()sin(
2
1
2
1
cc
))(()()sin(11
22
1
222
1 VNNVccN
ccR
![Page 60: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/60.jpg)
Snell’s Law
V N1
Surface
2
N R
)sin()sin(
2
1
2
1
cc
))(()(1)sin(1
2
1
21
22
21 VNNV
ccN
cccR
![Page 61: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/61.jpg)
Snell’s Law
V N1
Surface
2
N R
)sin()sin(
2
1
2
1
cc
))(()(1))(1(1
2
1
222
21 VNNV
ccN
cNVccR
![Page 62: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/62.jpg)
Recursive Ray Tracing
Recur for reflective/transparent objects
![Page 63: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/63.jpg)
Recursive Ray Tracing
Recur for reflective/transparent objects
![Page 64: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/64.jpg)
Optimizations
Lots of rays to cast! Ray-Surface intersections are expensive
Associate with each object Bounding box in 3-space
If ray doesn’t intersect box, then ray doesn’t intersect object
![Page 65: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/65.jpg)
Parallel Processing
Ray tracing is a trivially parallel algorithm! Cast rays in parallel Cast reflection, refraction, shadow rays in
parallel Calculate ray/surface intersections
independently in parallel
![Page 66: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/66.jpg)
Ray Tracing Results: Special Effects
Copyright Newline Cinema
![Page 67: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/67.jpg)
Ray Tracing Results: Video Games
![Page 68: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/68.jpg)
Ray Tracing Results: Massive Models
![Page 69: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/69.jpg)
Pros and Cons of Ray Tracing
Advantages of ray tracing All the advantages of the local illumination
model Also handles shadows, reflection, and
refractionDisadvantages of ray tracing
Computational expense No diffuse inter-reflection between
surfaces (i.e., color bleeding) Not physically accurate
Other techniques exist to handle these shortcomings, at even greater expense!
![Page 70: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/70.jpg)
Ray Tracing References
Peter Shirley, “Realistic Ray Tracing”, ISBN 1-56881-110-1
Andrew Glassner, “An Introduction to Ray Tracing”, ISBN 0-12-286160-4
Steve Pettifer (http://www.cs.man.ac.uk/people/srp)
Anselmo Lastra (http://www.cs.unc.edu/~lastra)Paul Rademacher (http://
www.cs.unc.edu/~rademach)Mark Harris (http://www.cs.unc.edu/~harrism)Kenny Hoff (http://www.cs.unc.edu/~hoff)POV-Ray (http://www.povray.org)
![Page 71: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/71.jpg)
Environment Mapping
An alternative way for modeling global reflections
How to create this effect?
![Page 72: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/72.jpg)
Environment Mapping
An efficient technique for approximating the appearance of a reflective surface by means of a precomputed texture image.
![Page 73: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/73.jpg)
Environment Mapping
Cheap attempt at modeling reflectionsMakes surfaces look metallic
The poor person’s ray tracing method (only consider reflection ray)
Use six textures to model faces of a cubeAssume cube faces infinitely far awayThe normal (or reflected eye vector) is used to
find which of the textures to use and what texture coordinate
![Page 74: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/74.jpg)
Environment Mapping
![Page 75: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/75.jpg)
Environment Mapping
![Page 76: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/76.jpg)
Environment Mapping
![Page 77: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/77.jpg)
Environment Mapping
![Page 78: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/78.jpg)
reflective surface
viewer
environment texture image
v
n
r
Environment Mapping
Reflected ray: r=2(n·v)n-v
Texture is transferred in the direction of the reflected ray r from the environment map onto the objectWhat is in the map?
Incident ray reflected ray
![Page 79: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/79.jpg)
How to represent the map
viewer
![Page 80: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/80.jpg)
How to represent the map
viewer
![Page 81: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/81.jpg)
How to represent the map
viewer
![Page 82: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/82.jpg)
How to represent the map
viewer
Store colors of every possible direction in texture maps
![Page 83: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/83.jpg)
How to represent the map
viewer
Store colors of every possible direction in texture maps
vc
cccc
![Page 84: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/84.jpg)
How to represent the map
viewer
Store colors of every possible direction in texture maps
Look up texture maps based on reflected vector
vc
cccc
![Page 85: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/85.jpg)
Cubic Mapping
The map resides on the surfaces of a cube around the object Typically, align the faces of the cube with the coordinate axes
To generate the map: For each face of the cube, render the world from the center
of the object with the cube face as the image plane Rendering can be arbitrarily complex (it’s off-line)
To use the map: Index the R ray into the correct cube face Compute texture coordinates
![Page 86: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/86.jpg)
Cubic Map Example
![Page 87: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/87.jpg)
How to represent the map
viewer
Store colors of every possible direction in texture maps
![Page 88: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/88.jpg)
Sphere Mapping
Map lives on a sphereTo generate the map:
Render a spherical panorama from the designed center point
To use the map: Use the orientation of the R ray to index
directly into the sphere
![Page 89: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/89.jpg)
Example
![Page 90: CSCE 441: Computer Graphics Ray Tracing](https://reader036.vdocument.in/reader036/viewer/2022062317/5a4d1ae77f8b9ab05997958e/html5/thumbnails/90.jpg)
Environmental Mapping: Limitations
Assume distant environment
Only work for convex objects (i.e., no self-interreflections)