explaingit

charliecallahan/charlies_voxel_octree

Analysis updated 2026-05-18

30C++Audience · developerComplexity · 4/5LicenseSetup · moderate

TLDR

A C++ library that stores 3D voxel shapes in a compact octree and can voxelize triangle meshes with optional GPU acceleration.

Mindmap

mindmap
  root((repo))
    What it does
      Sparse bit octree storage
      Mesh to voxel conversion
      GPU accelerated classification
    Tech stack
      C++
      OpenCL
      tinyBVH
    Use cases
      Voxelize an STL model
      Embed voxel storage in a C++ app
      Serialize voxel data to a file
    Audience
      Graphics developers
    Performance
      Sub second low res voxelization
      GPU path for high res

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Convert an STL triangle mesh into a compact voxel octree file.

USE CASE 2

Embed a memory efficient voxel data structure inside a C++ game or graphics engine.

USE CASE 3

Serialize and load large voxel worlds quickly using raw memory pool dumps.

USE CASE 4

Speed up high resolution mesh voxelization using an available GPU via OpenCL.

What is it built with?

C++OpenCLtinyBVHMake

How does it compare?

charliecallahan/charlies_voxel_octreeauthrequest/freeloaderadiao1973/librobotbagfix
Stars303031
LanguageC++C++C++
Setup difficultymoderatehardhard
Complexity4/55/54/5
Audiencedeveloperdeveloperops devops

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

GPU acceleration requires OpenCL headers and an available OpenCL device, otherwise it falls back to CPU.

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

In plain English

This is a C++ library for working with voxels, which are tiny 3D cubes used to represent solid shapes, similar to pixels but in three dimensions. It stores voxel data in a structure called a sparse bit octree, a tree shaped format that only records where solid material actually exists, so empty space costs almost no memory. Each leaf voxel takes as little as one bit, and there is also an 8 bit version available for storing extra information per voxel. Branch nodes point to their children using compact 32 bit indices into a memory pool rather than full pointers, which keeps memory use low and makes saving the whole structure to a file as simple as dumping that pool directly. The library's other major piece converts a triangle mesh, the kind of 3D model made of connected flat triangles, into this voxel format. It builds a bounding volume tree over the mesh using a library called tinyBVH, then classifies each candidate voxel as inside, outside, or crossing the mesh surface, subdividing the crossing ones further until it reaches the resolution you asked for. This classification step can run on the GPU using OpenCL for a large speed boost at high resolutions, or fall back to the CPU if OpenCL is not available or not wanted. A bundled command line tool called voxelize_stl takes an STL mesh file and writes out a binary voxel file, with options to set the voxel size, override the tree depth, or force the CPU path. The README shows a Stanford bunny model voxelized at two resolutions, with one finishing in under a tenth of a second and using 174 kilobytes, and the other taking about 8 seconds and using 2.8 megabytes, measured on a Mac M1 GPU. The project also shows a short code example for embedding the library directly in another C++ program. It requires a C++17 compiler, make, and curl to fetch its one dependency, with OpenCL as an optional extra for GPU acceleration. It is released under the MIT license.

Copy-paste prompts

Prompt 1
Show me how to build this project with OpenCL support enabled on Linux.
Prompt 2
Walk me through embedding VoxelOctree and MeshOctreeGen in my own C++ project.
Prompt 3
Explain how the sparse bit octree keeps memory usage low compared to a normal octree.
Prompt 4
Help me run voxelize_stl on my own STL file and choose a good cell size.

Frequently asked questions

What is charlies_voxel_octree?

A C++ library that stores 3D voxel shapes in a compact octree and can voxelize triangle meshes with optional GPU acceleration.

What language is charlies_voxel_octree written in?

Mainly C++. The stack also includes C++, OpenCL, tinyBVH.

What license does charlies_voxel_octree use?

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

How hard is charlies_voxel_octree to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is charlies_voxel_octree for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.