All Projects → Forceflow → Cuda_voxelizer

Forceflow / Cuda_voxelizer

Licence: mit
CUDA Voxelizer to convert polygon meshes into annotated voxel grids

Projects that are alternatives of or similar to Cuda voxelizer

3dhop
3D Heritage Online Presenter
Stars: ✭ 89 (-70.23%)
Mutual labels:  models, graphics
Floor
A C++ Compute/Graphics Library and Toolchain enabling same-source CUDA/Host/Metal/OpenCL/Vulkan C++ programming and execution.
Stars: ✭ 166 (-44.48%)
Mutual labels:  graphics, cuda
Game Programmer Study Notes
⚓ 我的游戏程序员生涯的读书笔记合辑。你可以把它看作一个加强版的Blog。涉及图形学、实时渲染、编程实践、GPU编程、设计模式、软件工程等内容。Keep Reading , Keep Writing , Keep Coding.
Stars: ✭ 6,050 (+1923.41%)
Mutual labels:  graphics
Rpt
A physically-based path tracer
Stars: ✭ 296 (-1%)
Mutual labels:  graphics
Deep Diamond
A fast Clojure Tensor & Deep Learning library
Stars: ✭ 288 (-3.68%)
Mutual labels:  cuda
Pytorch Liteflownet
a reimplementation of LiteFlowNet in PyTorch that matches the official Caffe version
Stars: ✭ 281 (-6.02%)
Mutual labels:  cuda
Open quadtree mapping
This is a monocular dense mapping system corresponding to IROS 2018 "Quadtree-accelerated Real-time Monocular Dense Mapping"
Stars: ✭ 292 (-2.34%)
Mutual labels:  cuda
Sourced
Tiny framework for building models with the event sourcing pattern (events and snapshots).
Stars: ✭ 278 (-7.02%)
Mutual labels:  models
Luxor.jl
Simple drawings using vector graphics; Cairo "for tourists!"
Stars: ✭ 293 (-2.01%)
Mutual labels:  graphics
Mojs
The motion graphics toolbelt for the web
Stars: ✭ 17,189 (+5648.83%)
Mutual labels:  graphics
Depthinverseprojection
An example showing how to inverse-project depth samples into the view/world space in Unity.
Stars: ✭ 296 (-1%)
Mutual labels:  graphics
Drawio Desktop
drawio-desktop is a diagramming and whiteboarding desktop app based on Electron that wraps the core draw.io editor.
Stars: ✭ 24,780 (+8187.63%)
Mutual labels:  graphics
Djv
Professional media review software for VFX, animation, and film production
Stars: ✭ 282 (-5.69%)
Mutual labels:  graphics
Ffmpeg Build Script
The FFmpeg build script provides an easy way to build a static FFmpeg on OSX and Linux with non-free codecs included.
Stars: ✭ 290 (-3.01%)
Mutual labels:  cuda
Bansheeengine
Modern C++14 game engine with Vulkan support, fully featured editor and C# scripting
Stars: ✭ 2,906 (+871.91%)
Mutual labels:  graphics
Deep High Resolution Net.pytorch
The project is an official implementation of our CVPR2019 paper "Deep High-Resolution Representation Learning for Human Pose Estimation"
Stars: ✭ 3,521 (+1077.59%)
Mutual labels:  cuda
Photosketch
Code for Photo-Sketching: Inferring Contour Drawings from Images 🐶
Stars: ✭ 278 (-7.02%)
Mutual labels:  graphics
Ggeditor
A visual graph editor based on G6 and React
Stars: ✭ 3,220 (+976.92%)
Mutual labels:  graphics
Fast Human Pose Estimation.pytorch
Official pytorch Code for CVPR2019 paper "Fast Human Pose Estimation" https://arxiv.org/abs/1811.05419
Stars: ✭ 290 (-3.01%)
Mutual labels:  cuda
Star
ECCV2020 - Official code repository for the paper : STAR - A Sparse Trained Articulated Human Body Regressor
Stars: ✭ 296 (-1%)
Mutual labels:  graphics

Build Status Donate

cuda_voxelizer v0.4.10

A command-line tool to convert polygon meshes to (annotated) voxel grids.

  • Supported input formats: .ply, .off, .obj, .3DS, .SM and RAY
  • Supported output formats: .binvox, .obj, morton ordered grid
  • Requires a CUDA-compatible video card. Compute Capability 2.0 or higher (Nvidia Fermi or better).
    • Since v0.4.4, the voxelizer reverts to a (slower) CPU voxelization method when no CUDA device is found

Usage

Program options:

  • -f <path to model file>: (required) A path to a polygon-based 3D model file.
  • -s <voxel grid length>: The length of the cubical voxel grid. Default: 256, resulting in a 256 x 256 x 256 voxelization grid. The tool will automatically select the tightest cubical bounding box around the model.
  • -o <output format>: The output format for voxelized models, default: binvox. Output files are saved in the same folder as the input file.
    • binvox: A binvox file (default). Can be viewed using viewvox.
    • obj: A mesh containing actual cubes (made up of triangle faces) for each voxel.
    • obj_points: A mesh containing a point cloud, with a vertex for each voxel. Can be viewed using any compatible viewer that can just display vertices, like Blender or Meshlab.
    • morton: a binary file containing a Morton-ordered grid. This is a format I personally use for other tools.
  • -cpu: Force voxelization on the CPU instead of GPU. For when a CUDA device is not detected/compatible, or for very small models where GPU call overhead is not worth it. This is done multi-threaded, but will be slower for large models / grid sizes.
  • -thrust : Use Thrust library for copying the model data to the GPU, for a possible speed / throughput improvement. I found this to be very system-dependent. Default: disabled.
  • -solid : (Experimental) Use solid voxelization instead of voxelizing the mesh faces. Needs a watertight input mesh.

Examples

cuda_voxelizer -f bunny.ply -s 256 generates a 256 x 256 x 256 binvox-based voxel model which will be stored in bunny_256.binvox.

cuda_voxelizer -f torus.ply -s 64 -o obj -thrust -solid generates a solid (filled) 64 x 64 x 64 .obj voxel model which will be stored in torus_64.obj. During voxelization, the Cuda Thrust library will be used for a possible speedup, but YMMV.

output_examples

Building

The build process is aimed at 64-bit executables. It might be possible to build for 32-bit as well, but I'm not actively testing/supporting this. You can build using CMake, or using the provided Visual Studio project. Since November 2019, cuda_voxelizer also builds on Travis CI, so check out the yaml config file for more Linux build support.

Dependencies

The project has the following build dependencies:

Build using CMake (Windows, Linux)

After installing dependencies, do mkdir build and cd build, followed by:

For Windows with Visual Studio 2019:

cmake -A x64 -DTrimesh2_INCLUDE_DIR:PATH="path_to_trimesh2_include" -DTrimesh2_LINK_DIR:PATH="path_to_trimesh2_library_dir" -DCUDA_ARCH:STRING="your_cuda_compute_capability" .. 

For Linux:

cmake -DTrimesh2_INCLUDE_DIR:PATH="path_to_trimesh2_include" -DTrimesh2_LINK_DIR:PATH="path_to_trimesh2_library_dir" -DCUDA_ARCH:STRING="your_cuda_compute_capability" .. 

Where your_cuda_compute_capability is a string specifying your CUDA architecture (more info here). For example: -DCUDA_ARCH:STRING=61 or -DCUDA_ARCH:STRING=60.

Finally, run

cmake --build . -j number_of_cores

Build using Visual Studio project (Windows)

A Visual Studio 2019 project solution is provided in the msvcfolder. It is configured for CUDA 11, but you can edit the project file to make it work with lower CUDA versions. You can edit the custom_includes.props file to configure the library locations, and specify a place where the resulting binaries should be placed.

    <TRIMESH_DIR>C:\libs\trimesh2\</TRIMESH_DIR>
    <GLM_DIR>C:\libs\glm\</GLM_DIR>
    <BINARY_OUTPUT_DIR>D:\dev\Binaries\</BINARY_OUTPUT_DIR>

Details

cuda_voxelizer implements an optimized version of the method described in M. Schwarz and HP Seidel's 2010 paper Fast Parallel Surface and Solid Voxelization on GPU's. The morton-encoded table was based on my 2013 HPG paper Out-Of-Core construction of Sparse Voxel Octrees and the work in libmorton.

cuda_voxelizer is built with a focus on performance. Usage of the routine as a per-frame voxelization step for real-time applications is viable. These are the voxelization timings for the Stanford Bunny Model (1,55 MB, 70k triangles).

  • This is the voxelization time for a non-solid voxelization. No I/O - from disk or to GPU - is included in this timing.
  • CPU voxelization time is heavily dependent on how many cores your CPU has - OpenMP allocates 1 thread per core.
Grid size GPU (GTX 1050 TI) CPU (Intel i7 8750H, 12 threads)
64³ 0.2 ms 39.8 ms
128³ 0.3 ms 63.6 ms
256³ 0.6 ms 118.2 ms
512³ 1.8 ms 308.8 ms
1024³ 8.6 ms 1047.5 ms
2048³ 44.6 ms 4147.4 ms

Notes / See Also

  • The .binvox file format was created by Michael Kazhdan.
    • Patrick Min wrote some interesting tools to work with it:
      • viewvox: Visualization of voxel grids (a copy of this tool is included in cuda_voxelizer releases)
      • thinvox: Thinning of voxel grids
    • binvox-rw-py is a Python module to interact with .binvox files
  • Thanks to conceptclear for implementing solid voxelization
  • Zarbuz's FileToVox looks interesting as well
  • If you want a good customizable CPU-based voxelizer, I can recommend VoxSurf.
  • Another hackable voxel viewer is Sean Barrett's excellent stb_voxel_render.h.
  • Nvidia also has a voxel library called GVDB, that does a lot more than just voxelizing.

Todo / Possible future work

This is on my list of nice things to add. Don't hesistate to crack one of these yourself and make a PR!

  • Noncubic grid support
  • Memory limits test
  • Output to more popular voxel formats like MagicaVoxel, Minecraft
  • Implement partitioning for larger models
  • Do a pre-pass to categorize triangles
  • Implement capture of normals / color / texture data

Citation

If you use cuda_voxelizer in your published paper or other software, please reference it, for example as follows:

@Misc{cudavoxelizer17,
author = "Jeroen Baert",
title = "Cuda Voxelizer: A GPU-accelerated Mesh Voxelizer",
howpublished = "\url{https://github.com/Forceflow/cuda_voxelizer}",
year = "2017"}

If you end up using cuda_voxelizer in something cool, drop me an e-mail: mail (at) jeroen-baert.be

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].