CODEDAY #6

rayTracer

This was the project for my sixth CodeDay. I received the prize for Most Technically Impressive (again).

For a long time now, I’ve wanted to make a photo-realistic renderer and so that’s what I ended up finally doing for this project. The process ended up being substantially simpler than I had originally thought. I found a little tutorial that laid out the basics and within a couple hours I actually had something (which is an all-time new record for me).

rayTracer1

And while it just looks like a circle on a black background – in memory, it is a 3D sphere and if you look closely you can see a gradient that is caused by a light source underneath the sphere.

After more research and lots of time, I finally ended up adding more spheres, implementing reflections and refractions, and a moveable player.

rayTracer2

One of the drawbacks is that each frame took almost a fifth of a second to render, so I decided to use my OpenGL knowledge (gathered from the previous CodeDays) and put the raytracer on the GPU.

One of the biggest problems I encountered was that GLSL does not allow recursion so I had to convert the whole thing to a loop, and at 4 in the morning – that was really difficult do. I finally ended up doing that and the whole thing worked, I decided last minute (literally last minute it was like 9:30 am and presentations started at 10 am) to have each sphere be affected by gravity and also bounce.

rayTracerBouncing

All at a solid 60 FPS.

BACK TO PROJECTS