This was an experiment in graphics programming to create a raytracer for the game Brickadia. Using a community-maintained server wrapper tool called Omegga (from which many of my small projects have spawned), I created a plugin for the game that read the server's current save (a collection of player-placed bricks, think LEGO) and used modern rendering techniques to render a raytraced image.
I decided to rewrite the raytracer entirely in Crystal, a statically typed language that compiles to native, which in and of itself would massively boost performance. While doing so, I researched more rendering techniques like refraction, Blinn-Phong shading, lighting, mesh importing, normal maps, skyboxes, and more.
While the Crystal version of this project supports quadtree optimization and brick importing, I heavily moved away from it to support rendering out to a standard PNG as this iteration was capable of rendering much larger image resolutions in a fraction of the time. I implemented techniques like supersampling to experiment with high-quality images that shoot multiple rays per pixel.
Below is the most highly detailed and expensive render this raytracer has ever produced, at 1080p with 16 rays per pixel.
The following scene was rendered in 4K. This render took 3 minutes and 22 seconds.
This scene was rendered in 1080p. It is a demonstration of the OBJ mesh importer and renderer. The image depicts the render after being imported back in-game.
This is a screenshot from my development environment of an early demo on lighting and normal maps. On the left is the scene built in Brickadia, and on the right is a small render of the scene.
Experimental soft shadows. First, a soft shadow accuracy is picked (we will call it
n). We cast
rays towards various parts along the surface of the light. The strength of the shadow is
num rays hit / n. Supersampling can be used to denoise these results, but it was not used here.