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 1: Polygon mesh, 120 triangles, rendered in 22 seconds.

Image 2: Bunny (69451 triangles) and dragon (871414 triangles), took about 9 minutes to render.

Image 3: Cube, tetrahedron and bunny, with textures.

Image 4: Lamborghini aventador, 183309 triangles, rendered in 17 minutes.

Image 5: Buddha, 1087474 triangles, rendered in 5 minutes 41 seconds.

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.

Image 7: Cool effects - Glass bunny, 69451 triangles, rendered in 8 minutes and 7 seconds.

Image 8: Cool effects - Translucent bunny, 69451 triangles, rendered in about 17 minutes. Translucency values are 0.005, 0.1, and 0.5 from left to right.

Image 9: Cool effects - Jade dragon, 871414 triangles, rendered in about an hour.

Image : Cool effects - Marble bunny, silver dragon and wood teapot, rendered in about an hour.