![Page 1: Parallelizing Raytracing Gillian Smith CMPE 220 February 19 th, 2008](https://reader036.vdocuments.net/reader036/viewer/2022062421/56649d545503460f94a3037e/html5/thumbnails/1.jpg)
Parallelizing Raytracing
Gillian SmithCMPE 220
February 19th, 2008
![Page 2: Parallelizing Raytracing Gillian Smith CMPE 220 February 19 th, 2008](https://reader036.vdocuments.net/reader036/viewer/2022062421/56649d545503460f94a3037e/html5/thumbnails/2.jpg)
Agenda What is raytracing? How raytracers work Parallelization
![Page 3: Parallelizing Raytracing Gillian Smith CMPE 220 February 19 th, 2008](https://reader036.vdocuments.net/reader036/viewer/2022062421/56649d545503460f94a3037e/html5/thumbnails/3.jpg)
What Is Raytracing? 3D rendering
technique Mathematical
representation of scenes
Extremely computationally intensive
Results capture complex lighting effects
![Page 4: Parallelizing Raytracing Gillian Smith CMPE 220 February 19 th, 2008](https://reader036.vdocuments.net/reader036/viewer/2022062421/56649d545503460f94a3037e/html5/thumbnails/4.jpg)
What Is Raytracing?
![Page 5: Parallelizing Raytracing Gillian Smith CMPE 220 February 19 th, 2008](https://reader036.vdocuments.net/reader036/viewer/2022062421/56649d545503460f94a3037e/html5/thumbnails/5.jpg)
What Is Raytracing?
![Page 6: Parallelizing Raytracing Gillian Smith CMPE 220 February 19 th, 2008](https://reader036.vdocuments.net/reader036/viewer/2022062421/56649d545503460f94a3037e/html5/thumbnails/6.jpg)
How Raytracers Work Image plane is
placed between the camera and the scene
The color of each pixel in that plane is computed by the raytracer
Pixels are independent of each other
![Page 7: Parallelizing Raytracing Gillian Smith CMPE 220 February 19 th, 2008](https://reader036.vdocuments.net/reader036/viewer/2022062421/56649d545503460f94a3037e/html5/thumbnails/7.jpg)
Algorithm Overview (Per Pixel)1. Shoot a ray from the camera through the
pixel and towards the scene2. Compute the intersection between
objects in the scene and the ray3. For the closest intersection point to the
camera, compute the color that should be stored in the pixel
![Page 8: Parallelizing Raytracing Gillian Smith CMPE 220 February 19 th, 2008](https://reader036.vdocuments.net/reader036/viewer/2022062421/56649d545503460f94a3037e/html5/thumbnails/8.jpg)
Compute Ray through Pixel
Front ViewSide View
P0: Camera’s Position
D: Camera’s Direction
U: Camera’s “Up” Direction
U
D
Pi
Θ
Ray: R = P0 + tV
|| 0
0
PP
PPV
i
i
![Page 9: Parallelizing Raytracing Gillian Smith CMPE 220 February 19 th, 2008](https://reader036.vdocuments.net/reader036/viewer/2022062421/56649d545503460f94a3037e/html5/thumbnails/9.jpg)
Algorithm Overview (Per Pixel)1. Shoot a ray from the camera through the
pixel and towards the scene2. Compute the intersection between
objects in the scene and the ray3. For the closest intersection point to the
camera, compute the color that should be stored in the pixel
![Page 10: Parallelizing Raytracing Gillian Smith CMPE 220 February 19 th, 2008](https://reader036.vdocuments.net/reader036/viewer/2022062421/56649d545503460f94a3037e/html5/thumbnails/10.jpg)
Compute Intersection
Slide Credit: Greg Humphreys, University of Virginia
P0
V
Sphere: |P - C|2 – r2 = 0
Point on Ray: P = P0 + tV
C
P
P’
R
P0
V
![Page 11: Parallelizing Raytracing Gillian Smith CMPE 220 February 19 th, 2008](https://reader036.vdocuments.net/reader036/viewer/2022062421/56649d545503460f94a3037e/html5/thumbnails/11.jpg)
Compute IntersectionSubstitute for P in equation for sphere:
|P0 + tV – C|2 – r2 = 0
Solve for t, choose smaller value
C
P
P’
R
P0
V
![Page 12: Parallelizing Raytracing Gillian Smith CMPE 220 February 19 th, 2008](https://reader036.vdocuments.net/reader036/viewer/2022062421/56649d545503460f94a3037e/html5/thumbnails/12.jpg)
Algorithm Overview (Per Pixel)1. Shoot a ray from the camera through
the pixel and towards the scene2. Compute the intersection between
objects in the scene and the ray3. For the closest intersection point to
the camera, compute the color that should be stored in the pixel
![Page 13: Parallelizing Raytracing Gillian Smith CMPE 220 February 19 th, 2008](https://reader036.vdocuments.net/reader036/viewer/2022062421/56649d545503460f94a3037e/html5/thumbnails/13.jpg)
Determine color at pixel Raycasting method
Look up color from scene specification
Raytracing method Find contribution to
pixel from each light source
Reflections Refractions
![Page 14: Parallelizing Raytracing Gillian Smith CMPE 220 February 19 th, 2008](https://reader036.vdocuments.net/reader036/viewer/2022062421/56649d545503460f94a3037e/html5/thumbnails/14.jpg)
Local Illumination Light has a color, LC Object’s material
Diffuse color, CD Specular color, CS Specular highlight, S
Pixel Diffuse CDLC(N.L)
Pixel Specular CSLC(R.V)S
Final color is sum of all diffuse and specular colors from every light in the scene
![Page 15: Parallelizing Raytracing Gillian Smith CMPE 220 February 19 th, 2008](https://reader036.vdocuments.net/reader036/viewer/2022062421/56649d545503460f94a3037e/html5/thumbnails/15.jpg)
Global Illumination Illumination effects dependent on other
objects in the scene Shadows Reflections Refraction
Calculated by sending additional rays from the object Shadows: send ray to light Reflections: reflect ray around normal Refraction: depends on index of refraction
![Page 16: Parallelizing Raytracing Gillian Smith CMPE 220 February 19 th, 2008](https://reader036.vdocuments.net/reader036/viewer/2022062421/56649d545503460f94a3037e/html5/thumbnails/16.jpg)
Computational Expense•Rendered at 800x600
•PowerBook G4 (1.25GHz PowerPC, 1GB RAM)
•> 10 hours to render
![Page 17: Parallelizing Raytracing Gillian Smith CMPE 220 February 19 th, 2008](https://reader036.vdocuments.net/reader036/viewer/2022062421/56649d545503460f94a3037e/html5/thumbnails/17.jpg)
Computational Expense•598x634 image.
•131,072 triangles
•Depth of field effect
•GeForce 7800 GTX
•Less than 2 minutes.
![Page 18: Parallelizing Raytracing Gillian Smith CMPE 220 February 19 th, 2008](https://reader036.vdocuments.net/reader036/viewer/2022062421/56649d545503460f94a3037e/html5/thumbnails/18.jpg)
Raytracing Can Be Parallelized “Embarrassingly (pleasantly?) parallel” Pixels are independent of each other All pixels must known complete scene
specification SPPM
Computing global illumination involves recursion
Some pixel computations will finish before others
![Page 19: Parallelizing Raytracing Gillian Smith CMPE 220 February 19 th, 2008](https://reader036.vdocuments.net/reader036/viewer/2022062421/56649d545503460f94a3037e/html5/thumbnails/19.jpg)
Project: Kestrel Implementation Additional math
tangent square root
Precision 32bit fixed point Scene must stay in a particular range
Space Memory: Store scene in every PE Register: Lots of values to keep track of for
each computation
![Page 20: Parallelizing Raytracing Gillian Smith CMPE 220 February 19 th, 2008](https://reader036.vdocuments.net/reader036/viewer/2022062421/56649d545503460f94a3037e/html5/thumbnails/20.jpg)
Parallelizing Raytracing
Gillian SmithCMPE 220
February 19th, 2008