View on GitHub

Cardinal3D

Stanford CS248A (Assignments 2 and 3)

Ray Triangle Intersection

Step 1: Triangle::hit

The first intersect routine that the hit routines for the triangle mesh in student/tri_mesh.cpp.

We recommend that you implement the Moller-Trumbore algorithm, a fast algorithm that takes advantage of a barycentric coordinates parameterization of the intersection point, for ray-triangle intersection.

There are two important details you should be aware of about intersection:

Once you’ve successfully implemented triangle intersection, you will be able to render many of the scenes in the media directory. However, your ray tracer will be very slow!

Tip: While you are working with student/tri_mesh.cpp, you can choose to implement Triangle::bbox as well (pretty straightforward to do), which is needed for task 3.

A few final notes and thoughts: