ray tracing sang il park sejong university with lots of slides stolen from jehee lee, doug james,...
TRANSCRIPT
![Page 1: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/1.jpg)
Ray Tracing
Sang Il ParkSEjong University
With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand and others
![Page 2: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/2.jpg)
Local vs. Global Illumination Models
• Local illumination models– Object illuminations are independent– No light scattering between objects– No real shadows, reflection, transmission
• Global illumination models– Ray tracing (highlights, reflection, transmission)– Radiosity (Surface interreflections)– Photon mapping
![Page 3: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/3.jpg)
Forward Ray Tracing
• Rays as paths of photons in world space• Follow photon from light sources to viewer• Problem: Many rays will not contribute to image
![Page 4: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/4.jpg)
Backward Ray Tracing
• Trace rays backward from viewer to light sources• One ray from center of projection through each
pixel in image plane• Ray casting
– Simplest form of ray tracing– No recursion
![Page 5: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/5.jpg)
Backward Ray Tracing
• Illumination– Phong illumination– Shadow rays– Specular reflection– Specular refraction
• Specular reflection and refraction are recursive
![Page 6: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/6.jpg)
Shadow Rays
• Determine if light “really” hits surface point• Cast shadow ray from surface point to light• If shadow ray hits opaque object, no contribution
![Page 7: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/7.jpg)
Specular Refraction (Snell’s law)
ir
ir
sinsin
i r, : index of refraction of each material (averaged over wavelengths and
temperature)
![Page 8: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/8.jpg)
Specular Refraction (Snell’s law)
ir
ir
sinsin
i r, : index of refraction of each material (averaged over wavelengths and
temperature)
![Page 9: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/9.jpg)
Specular Refraction
• Path shifts are ignored for thin objects• From Snell’s law, we can obtain the unit
transmission vector T in the direction r
LNTr
iri
r
i
)coscos(
)cos1(1 22
cos ir
ir
![Page 10: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/10.jpg)
Interpolated transparency
k : transmission coefficient
(0 for opaque objects,
1 for totally transparent
objects)line of sight
1
2
21)1( kIIkI
![Page 11: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/11.jpg)
Binary Ray-Tracing Tree
![Page 12: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/12.jpg)
Ray-surface Intersections
• Specialized algorithm for most commonly occurring shapes– Sphere– Polygon– Quadric– Splines
• Many shapes are represented in either implicit or parametric form
![Page 13: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/13.jpg)
Ray-Implicit Surface Intersections
• Parametric ray equation– Initial position– Unit direction vector
• Implicit surface– Consists of all points such that– Substitute ray equation for
– Solve for s (univariate root finding)
uPP s 0
u0P
0)( PfP
P
0)( 0 uP sf
![Page 14: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/14.jpg)
Ray-Sphere Intersections
• Sphere equation
• Substitution
• Letting
• Solution
022 rcPP
0220 rs cPuP
0PPP c
0)()(2 222 rss PPu
![Page 15: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/15.jpg)
Ray-Polygon Intersections
• Bounding sphere and back face culling is useful• Ray-Plane Intersections
– Plane equation containing the polygon
– Substitution
– Solution
• Perform inside-outside test to determine whether the intersection is inside the polygon
0 DDCzByAx PN
0)( 0 DsuPN
uN
PN
0Ds
![Page 16: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/16.jpg)
Acceleration Techniques
• Space-subdivision– Uniform subdivision– Adaptive subdivision (Octrees)
![Page 17: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/17.jpg)
How do we see the world?
• In computer graphics, we assumed that rays are projected onto the image plane
![Page 18: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/18.jpg)
How do we see the world?
• In physics, that is not true• Rays are scattered in all directions
![Page 19: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/19.jpg)
Pinhole camera
• Add a barrier to block off most of the rays– This reduces blurring– The opening known as the aperture– How does this transform the image?
Slide by Steve Seitz
![Page 20: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/20.jpg)
Pinhole camera model
• Pinhole model:– Captures pencil of rays – all rays through a single point– The point is called Center of Projection (COP)– The image is formed on the Image Plane– Effective focal length f is distance from COP to Image Plane
Slide by Steve Seitz
![Page 21: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/21.jpg)
Camera Obscura
• The first camera– Known to Aristotle– Depth of the room is the effective focal length
Camera Obscura, Gemma Frisius, 1558
![Page 22: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/22.jpg)
Home-made pinhole camera
http://www.debevec.org/Pinhole/
Why soblurry?
![Page 23: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/23.jpg)
Shrinking the aperture
• Why not make the aperture as small as possible?– Less light gets through– Diffraction effects…
Slide by Steve Seitz
![Page 24: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/24.jpg)
Shrinking the aperture
![Page 25: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/25.jpg)
The reason for lenses
Slide by Steve Seitz
![Page 26: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/26.jpg)
The reason for lenses
Slide by Steve Seitz
![Page 27: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/27.jpg)
Small vs. Large Pinholes
![Page 28: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/28.jpg)
Pinhole vs. Lens
![Page 29: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/29.jpg)
Ideal Lens: Same projection as pinhole but gathers more light!
foi
111
i o
Lens Formula:
• f is the focal length of the lens – determines the lens’s ability to bend (refract) light
• f different from the effective focal length f discussed before!
P
P’
f
Image Formation using Lenses
Slide by Shree Nayar
![Page 30: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/30.jpg)
Aperture
![Page 31: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/31.jpg)
Shutter
![Page 32: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/32.jpg)
Focus and Defocus
• A lens focuses light onto the film– There is a specific distance at which objects are “in focus”
• other points project to a “circle of confusion” in the image• The diameter is
– How can we change focus distance?
“circle of confusion”
![Page 33: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/33.jpg)
Depth of Field
http://www.cambridgeincolour.com/tutorials/depth-of-field.htm
![Page 34: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/34.jpg)
Aperture controls Depth of Field
• Changing the aperture size affects depth of field– A smaller aperture increases the range in which the object is
approximately in focus– But small aperture reduces amount of light – need to
increase exposure
![Page 35: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/35.jpg)
Depth-of-Field Scale
• Typical prime lens design
![Page 36: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/36.jpg)
Varying the aperture
![Page 37: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/37.jpg)
Varying the aperture
![Page 38: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/38.jpg)
Nice Depth of Field effect
![Page 39: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/39.jpg)
Distributed Ray Tracing
• Stochastic sampling that randomly distribute rays according to the various parameters
• Monte Carlo evaluation of the multiple integrals that occur in an accurate physical description of surface lighting
![Page 40: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/40.jpg)
Distributed Ray Tracing
• Antialiasing– Oversampling rays in each pixel– Regular vs. jittered sampling
![Page 41: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/41.jpg)
Illumination (glossy, diffuse, translucency)
![Page 42: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/42.jpg)
Soft shadow (distributing shadow rays)
![Page 43: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/43.jpg)
Distributed Ray Tracing
• Depth of Field– Distributing rays over the circle of confusion
![Page 44: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/44.jpg)
• Motion blur– Distributing rays over time
![Page 45: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/45.jpg)
Caustics
• Caustics represents some of the most visually striking patterns of light in nature
• Caustics are formed by light that is reflected or transmitted by a number of specular surfaces before interacting with a diffuse surface
• Examples of caustics are the light patterns on the bottom of a swimming pool and light focused onto a table through a glass of cognac.
![Page 46: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/46.jpg)
![Page 47: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/47.jpg)
Caustics
![Page 48: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/48.jpg)
![Page 49: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/49.jpg)
Programming Assignment #4
• Simple ray tracer– You are required to implement a simple ray tracer– Make an OpenGL Scene with Sphere and Polygon and Render
It!
• Required features– Ray tracing spheres [20 points]– Ray tracing polygons [20 points]– Phong illumination [20 points]– Representative pictures [20 points]
– Recursive reflection [20 points] at least depth 3 GRAPHICS ONLY
– Report [10 points]
![Page 50: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/50.jpg)
Programming Assignment #4
• Hand in all “nice” images you generated
• Your report should explain– What features you implemented– Which image is demonstrating which features– Instructions to render submitted images
• Features that are not demonstrated in images will receive little or no credit
![Page 51: Ray Tracing Sang Il Park SEjong University With lots of slides stolen from Jehee Lee, Doug James, Steve Seitz, Shree Nayar, Alexei Efros, Fredo Durand](https://reader035.vdocuments.mx/reader035/viewer/2022070415/56649e995503460f94b9c95e/html5/thumbnails/51.jpg)
Programming Assignment #4
• Extra features (up to 30 points)– Recursive refraction– Distributed ray tracing
• Soft shadows, depth of field, and motion blur– Spatial partitioning
• Uniform cell subdivision, octrees
• Due: June 22