CS 184: Computer Graphics and Imaging, Summer 2025

Project 3-1: Path Tracer

Yuhe Qin & Henry Michaelson

Website URL: https://cal-cs184.github.io/hw-webpages-yuhe-henry-webpage/hw3/index.html

Github URL: https://github.com/cal-cs184/hw-pathtracer-updated-yuhe-henry-ray-trace



Results Caption: my bunny is the bounciest bunny

Acknowledgement of AI

Overview

In this assignment we took a quantum leap in our ability to render objects that look realistic. Up until this point, we have learned how to represent and render geometrically complex objects, however, our understanding of shading has been fairly shallow. Prior to path tracing, we had a very simple method of approximating lighting (the Blinn Phong lighting method). This method was okay at capturing direct relationships between objects, viewers, and light sources, but could not adequately capture indirect lighting in which light is scattered and reflected off of objects to create a field of illumination. As we see in this assignment, indirect lighting is absolutely critical in creating a photorealistic final product.

Here are the steps that we followed to simulate the transport of light:

  1. In the first task, we built a simple engine to create many sampled rays of light for each pixel and cast them out into a scene to have said rays interact with objects in the scene. We would then measure which object the ray first hit and use said data to determine what should be displayed in each pixel.
  2. In the second task, we implemented a data structure, a bounding volume hierarchy (BVH) tree to decrease the amount of computation required to figure out which primary object a given ray of light hit. This data structure is required to render more complicated scenes as the prior method grew vastly more complex as the number of primitives in the scene increased.
  3. After the first two tasks we were able to generate images via casting many rays into a scene. However, we were not able to create photorealistic images. In order to do that, we had to estimate the light transport between objects in the scene. We implemented the core functionality to do this in the third task.
  4. Now that we were able to transport light from object to object, we needed to write the main recursive function to simulate global illumination. We did this in the fourth task and had to simulate successive bounces of light to represent color bleeding and rubbing off between objects in the scene. This is the critical step in photorealistic rendering as indirect light transport creates the lighting effects that we see in the real world. As this is very computationally intensive and its load grows with each successive light bounce, we implemented the russian roulette strategy to randomly terminate some light rays after a number of bounces.
  5. Lastly, in task six we implemented a smarter sampling technique to stop sampling pixels if their value is converged (i.e. the existing samples have similar values). In this event, successive sampling is not going to tell us much about the pixels final value and we do not need to waste computational resources on it.


Part 1: Ray Generation and Scene Intersection