Project 04 - Ray Casting Triangles
Rendering polygon meshes are far more fun than planes and quadratics, but also more challenging. I need to include K-D tree to achieve reasonable performance, even with GPU implementation.
All images below are rendered with 1024 shadow rays per pixel to generate soft shadow, since I simply could not bear to look at hard shadow images anymore :/. The rendering a while, but the images are definitely worth the waiting. In fact, most of the images below can be generated in real time if rendered with fewer shadow rays (special thanks to my Nvidia GTX-750 GPU).
The K-D tree I implemented now is probably a low quality one, since I used the primitive median separation method. Adding surface area heuristic for the construction of K-D tree should produce much better trees and further boost the rendering performance.
The source code of this project is available here. It is a bit messy currently, but I will try to clean it up later.
Images
Click on the images to view full size version.
Image 6: Interesting error of KD tree. Turned out the conversion from pointer based tree to array based tree caused this problem. Some non-existing nodes are added to the tree during the conversion, resulting in the visible holes in the rendered mesh.