Large Scale Volume Editing, Saving, and Loading
July 2018-On Going

The goal of this project is for a user to be able to edit, load, and save volume data. The main issue is how to store the volume data. A simple way to store a volume is extending a 2D texture to a 3D texture. OpenGL has great support for 3D textures however, to have high levels of detail large resolutions are needed and texture sizes grow cubically so a 1024^3 texture is 1GB!
This is a 3D texture on the GPU and has a resolution of 512^3.
It occupies 536MB of memory if it were 1024^3 it would 4GB!
However, the user is only concerned with the interface between empty space and occupied space or the surfaces of the volume. This still grows a rate of N^2 but is much better! So, a simple optimization structure like an Octree or an N^3 tree can be used. Much of the early work of this project was focused on creating this optimization structure and is documented in this article.
This is a quadtree(2D analog of octree) where white indicates more detial
note how most of the image is dark and not needed to be represented.
This is an octree simulated by intercting a sphere recursively.
Brightness denotes the cost of the rays to be casted through the octree.
This is a GLSL shader I wrote in shadertoy.
Instead a different approach is used for this project. Signed distance fields can be used to create CSG models. A CSG model is nothing more than a series of solid operations like union, subtraction, and interstation. To make the models more organic interesting operations like smooth unions and noise functions are used. The only problem with this method is complex models could require thousands of operations for every intersection test!
So, to efficiently store the CSG model chunks are used. Each chunk represents a cube of space and has a limited number of objects in it. This then drastically reduces the number of objects to be tested. These chunks could also be in an octree allowing for variable sized chunks for efficient ray casting.