← back

3D Octree Compression

Octree compression for 3D objects, up to 99% smaller

C++ · OpenGLcode ↗

A C++ implementation of super fast 3D image compression using octrees, with OpenGL visualization.

bunny_gif
Figure 1: Octree layers with coloured leaf nodes
bunny_all_nodes
Figure 2: Complete octree with coloured leaf nodes

How it Works

Octree compression works by recursively subdividing a 3D image into eight smaller cubes (octants). If all voxels within an octant have similar or identical values, the region is represented by a single node instead of individual voxels. This reduces the amount of data by efficiently summarizing uniform areas, allowing for compact storage and faster processing.

image

More Examples

teapot
Figure 1: Teapot - layers (4,000 vertices)
teapot_full
Figure 2: Teapot - complete (4,000 vertices)
horse
Figure 3: Horse - layers (50,000 vertices)
horse_full
Figure 4: Horse - complete (50,000 vertices)
dragon
Figure 5: Dragon - layers (125,000 vertices)
dragon_full
Figure 6: Dragon - complete (125,000 vertices)

Local Setup

Dependencies

Install on Ubuntu/WSL

sudo apt update
sudo apt install build-essential cmake
sudo apt install libglfw3-dev libglm-dev
sudo apt install libgl1-mesa-dev libglu1-mesa-dev

Setup

Clone the repository

git clone https://github.com/koralkulacoglu/3d-octree-compression.git
cd 3d-octtree-compression

Generate GLAD files

python3 -m venv venv
source venv/bin/activate
pip install glad
python -m glad --profile=core --api=gl=4.6 --generator=c --out-path=.

Build

mkdir build && cd build
cmake ..
make -j

Run

cd bin
./OctreeViewer

Rebuild

cd build
rm -rf * && cmake .. && make -j