V-HACD Documentation

repository·master·Indexed 23 days ago

https://github.com/kmammou/v-hacd

Voxelized Hierarchical Approximate Convex Decomposition (V-HACD) is a library for decomposing 3D surfaces into near-convex parts for collision detection and 3D modeling. Version 4.0+ is a header-only C++ library. The documentation covers installation on Linux and Windows, integration as a header-only library, and tuning parameters for decomposition such as error threshold, voxel resolution, and hull counts.

Tokens
574
Snippets
2
Records
5
Agent score
32%

What's inside V-HACD

  1. Install V-HACD on Windows

    master

    To build V-HACD on Windows, navigate to the app directory, run CMake specifying the x64 platform, and then load the resulting solution file in your IDE.

    cd app
    cmake -DCMAKE_GENERATOR_PLATFORM=x64 CMakeLists.txt
  2. Install V-HACD on Linux

    master

    To build V-HACD on Linux, navigate to the app directory and use CMake to generate the build files and compile the project in Release mode.

    cd app
    cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
    cmake --build build
  3. Tune V-HACD decomposition parameters

    master

    V-HACD 4.0+ focuses on user-defined hull counts rather than finding a 'minimum solution'. You should specify the number of convex hulls that matches your design goals. The default is 32 hulls, which may be too high for simple shapes.

    For high-precision results (e.g., for machined parts with sharp angles), you can use the following CLI flags:

    • -e <value>: Error threshold (e.g., -e 0.01 for high accuracy).
    • -r <value>: Voxel resolution (e.g., -r 10000000 for high resolution).
    • -h <value>: Number of convex hulls (e.g., -h 128).
    • -d <value>: Maximum decomposition depth (e.g., -d 15). Note that higher depth values require a 64-bit build. A depth of 15 allows the algorithm to recurse much deeper but will significantly increase execution time.
  4. Integrate V-HACD as a header-only library

    master
    V-HACD version 4.0+ is a header-only library. To implement it in your C++ project, you must define ENABLE_VHACD_IMPLEMENTATION as 1 in exactly one .cpp file before including VHACD.h. There are no separate library files or additional .cpp files to compile or link.
  5. Reference: V-HACD 4.0 Parameter Changes

    master

    If porting from older versions of V-HACD, note the following changes to tuning parameters and API signatures:

    Old ParameterNew Parameter / Status
    m_concavitym_minimumVolumePercentErrorAllowed
    m_alphaRemoved
    m_betaRemoved
    m_projectHullVerticesm_shrinkWrap

    IUserCallback Update Signature Change: The Update function signature in IUserCallback has changed to:

    virtual void Update(const double overallProgress,
                        const double stageProgress,
                        const char* const stage, 
                        const char *operation) final