more raytracing and misc

Sep 21, 2009 22:26

I rewrote the raytracer, seeing that my first attempt had produced semi-spaghetti code..

Things I've added so far:
  • Support for triangle primitives (most complex models are made up of tesselated triangles)
  • Transformation matrices, so I can transform, rotate, and scale stuff
  • A simple bounding volume hierarchy - the primitives are grouped together in boxes, so if a ray doesn't it a box, it doesn't have to care about the primitives the box contains
  • Supersampling (each pixel's color is generated by averaging over several samples)
Actually I tried adding quite a lot of other stuff this weekend, but it was mostly unsuccessful, lol. I guess that I don't understand the theory well enough yet.

Results from the new one, based on models from the Stanford 3D Scanning Repository (actually, mostly different views of the same dragon. I like dragons):

Dragon:




Dragon, at other angles:







Wabbit (it's lumpy because it originated from a terracotta model of a wabbit, not a real wabbit):




If you look closely you can see the jagged edges in the 2nd and 3rd dragon images, especially around the checkerboard squares.. those images weren't supersampled. (The funny patterns in the background, as the checkerboard stretches towards infinity, are due to the same effect.) The other two images were done with 3x3 supersampling.

Also, here's a fairly interesting video on finance and programming:

raytracer, code

Previous post Next post
Up