Skip to content

bigmat18/cuda-mesh-voxelization

Repository files navigation

CUDA Mesh Voxelization

1. Introduction

CUDA Mesh Voxelization is a C++/CUDA library and CLI for 3D mesh voxelization, CSG operations, and Signed Distance Field (SDF) computation on the GPU.
The project is designed for benchmarking, visualization, and manipulation of volumetric 3D data, with a particular focus on performance and extensibility.

Features

  • Mesh Voxelization: Converts 3D triangle meshes into solid or surface voxel grids.
  • CSG Operations: Supports union, intersection, and difference operations between voxelized meshes.
  • SDF Calculation: Computes the signed distance field using the Jump Flooding Algorithm (JFA).
  • CLI Application: Command-line interface for batch processing and benchmarking.
  • Benchmarking: Comparative analysis between sequential, OpenMP, and CUDA implementations.
  • Visualization: Exports voxel grids for analysis and plotting.

2. Papers, Libraries, and Requirements

Reference Papers and Algorithms

Libraries Used

  • cxxopts for CLI parsing
  • CMake as the build system

Software Requirements

  • C++: >= C++23
  • CUDA Toolkit: >= 12.0
  • CMake: >= 3.20
  • Compiler: GCC/Clang/MSVC with C++23 support

3. Installation and Usage

Installation

git clone https://github.com/<your-username>/cuda-mesh-voxelization.git
cd cuda-mesh-voxelization
git submodule update --init --recursive
cmake -S . -B build
cmake --build build --config Release

Basic Usage

Voxelize a mesh and export the result:

./build/Release/apps/cli/cli assets/bunny.obj -n 128 -e -t 2 -p 1 -s

Main options:

  • -n number of voxels per grid side
  • -e enable export
  • -t algorithm type (0 = sequential, 1 = naive, 2 = tiled, 3 = OpenMP)
  • -p CSG operation type (1 = union, 2 = intersection, 3 = difference)
  • -s compute SDF

For all available options:

./build/Release/apps/cli/cli -h

4. Results

Stanford Armadillo
64 voxels/side
Stanford Dragon
256 voxels/side
Stanford Bunny
128 voxels/side

Armadillo section (128 voxels), colored by SDF value. CSG section (Bimba ∪ Bunny, 64 voxels), colored by SDF value.

5. Benchmark and Performance Analysis

Voxelization Performance Charts


Bunny 3,510 faces

Bunny 56,172 faces

Bunny 168,516 faces

Bunny 337,032 faces

Bunny 674,064 faces

Bunny 1,348,128 faces

JFA Performance Charts


Implementations comparison

Stages comparison

About

GPU-accelerated pipeline for robust 3D mesh Boolean operations (CSG) using voxelized Signed Distance Fields (SDFs).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published