Wednesday, December 17, 2008

Checkpoint 2 Completed























Checkpoint 2 status: Complete + 2 extras
Tech: C++, OpenGL/GLUT for pixel buffer placement.
Supports: Spheres, Infinite Planes, Quads, Triangles, Supersampling, .obj 3d models


Extra: Supersampling






















Here you can see the addition of supersampling and an attempt at drawing the checkerboard pattern on the floor polygon.




Extra: Triangles!






















I added the ability to do intersection tests against triangles. The obvious thing to do with this functionality was to try raytracing a large triangle mesh loaded from a file. The teapot shown here is made from over 6 thousand triangles. I perform a bounding-sphere test first to see if a ray is near the model before actually doing an intersection test on the triangles. Also, backface culling is used because the object is perfectly opaque.

Testing with such a large model really helped me to find issues inside my code that I would not usually have noticed: It was leaking memory at a huge rate, and would run out of memory by hitting the 2gb limit for 32 bit applications!
Now, I can trace the scene using only about 16mb of ram.

General Benchmark: the screenshot above, 400x400, 6320 triangles, with 4x supersampling enabled, took about 20 seconds on a MacBook.

No comments: