Download presentation
Presentation is loading. Please wait.
1
Parallelizing Raytracing Gillian Smith CMPE 220 February 19 th, 2008
2
Agenda What is raytracing? How raytracers work Parallelization
3
What Is Raytracing? 3D rendering technique Mathematical representation of scenes Extremely computationally intensive Results capture complex lighting effects
4
What Is Raytracing?
6
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
7
Algorithm Overview (Per Pixel) 1. Shoot a ray from the camera through the pixel and towards the scene 2. Compute the intersection between objects in the scene and the ray 3. For the closest intersection point to the camera, compute the color that should be stored in the pixel
8
Compute Ray through Pixel Front View Side View P 0 : Camera’s Position D: Camera’s Direction U: Camera’s “Up” Direction U D PiPi Θ Ray: R = P 0 + tV
9
Algorithm Overview (Per Pixel) 1. Shoot a ray from the camera through the pixel and towards the scene 2. Compute the intersection between objects in the scene and the ray 3. For the closest intersection point to the camera, compute the color that should be stored in the pixel
10
Compute Intersection Slide Credit: Greg Humphreys, University of Virginia P0P0 V Sphere: |P - C| 2 – r 2 = 0 Point on Ray: P = P 0 + tV C P P’ R P0P0 V
11
Compute Intersection Substitute for P in equation for sphere: |P 0 + tV – C| 2 – r 2 = 0 Solve for t, choose smaller value C P P’ R P0P0 V
12
Algorithm Overview (Per Pixel) 1. Shoot a ray from the camera through the pixel and towards the scene 2. Compute the intersection between objects in the scene and the ray 3. For the closest intersection point to the camera, compute the color that should be stored in the pixel
13
Determine color at pixel Raycasting method Look up color from scene specification Raytracing method Find contribution to pixel from each light source Reflections Refractions
14
Local Illumination Light has a color, L C Object’s material Diffuse color, C D Specular color, C S Specular highlight, S Pixel Diffuse C D L C (N. L) Pixel Specular C S L C (R. V) S Final color is sum of all diffuse and specular colors from every light in the scene
15
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
16
Computational Expense Rendered at 800x600 PowerBook G4 (1.25GHz PowerPC, 1GB RAM) > 10 hours to render
17
Computational Expense 598x634 image. 131,072 triangles Depth of field effect GeForce 7800 GTX Less than 2 minutes.
18
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
19
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
20
Parallelizing Raytracing Gillian Smith CMPE 220 February 19 th, 2008
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.