Since releasing the video on my Houdini based Voxel raytracer I continue to think about the idea of making it a standalone renderer. A few weeks ago I started to look at MagicaVoxel’s *.vox file format so eventually anybody could create their scenes in MagicaVoxel and render them with my renderer (which I’m still searching a name for) and the unique way it renders voxels. Luckily the format is well documented so with a bit of elbow grease and python I succeeded:
left: screenshot of the .vox file in MV – right the same .vox file rendered with my stand-alone renderer
But this small step did more than serve as a proof of concept: it showed me the potential of creating a renderer and scene structure from scratch.
In Houdini I used points to store the voxel data, which the software can operate in parallel on, but still it’s necessary to iterate over every existing point (when raytracing for example). Implementing acceleration structures in Houdini is very hard (though not impossible – I use one for choosing between multiple lights).
Because they seem a fitting structure for voxels, I chose octrees right from the start for my renderer.
octree schematic – only necessary cubes are searched for children/voxels (picture from wikipedia)
Octrees are binary trees in three dimensions – each volume (box) is separated into eight boxes of half the original size. Then each one of those can be separated again etc. until a „leaf node“ is reached – the voxel. Searching these is very efficient! For example instead of testing a ray against every voxel in a scene, initially only eight boxes have to be tested. In the next step only the children of the „best box“ are tested again, potentially skipping 7/8 of voxels in the scene, speeding up the process immensely.
Summary (October 2020)
While I don’t have any lighting or shading features implemented yet, it is very encouraging to see the possibilities a stand-alone program allows me to do. Currently all of this is still happening in python (besides vex the only language that I know so far), but I am flirting with the idea of getting into C# or C++ eventually, which would greatly speed up the render. Besides that I am also learning more about physically based rendering (which my first approach was aspiring to be, at best) so as usual, don’t hold your breath ; ).