CS 6620 - Fall 2017 - Ray Tracing for Graphics

Project 5 - Triangular Meshes

Kevin Parker


Final image


Work-in-progress images

Initial attempt at planes (clearly not great)

Got the back face to appear (had some 't' math wrong for previous image)

Remembered to report the hit point

First attempt at triangles

Further attempts at triangles

Ok, I'm having too much fun

Finally actually getting triangles to almost work (plane demo)

Finally actually getting triangles to almost work (teapot demo)

Added bias to the barycentric coordinates (but still has Z wrong)

Fixed Z but ended up showing more issues with my barycentric coords (see the seams on the edges of triangles)

Finally got things looking good on the low-poly teapot

But the high-poly teapot causes black dots on the sphere to the left! These are caused by NaNs, which were later avoided with more biases

The rendered image

EDIT: I found a bug in the lighting code that allowed negative light. Here it is after the fix:


Timing

99sec render time on 8 threads for the final scene. Adding the bounding-box culling actually didn't seem to change it much. I suspect that I can get much more performance by breaking earlier when working with known bad triangles, but many of the improvements I added didn't seem to change performance.

Edit: It turns out my box-intersection was a bit too happy to return 'true'. After resolving that issue, render time is down to 36 seconds.


Machine Specs

MacBook Pro (15-inch, 2016)

2.7 GHz quad-core Intel Core i7 Skylake (6820HQ)

16 GB 2133 MHz LPDDR3 RAM