Bugs
Here I will catalog the interesting bugs I ran across while coding the raytracer. More occurred than are pictured here; these are the most visually impressive ones.
The first of the Interesting bugs was in the shading. I accidentally flipped the test for whether light reached a point, resulting in light where there should be shadow, and vice versa.
Shortly after that (or maybe before, I forget), I had this. It almost looks like a threading problem, but this was in the single thread run. Also, investigation revealed that the pattern of spots was identical every time. Turned out the error was in detecting light reaching the surface. If i cast a ray from the intersection point to the light, sometimes I would get another intersection at that same point. I resolved this by moving the starting point just slightly above the point of intersection before sending a ray to the light.
This one happened after I removed Apple's color class and made my own. Turns out Apple clamps negative color values to 0, while my class did not. I was somehow generating negative colors, so this is the color you get when you cast a negative double to an unsigned char. (My picture is stored as an unsigned char array.) I think I fixed it by clamping to 0 instead of finding where negative colors came from.
This one was titled Fail At Checkers because that's what happened. I was incorrectly calculating cosine, and was using and for intersection detection instead of xor.
This one is my favorite. It happened shortly after I got transmission working. I got reflections off the inside surface of the sphere, which looked really cool. You may need to turn your brightness up to see all the subtle effects. It saddened me to add the check to only do reflection off the outside surface of an object. I went back later and brought the bug back so I could do a high resolution render.
From adding tone reproduction. I was improperly scaling the color values so they were overflowing the unsigned char and wrapping around, sometimes several times.