In this project we add plane and triangular mesh object types to our ray tracer.
Requirements
Implement plane, triangle, and bounding box intersections. Render a scene that includes a triangular mesh with lighting and shading.
Report render times with and without bounding box tests.
XML Scene Format
We have a minor addition to the XML scene format to support new object types: plane and triangular meshes. The plane object is a square with 2 unit lengh edges. It is placed at the origin and the plane normal is aligned with the positive z-axis in object coordinates.
The triangular mesh is specified in an external OBJ file. The name of the object is the filename of the OBJ file, which should be placed in the same folder as the scene XML file.
The following source code files are provided to help you with this and upcoming projects. You are not required to use them, but it is highly recommened that you use some of them. Some of these files include additional code as compared to the same files in the previous project, so make sure to download them all again.
scene.h: Includes base classes for scene management.
xmlload.cpp: Includes the LoadScene() function that parses a given scene XML file using the TinyXML library.
objects.h: Includes the description of the Sphere, Plane, and Triangular Mesh classes used by the xmlload.cpp file.
viewport.cpp: OpenGL based preview and user interface launched by calling the ShowViewport() function based on the GLUT library (the Windows version is here). This is the same as the previous file, except that it includes implementations of the viewport display methods for plane and triangular mesh classes.
Test Scenes
The following scene files are provided to help you test your implementation. You can also prepare other scenes to show your work.
Cornell Box Scene: A Cornell Box scene with two Utah Teapots and a ball. The ball has a refractive material and the teapots have a reflective material.
Teapot OBJ: A mesh version of Utah Teapot used by the Cornell Box scene.
Teapot OBJ (low-resolution): A low-resolution mesh version of Utah Teapot that is more suitable for debugging.
Plane OBJ: A plane object that can be used for testing and debugging triangular mesh intersections.
References
[Möller-Trumbore 1997]
Tomas Möller and Ben Trumbore. 1997. Fast, minimum storage ray-triangle intersection. Journal of Graphics Tools 2(1):21—28.