For my thesis, I developed and compared a sequential CPU and parallel GPU implementation of a ray tracer written in C++ and CUDA respectively. Here are the presentation slides from my thesis defense.
2. Objectives
Develop a sequential CPU and parallel GPU ray tracer
Illustrate the difference in rendering speed and design of a CPU and
GPU ray tracer
2
4. What is Ray Tracing?
Rendering technique used in computer graphics
Simulates the behavior of light
Can produce advanced optical effects
4
5. Light in the Physical World
5
Light Source
Film
Object with
Red Reflectivity
Pinhole
6. The Virtual Camera Model
Eye Position – camera location in 3D space
Reference Point – point in 3D space where the camera is pointing
Orientation Vectors (u, v, n) – camera orientation in 3D space
Image Plane – projected plane of the camera’s field of view
Reference Point
v (Up Vector)
n
u
Eye Position
6
7. Ray Generation
Map the physical screen to the image plane
Divide the image plane into a uniform grid of pixel locations
7
Send a ray through the center of each pixel location
𝐼𝑚𝑎𝑔𝑒 𝑃𝑙𝑎𝑛𝑒 𝐻𝑒𝑖𝑔ℎ𝑡
𝑆𝑐𝑟𝑒𝑒𝑛 𝐻𝑒𝑖𝑔ℎ𝑡
Pixel
Eye Position
𝐼𝑚𝑎𝑔𝑒 𝑃𝑙𝑎𝑛𝑒 𝑊𝑖𝑑𝑡ℎ
𝑆𝑐𝑟𝑒𝑒𝑛 𝑊𝑖𝑑𝑡ℎ
25. Caching Surface Data
Object’s surface data stored on shared memory
All threads in same block have access to cached surface data
Removes duplicate memory requests
Data reuse
25
27. Simplifying Mesh Data
27
Triangle data originally stored as three points (vertices)
Optimize data by storing triangles as one point (vertex) and two edges
Calculate edges on host before kernel call
0.5, 1
0, 0
0.5, 1
1, 0
Pixel – picture element that represents one point on an image. Consists of a single color
Don’t forget to mention what happens if a ray misses completely
Ambient Light – indirect light reflected off of other objects in the sceneDiffuse Light – direct light reflected off the surface in all directionsSpecular light – direct light reflected off the surface in a single direction
Block and Threads have unique identifier
Register Memory – 50x faster than Global MemoryL2 Cache – LRU (Least Recently Used)L1 Cache – Spatial Locality (Quickly access memory in nearby location of current memory reference), Caches per-thread stack and other local data structures