Ray Tracing with Voxels in C++ Series – Part 1

submited by
Style Pass
2024-05-10 13:30:07

In this series we build a physically based renderer for a dynamic voxel world. From ‘Whitted-style’ ray tracing with shadows, glass and mirrors, we go all the way to ‘unbiased path tracing’ – and beyond, exploring advanced topics such as reprojection, denoising and blue noise. The accompanying source code is available on Github and is written in easy-to-read ‘sane C++’.

In this first article we will use the bare-bones template and add some color to it, as well as lights, and shadows. Shadows will be calculated using rays to the light sources. If these concepts are already clear to you, feel free to skip to the challenges at the end of the article, or to the next article (once it is released): Each article starts with the same template code, so you can jump in at any point.

For this series we will use a somewhat unusual starting point: a ready-made template that renders a basic image using ray tracing. The scene is a small voxel world, procedurally generated. You can find this template in its github repo. It runs out-of-the-box on a Windows system: just open the .sln file in Microsoft Visual Studio Community Edition and press F5 to build and run it.

Leave a Comment