Ray Painter

3D renderer (raytracer) written from scratch in C++

Overview link icon

This project features a 3D raytracing renderer written from scratch in C++, with unit testing throughout. It allows the construction of scenes and art using geometric primitives as well as imported 3D object files.

The library is functional and has its base set of features complete, with more in the works. A GUI application is being built around it to make a user-friendly experience for creating nice artwork with a familiar “graphics editing” style application interface.

LinkedInTable of Contents

Features link icon

The current featureset includes

References link icon

Ray Painter began as my attempt at the Raytracer Challenge by Jamis Buck. This is one of the most fun programming texts I’ve worked through. The theory is presented, along with a set of language-agnostic test cases, and you are left to implement the application with no other hints from the author. Highly recommend picking up a copy if this stuff interests you!

Source code link icon

The libraytracer source code can be found at my Git repository.

Example renders link icon

Below are some of my favourite renders that have come out of playing with the library during development.

Advanced surface material properties link icon

A demo scene of advanced surface material properties including transparency, refraction, and reflectivity.

Composite shapes link icon

Using set operations to perform unions and intersections with multiple shapes.

Generative textures link icon

The latest addition is getting surface normal textures working, in order to produce generative textures with Perlin/Simplex noise. The results are pretty cool.

Theory link icon

Raytracing is a 3D graphics technique used to render scenes with realistic looking lighting and other effects which simulate the way 3D objects and lighting behave in the world around us.

It’s not a new technique, having its roots in computing as early as the 1960s. I claim zero responsibility for its invention or innovation! Nevertheless, it’s a very fun way to learn about 3D graphics and to embolden linear algebra programming techniques.

\ Wikipedia says it better than I can

The ray-tracing algorithm builds an image by extending [casting] rays [vectors] into a scene and bouncing them off surfaces and towards sources of light to approximate the color value of pixels (wikipedia)

It turns out that you can do a lot of interesting visual effects with the ray while it travels along its path, and this is the idea of a raytracing renderer!

For more detail link icon

I won’t repeat everything Wikipedia says on the subject so check out the source code for more detail if you haven’t already!

This project writeup will be extended as more features and the GUI are developed!