A C++ implementation of super fast 3D image compression using octrees, with OpenGL visualization.
|
Figure 1: Octree layers with coloured leaf 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.
More Examples
|
Figure 1: Teapot - layers (4,000 vertices) |
Figure 2: Teapot - complete (4,000 vertices) |
|
Figure 3: Horse - layers (50,000 vertices) |
Figure 4: Horse - complete (50,000 vertices) |
|
Figure 5: Dragon - layers (125,000 vertices) |
Figure 6: Dragon - complete (125,000 vertices) |
Local Setup
Dependencies
- C++17 compiler (
g++orclang++) - CMake 3.10+
- OpenGL 4.6
- GLFW3
- GLM
- GLAD (OpenGL loader)
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