Raytracer
As a kid, I had an old version of 3dsmax on my computer I could play around with and use to make some basic renders. 3D graphics seemed like pure magic. I didn't understand how any of it worked, I just followed an online tutorial and placed some lights, hit "render", and waited for the pretty picture to appear.
Years later I realized that people actually make simple renderers completely from scratch. Ever since then I really wanted to write one myself. I stumbled upon a great book, Ray Tracing in One Weekend by Peter Shirley, and it was the perfect excuse to finally do it.
I chose Go as I've been wanting to try it for a while. It has a built-in concurrency model, which worked great for an embarrassingly parallel problem such as ray tracing. I like the language in general, it was easy to get started with it and they have a nice tour of it on https://tour.golang.org.
I'm pretty happy with the results, seeing images appear from code you've written is always exciting. Of course, there are a million things that I'd like to add and improve, but this was meant as just a fun exercise.
I added an .obj
parser to it, so I was able to load and render simple triangulated scenes.
But as I made absolutely no attempts at optimizing things, any scene with more than a few triangles renders painfully slow.
The code is available on Github.
Here are the results: