CS 6620
CS 6620

Project 5 - Triangular Meshes

Render Output

Many problems have been encountered during this project. First of all, the plane intersection had quite a few bugs when the I first started implementing it. Below is the initial result I was getting:

Plane Error 1

This is a combination of forgetting to check the t value against hInfo.z, and failing to check for floating point bias. The next one below shows the persisting floating point issue after the t check has been fixed.

Plane Error 2

After fixing both of those issues, the plane seems to be rendering correctly, but the shadow seems to be not working correctly. This bug is related to not checking for a t value larger than 0.

Plane Error 3

After those three bugs were fixed, I moved on to implement triangle intersection. Unfortunately the first result is not optimal.

Triangle Error 1

It turns out this is the result of a flipped sign. The result immediately improved after fixing the corresponding code. But it seems like something is wrong with the surface values.

Triangle Error 2
Triangle Error 3
Triangle Error 4

After checking the code multiple times and talking to Elena during office hour, we found out that the code is passing in the calculated hit point instead of the barycentric coordinate into the GetNormal() and GetPoint() function. This fix brings the result to the following:

Triangle Error 5

After digging around, I found out that this bug is introduced by the compiler optimization setting. After switching it to O1 or below, the bug disappears. However, I'm sure there's a better way to write my code to eliminate the bug with higher level optimization enabled.

Render Output

Compiler Optimization O1, Bounding Box Enabled: 3 Minutes 1 Second

Compiler Optimization O1, Bounding Box Disabled: 16 Minutes 8 Seconds

i7 3720QM @ 2.6 GHz, 16GB DDR3

macOS 10.12.6

Z-Buffer Output