Ray-tracer evolution

In the last post I showed my finished ray-tracer. Now Iā€™m going to show the steps I took to get there.

I started creating Lines and Spheres in geometry.py and generating an PNG image with PIL in render.py. The first image I was able to generate was:

Ray-tracer

Adding colors and an extra sphere was easy:

Ray-tracer

Then I tried adding a Horizontal plane:

Ray-tracer

Making it checkered:

Ray-tracer

But it was in the wrong place:

Ray-tracer

After fixing the positions:

Ray-tracer

Next I tried implementing shadows, it took me a few tries:

Ray-tracer Ray-tracer Ray-tracer

How could I make the spheres look 3D? I followed the part about diffuse lighting in these slides.

Ray-tracer

Swapping a 2.0 with a 2 in a division in render.py resulted in:

Ray-tracer

Next step was adding reflections, it was easier then shadows:

Ray-tracer Ray-tracer

And finally:

Ray-tracer

tags