eecs 487 march 19, 2007 · disadvantages • missing effects – shadows – reflection –...
TRANSCRIPT
![Page 1: EECS 487 March 19, 2007 · Disadvantages • Missing effects – shadows – reflection – refraction through transparent surfaces – color bleeding – depth of field – motion](https://reader035.vdocuments.us/reader035/viewer/2022062608/60892d4e4540b87a6a77ef76/html5/thumbnails/1.jpg)
1
Ray tracingEECS 487
March 19, 2007
http://radsite.lbl.gov/radiance/book/
![Page 2: EECS 487 March 19, 2007 · Disadvantages • Missing effects – shadows – reflection – refraction through transparent surfaces – color bleeding – depth of field – motion](https://reader035.vdocuments.us/reader035/viewer/2022062608/60892d4e4540b87a6a77ef76/html5/thumbnails/2.jpg)
2
Conventional pipeline (rasterization)
• For each triangle– Compute lighting at vertices– For each pixel within triangle
• Compute interpolated color and depth• Write pixel if depth test passes
• Q: the above description is somewhat “old style”– how have things changed lately?
![Page 3: EECS 487 March 19, 2007 · Disadvantages • Missing effects – shadows – reflection – refraction through transparent surfaces – color bleeding – depth of field – motion](https://reader035.vdocuments.us/reader035/viewer/2022062608/60892d4e4540b87a6a77ef76/html5/thumbnails/3.jpg)
3
Conventional pipeline (rasterization)
• For each triangle– Compute lighting at vertices– For each pixel within triangle
• Compute interpolated color and depth• Write pixel if depth test passes
• Q: the above description is somewhat “old style”– how have things changed lately?
• A: can now do perpixel lighting
![Page 4: EECS 487 March 19, 2007 · Disadvantages • Missing effects – shadows – reflection – refraction through transparent surfaces – color bleeding – depth of field – motion](https://reader035.vdocuments.us/reader035/viewer/2022062608/60892d4e4540b87a6a77ef76/html5/thumbnails/4.jpg)
4
Advantages of conventional pipeline
• Simple• Can be implemented in hardware
– Parallel processing (SIMD)– Vertices– Pixels
• Visibility determination is fast– zbuffer
![Page 5: EECS 487 March 19, 2007 · Disadvantages • Missing effects – shadows – reflection – refraction through transparent surfaces – color bleeding – depth of field – motion](https://reader035.vdocuments.us/reader035/viewer/2022062608/60892d4e4540b87a6a77ef76/html5/thumbnails/5.jpg)
5
Disadvantages
• Missing effects– namely?
![Page 6: EECS 487 March 19, 2007 · Disadvantages • Missing effects – shadows – reflection – refraction through transparent surfaces – color bleeding – depth of field – motion](https://reader035.vdocuments.us/reader035/viewer/2022062608/60892d4e4540b87a6a77ef76/html5/thumbnails/6.jpg)
6
Disadvantages
• Missing effects– shadows– reflection– refraction through transparent surfaces– color bleeding– depth of field– motion blur– caustics
• Undesirable effect: Aliasing
![Page 7: EECS 487 March 19, 2007 · Disadvantages • Missing effects – shadows – reflection – refraction through transparent surfaces – color bleeding – depth of field – motion](https://reader035.vdocuments.us/reader035/viewer/2022062608/60892d4e4540b87a6a77ef76/html5/thumbnails/7.jpg)
7
Refraction, hard shadows, reflection
![Page 8: EECS 487 March 19, 2007 · Disadvantages • Missing effects – shadows – reflection – refraction through transparent surfaces – color bleeding – depth of field – motion](https://reader035.vdocuments.us/reader035/viewer/2022062608/60892d4e4540b87a6a77ef76/html5/thumbnails/8.jpg)
8
Soft shadows
http://wwwcsl.csres.utexas.edu/users/billmark/teach/cs384g05fall/projects/ray/ray_examples/
![Page 9: EECS 487 March 19, 2007 · Disadvantages • Missing effects – shadows – reflection – refraction through transparent surfaces – color bleeding – depth of field – motion](https://reader035.vdocuments.us/reader035/viewer/2022062608/60892d4e4540b87a6a77ef76/html5/thumbnails/9.jpg)
9
Color bleeding
![Page 10: EECS 487 March 19, 2007 · Disadvantages • Missing effects – shadows – reflection – refraction through transparent surfaces – color bleeding – depth of field – motion](https://reader035.vdocuments.us/reader035/viewer/2022062608/60892d4e4540b87a6a77ef76/html5/thumbnails/10.jpg)
10
Depth of field
From today's New York Times
![Page 11: EECS 487 March 19, 2007 · Disadvantages • Missing effects – shadows – reflection – refraction through transparent surfaces – color bleeding – depth of field – motion](https://reader035.vdocuments.us/reader035/viewer/2022062608/60892d4e4540b87a6a77ef76/html5/thumbnails/11.jpg)
11
Motion blur
![Page 12: EECS 487 March 19, 2007 · Disadvantages • Missing effects – shadows – reflection – refraction through transparent surfaces – color bleeding – depth of field – motion](https://reader035.vdocuments.us/reader035/viewer/2022062608/60892d4e4540b87a6a77ef76/html5/thumbnails/12.jpg)
12
Caustics
![Page 13: EECS 487 March 19, 2007 · Disadvantages • Missing effects – shadows – reflection – refraction through transparent surfaces – color bleeding – depth of field – motion](https://reader035.vdocuments.us/reader035/viewer/2022062608/60892d4e4540b87a6a77ef76/html5/thumbnails/13.jpg)
13
Degrees of raytracing
• Raycasting– same disadvantages as rasterization,
but slower!
• Classical raytracing (today)– extension of raycasting (slower still)
• Monte carlo raytracing (next class)– extension of classical raytracing
(waaaay slower)
![Page 14: EECS 487 March 19, 2007 · Disadvantages • Missing effects – shadows – reflection – refraction through transparent surfaces – color bleeding – depth of field – motion](https://reader035.vdocuments.us/reader035/viewer/2022062608/60892d4e4540b87a6a77ef76/html5/thumbnails/14.jpg)
14
Raycasting
• For each pixel– Compute ray into scene– Find intersection with nearest object
• Compute lighting (via position, normal)
![Page 15: EECS 487 March 19, 2007 · Disadvantages • Missing effects – shadows – reflection – refraction through transparent surfaces – color bleeding – depth of field – motion](https://reader035.vdocuments.us/reader035/viewer/2022062608/60892d4e4540b87a6a77ef76/html5/thumbnails/15.jpg)
15
Advantages of raycasting
• Simple
![Page 16: EECS 487 March 19, 2007 · Disadvantages • Missing effects – shadows – reflection – refraction through transparent surfaces – color bleeding – depth of field – motion](https://reader035.vdocuments.us/reader035/viewer/2022062608/60892d4e4540b87a6a77ef76/html5/thumbnails/16.jpg)
16
Advantages of raycasting
• Simple• Can be extended to include global
illumination effects:– Reflections (specular, glossy)– Shadows (hard, soft)– Depth of field– Motion blur
• Then it’s called raytracing
![Page 17: EECS 487 March 19, 2007 · Disadvantages • Missing effects – shadows – reflection – refraction through transparent surfaces – color bleeding – depth of field – motion](https://reader035.vdocuments.us/reader035/viewer/2022062608/60892d4e4540b87a6a77ef76/html5/thumbnails/17.jpg)
17
Disadvantages of raytracing
• Done in software: slower• Adding realism can increase computations
exponentially: monte carlo ray tracing, AKA distribution raytracing
![Page 18: EECS 487 March 19, 2007 · Disadvantages • Missing effects – shadows – reflection – refraction through transparent surfaces – color bleeding – depth of field – motion](https://reader035.vdocuments.us/reader035/viewer/2022062608/60892d4e4540b87a6a77ef76/html5/thumbnails/18.jpg)
18
Classical raytracing
• Primary ray– leaves the eye and travels out to the scene
• When hit spawn three new raysto “collect light”– shadow ray
• towards light
– reflection ray– transparency ray
to camera
![Page 19: EECS 487 March 19, 2007 · Disadvantages • Missing effects – shadows – reflection – refraction through transparent surfaces – color bleeding – depth of field – motion](https://reader035.vdocuments.us/reader035/viewer/2022062608/60892d4e4540b87a6a77ef76/html5/thumbnails/19.jpg)
19
The ray tree
![Page 20: EECS 487 March 19, 2007 · Disadvantages • Missing effects – shadows – reflection – refraction through transparent surfaces – color bleeding – depth of field – motion](https://reader035.vdocuments.us/reader035/viewer/2022062608/60892d4e4540b87a6a77ef76/html5/thumbnails/20.jpg)
20
Raytracing is recursive
• I(incidentout) = I(shadowlocalin)+ Kr * I(reflectionin)+ Kt * I(transparentin)
– what is a range of Kr and Kt?• Without recursion we have ray casting
![Page 21: EECS 487 March 19, 2007 · Disadvantages • Missing effects – shadows – reflection – refraction through transparent surfaces – color bleeding – depth of field – motion](https://reader035.vdocuments.us/reader035/viewer/2022062608/60892d4e4540b87a6a77ef76/html5/thumbnails/21.jpg)
21
Ray Reflections
NI R
θi θr
θI = θr
R = I 2(N • I) N
![Page 22: EECS 487 March 19, 2007 · Disadvantages • Missing effects – shadows – reflection – refraction through transparent surfaces – color bleeding – depth of field – motion](https://reader035.vdocuments.us/reader035/viewer/2022062608/60892d4e4540b87a6a77ef76/html5/thumbnails/22.jpg)
22
Ray RefractionNI
T
θi
θt
Snell’s Law
1
221)sin(
)sin(ηη
θθ η ==
t
i
Index of refraction: ratio of speed of light in a vacuum to speed in the material
![Page 23: EECS 487 March 19, 2007 · Disadvantages • Missing effects – shadows – reflection – refraction through transparent surfaces – color bleeding – depth of field – motion](https://reader035.vdocuments.us/reader035/viewer/2022062608/60892d4e4540b87a6a77ef76/html5/thumbnails/23.jpg)
23
Light Attenuation in transparent materials
• Light may lose intensity and shift color– effect increases with distance
• Beer’s law– Falloff is exponential w/ distance– r, g, b components computed separately– text has details
![Page 24: EECS 487 March 19, 2007 · Disadvantages • Missing effects – shadows – reflection – refraction through transparent surfaces – color bleeding – depth of field – motion](https://reader035.vdocuments.us/reader035/viewer/2022062608/60892d4e4540b87a6a77ef76/html5/thumbnails/24.jpg)
24http://www.jasonwaltman.com/graphics/rtsoftfuzzy.html
![Page 25: EECS 487 March 19, 2007 · Disadvantages • Missing effects – shadows – reflection – refraction through transparent surfaces – color bleeding – depth of field – motion](https://reader035.vdocuments.us/reader035/viewer/2022062608/60892d4e4540b87a6a77ef76/html5/thumbnails/25.jpg)
25
Watch out for…
• Total internal refraction– light may not get through the interface
![Page 26: EECS 487 March 19, 2007 · Disadvantages • Missing effects – shadows – reflection – refraction through transparent surfaces – color bleeding – depth of field – motion](https://reader035.vdocuments.us/reader035/viewer/2022062608/60892d4e4540b87a6a77ef76/html5/thumbnails/26.jpg)
26
Computing intersections
• Crucial computation (inner loop)• Spheres• Planes• CSGs
image from: http://groups.csail.mit.edu/graphics/classes/6.838/F01/ lectures/SmoothSurfaces/csgraytrace.gif
![Page 27: EECS 487 March 19, 2007 · Disadvantages • Missing effects – shadows – reflection – refraction through transparent surfaces – color bleeding – depth of field – motion](https://reader035.vdocuments.us/reader035/viewer/2022062608/60892d4e4540b87a6a77ef76/html5/thumbnails/27.jpg)
27
pop quiz
• given ray: r(t) = p + tdwhere p is the ray origin,d is a vector along the ray
• find the value of t for which r(t) lies on the unit sphere with center at the origin
![Page 28: EECS 487 March 19, 2007 · Disadvantages • Missing effects – shadows – reflection – refraction through transparent surfaces – color bleeding – depth of field – motion](https://reader035.vdocuments.us/reader035/viewer/2022062608/60892d4e4540b87a6a77ef76/html5/thumbnails/28.jpg)
28
Speedup techniques
• Bounding volumes– Spheres– Boxes
• Uniform spatial subdivision
• Hierarchical bounding boxes
![Page 29: EECS 487 March 19, 2007 · Disadvantages • Missing effects – shadows – reflection – refraction through transparent surfaces – color bleeding – depth of field – motion](https://reader035.vdocuments.us/reader035/viewer/2022062608/60892d4e4540b87a6a77ef76/html5/thumbnails/29.jpg)
29
Using hierarchical bounding boxes
To check for intersections w/ objects in box:– if ray misses box, return none– if box is “leaf” test intersections w/ each
triangle stored in the box, return closest– else check for intersections w/ each child box,
return closest
![Page 30: EECS 487 March 19, 2007 · Disadvantages • Missing effects – shadows – reflection – refraction through transparent surfaces – color bleeding – depth of field – motion](https://reader035.vdocuments.us/reader035/viewer/2022062608/60892d4e4540b87a6a77ef76/html5/thumbnails/30.jpg)
30
Problem (classical ray tracing): images are too clean
http://www.tjhsst.edu/~dhyatt/supercomp/p501.html
![Page 31: EECS 487 March 19, 2007 · Disadvantages • Missing effects – shadows – reflection – refraction through transparent surfaces – color bleeding – depth of field – motion](https://reader035.vdocuments.us/reader035/viewer/2022062608/60892d4e4540b87a6a77ef76/html5/thumbnails/31.jpg)
31
What’s missing
• Reflections are perfect• Shadows are hard• Everything is in focus• Shutter speed is infinite• Prone to aliasing
![Page 32: EECS 487 March 19, 2007 · Disadvantages • Missing effects – shadows – reflection – refraction through transparent surfaces – color bleeding – depth of field – motion](https://reader035.vdocuments.us/reader035/viewer/2022062608/60892d4e4540b87a6a77ef76/html5/thumbnails/32.jpg)
32
Strategy: random sampling
Can address all problems listed on previous slide
![Page 33: EECS 487 March 19, 2007 · Disadvantages • Missing effects – shadows – reflection – refraction through transparent surfaces – color bleeding – depth of field – motion](https://reader035.vdocuments.us/reader035/viewer/2022062608/60892d4e4540b87a6a77ef76/html5/thumbnails/33.jpg)
33
antialiasing
• many rays per pixel– regular sampling– random sampling
• more on this next time
![Page 34: EECS 487 March 19, 2007 · Disadvantages • Missing effects – shadows – reflection – refraction through transparent surfaces – color bleeding – depth of field – motion](https://reader035.vdocuments.us/reader035/viewer/2022062608/60892d4e4540b87a6a77ef76/html5/thumbnails/34.jpg)
34
soft shadows
• one approach: use many lights– approximate an area light with many point lights– problem: overlapping hard shadows
• alternate approach:– sample the area light randomly w/ rays– random sampling discussed in text
![Page 35: EECS 487 March 19, 2007 · Disadvantages • Missing effects – shadows – reflection – refraction through transparent surfaces – color bleeding – depth of field – motion](https://reader035.vdocuments.us/reader035/viewer/2022062608/60892d4e4540b87a6a77ef76/html5/thumbnails/35.jpg)
35http://www.cs.wpi.edu/~emmanuel/courses/cs563/write_ups/zackw/realistic_raytracing.html
![Page 36: EECS 487 March 19, 2007 · Disadvantages • Missing effects – shadows – reflection – refraction through transparent surfaces – color bleeding – depth of field – motion](https://reader035.vdocuments.us/reader035/viewer/2022062608/60892d4e4540b87a6a77ef76/html5/thumbnails/36.jpg)
36
more effects
• glossy reflection– follow multiple reflection rays, jittered randomly
• motion blur– multiple rays, jittered in time
• depth of field– multiple rays, jittered around eye, through focal plane
• more details next class
![Page 37: EECS 487 March 19, 2007 · Disadvantages • Missing effects – shadows – reflection – refraction through transparent surfaces – color bleeding – depth of field – motion](https://reader035.vdocuments.us/reader035/viewer/2022062608/60892d4e4540b87a6a77ef76/html5/thumbnails/37.jpg)
37
Wrap up
• Shirley (our textbook) has details on computing random samples effectively
• Project 5 (ray tracing) will go out next week• Guest speaker next week:
Manoj Rajagopalan• I'll be out of town
– no office hours