Refactor Refractor
I took a look at my raytracer on Friday and decided to “restructure” the rendering process. This wasn’t too difficult, it turned out. In the space of a day I have managed to take the entire rendering process and take it into a DLL. This will allow me to change the renderer for different scenes. I hope to create the photon mapper soon enough, as I did not attempt it over the holidays because I didn’t have a computer capable of it.
One good thing, though, is that in my fiddling I uncovered the source of a few bugs. They are now nearly all fixed, and I am immensely happy with it. So, here it is in all it’s glory.
Bugs fixed:
- Bounding box tests were broken, basically giving us this effect.
- White dots of evil have now been exterminated.
- Refraction works now. Ironically the refraction code wasn’t broken, but something else was screwing it up.
- The lighting calculations for the specular component was totally wrong due to a typo (ha!). This has been fixed. The attenuation had to be lowered because of it. It should have looked like this, whereas it actually looked like the one above.
- My model collision code - while not broken - was rubbish. Also, the scene object classes were mesh-oriented, allowing little room for extension. I’ve changed it so I can have different kinds of objects, like mathematical shapes, or fire, or whatever.
There is one bug I have yet to fix and that is that the camera doesn’t actually seem to face in the same direction as the one in the datafile. Obviously my maths is screwed up: I’m converting the scene file’s look-at camera and turning it into an Euler camera for the rendering process. Maybe I should just stick to a UVN camera. Oh, and anti-aliasing is broken at the moment. This is a recent discovery.
So there we are. Maybe I can get on to some photon mapping goodness soon.

Edit: My latest large render.
This took approximately 12 minutes on my machine at 768×768. I’ve now bumped it to 1024×1024, which took approximately 25 minutes. It has 113,687 faces in 30 objects and one point light above the centre of the board. It’s currently missing the King and Queen for both sides, and also the Knights appear to be facing in the wrong direction, despite being correct when in 3D Studio Max. Every object in this scene is reflective, though I don’t like the colours I’ve picked.
The model was made by Alice Darcy and she has no idea that I’ve nicked it.
January 16th, 2006 at 5:25 am
Wow, that latest render of the chess set is amazing. Can’t wait until we see some great screenshots when photon mapping is implemented.
Go Hermione!
January 16th, 2006 at 3:15 pm
Nice stuff! I like the stats and the fact you already know what the problems are…
Strange urge to play chess now…
January 16th, 2006 at 3:41 pm
I feel like moving some of the pieces around.
January 17th, 2006 at 10:19 pm
The chessboard still looks fake, but the Fresnel helps.
January 19th, 2006 at 7:08 pm
Hi peter, Hope to see your latest version of your offline renderer