Ambient Occlusion Ray Tracing on the GPU

December 2013|Tags: 3d, cuda, gpu, programming

Ambient occlusion is a shading pass that simulates soft shadows by measuring how easy it is for an object to see the 'outside world.' Only the scene geometry is needed to conduct the pass. Software rendered ambient occlusion is usually done with ray tracing. 1 ray for each pixel is projected into the scene, and for each intersection, sample rays are sent in a random direction within the hemisphere normal to the surface of intersection. The hits from these rays are counted and the more hits, the darker the pixel is shaded. However, this can take a long time at high resolution and high sample ray count. Higher sample rays per pixel decreases the amount of noise.

Guang Hui Chen, a fellow student, and I parallelize the ray tracing operation to run on USC's HPC (High Performance Computing) Cluster using CUDA. On the GPU, each thread gets its own block of pixels to process. The final result is then composed together. We created a poster that better explains the parallelization and ambient occlusion with diagrams.

Performance Results can be found here. Our unfiltered/non-anti-aliased rendering results are below.

20 Samples per Ray

50 Samples per Ray

100 Samples per Ray

100 Samples per Ray