Parallelizing Raytracing Gillian Smith CMPE 220 February 19 th, 2008.
-
date post
21-Dec-2015 -
Category
Documents
-
view
218 -
download
0
Transcript of Parallelizing Raytracing Gillian Smith CMPE 220 February 19 th, 2008.
Parallelizing Raytracing
Gillian SmithCMPE 220
February 19th, 2008
Agenda What is raytracing? How raytracers work Parallelization
What Is Raytracing? 3D rendering
technique Mathematical
representation of scenes
Extremely computationally intensive
Results capture complex lighting effects
What Is Raytracing?
What Is Raytracing?
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
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
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
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
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
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
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
Determine color at pixel Raycasting method
Look up color from scene specification
Raytracing method Find contribution to
pixel from each light source
Reflections Refractions
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
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
Computational Expense•Rendered at 800x600
•PowerBook G4 (1.25GHz PowerPC, 1GB RAM)
•> 10 hours to render
Computational Expense•598x634 image.
•131,072 triangles
•Depth of field effect
•GeForce 7800 GTX
•Less than 2 minutes.
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
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
Parallelizing Raytracing
Gillian SmithCMPE 220
February 19th, 2008