CS184/284A Spring 2025 Homework 3 Write-Up

Names:

Link to webpage: https://cal-cs184-student.github.io/hw3/ Link to GitHub repository: https://github.com/cal-cs184-student/sp25-hw3-jayu1
Cornell Boxes with Bunnies
You can add images with captions!

Overview

In this project we are rendering 3d objects while optmizing their rendering, adding lighting, and overall learning about algorithims used to render lighting, coloring, and 3d models.

Part 1: Ray Generation and Scene Intersection

Ray Generation Primitive Intersection Möller–Trumbore finds the triangle's intersection using barycentric coordinates using cross and dot products of the ray direction and triangle edges. It relys on checking if intersection point is in the triangle and ultimetely returns the parametric distance of the ray if its valid.
Rendering of the CBempty.dae file.
Rendering of the CBspheres_lambertian.dae file.

Part 2: Bounding Volume Hierarchy

BVH construction algorithm:

Rendering of the Maxplanck.dae file.
Rendering of the peter.dae file.

At the beganinng of this part of the assignment, I was seeing rendering times taking up to 30 seconds. This typically isn't wildly for a loading complicated files on my laptop, however for us to be able to render things like 3D modals or other large files, this isn't optimized. When using the BVH algorithm, my loading times became almost instantious, but the proof is in the pudding:

Overall, we can see there is a big difference when using BVH.

Part 3: Direct Illumination

Implementations of the direct lighting function:
Uniform Sampling:./pathtracer -t 8 -s 64 -l 32 -m 6 -H -f CBbunny_H_64_32.png -r 480 360 ../dae/sky/CBbunny.dae
Uniform Sampling: ./pathtracer -t 8 -s 16 -l 8 -m 6 -H -f CBbunny_16_8.png -r 480 360 ../dae/sky/CBbunny.dae
Light Sampling: ./pathtracer -t 8 -s 64 -l 32 -m 6 -f CBbunny_il_64_32.png -r 480 360 ../dae/sky/CBbunny.dae
Light Sampling: Grainy images ./pathtracer -t 8 -s 1 -l 1 -m 1 -f CBbunny_IS_1_1.png -r 480 360 ../dae/sky/CBbunny.dae
Light Sampling: slight improvement on image quality ./pathtracer -t 8 -s 1 -l 4 -m 1 -f CBbunny_IS_1_4.png -r 480 360 ../dae/sky/CBbunny.dae
Light Sampling: smoother ./pathtracer -t 8 -s 1 -l 16 -m 1 -f CBbunny_IS_1_16.png -r 480 360 ../dae/sky/CBbunny.dae
Light Sampling: very smooth ./pathtracer -t 8 -s 1 -l 64 -m 1 -f CBbunny_IS_1_64.png -r 480 360 ../dae/sky/CBbunny.dae

Comparision: Generally speaking, in terms of just methodology, with Uniform sampling, we can see that there is a lot more noise in the photos. We can also see more inconsitences in terms of where the light is going rather than a more focused approach of light on the bunny. For example, with uniform sampling, the bunny's ear is a lot more bright than compared to light sampling. This is because the light sampling is basically taking the lights actual ray direction, distance, etc. into account in showing how much lighting is actually applied to the object. Overall, it can be pretty clearly seen that the light sampling leads to better lighting quality.

Part 4: Global Illumination

Implementation of the indirect lighting:

CBBunny Global (direct and indirect) illumination
Empty Global (direct and indirect) illumination

Clearly, when looking at these pictures the indirect lighting is brighter and overall looks better than direct lighting. The direct lighting has too many darkly shaded shadows that don't look natural.

direct
indirect
m = 0, isAccumBounces = false
m=1, isAccumBounces = false
m=2, isAccumBounces = false
m=3, isAccumBounces = false
m=4, isAccumBounces = false
m=5, isAccumBounces = false
m=0, isAccumBounces = true
m=1, isAccumBounces = true
m=2, isAccumBounces = true
m=3, isAccumBounces = true
m=4, isAccumBounces = true
m=5, isAccumBounces = true
m = 100, isAccumBounces = true

When looking at the different sample-per-pixel rates, that as we go up in value, the edges get smoother.

s = 1
s = 2
s= 4
s= 8
s= 16
s= 64
s= 1024

Part 5: Adaptive Sampling

Explain adaptive sampling. Walk through your implementation of the adaptive sampling.

Adaptive Sampling: This is an algorithm that basically adjusts how many samples we are using for every pixel we render vs using a fixed number in the Monte Carlo Path tracing function.

Implementation:

CBEmpty rate
CBEmpty - ./pathtracer -t 8 -s 2048 -l 1 -m 5 -a 64 0.05 -r 480 360 -f CBEmpty_2048.png ../dae/sky/CBempty.dae
CBbunny rate
CBBunny - ./pathtracer -t 8 -s 2048 -l 1 -m 5 -a 64 0.05 -r 480 360 -f CBbunny_2048.png ../dae/sky/CBbunny.dae