This repository provides a library for fast subdivision of polygonal surfaces. Currently it supports Catmull-Clark and Loop subdivision, and has both CPU and GPU backends with parallel implementations. For most use cases, subdivision is real-time. It is the implementation of the paper
- A Halfedge Refinement Rule for Parallel Loop Subdivision, Eurographics 2022 short paper, by Kenneth Vanhoey and Jonathan Dupuy.
and an alternate implementation (for the official reference see here) of
- A Halfedge Refinement Rule for Parallel Catmull-Clark Subdivision, HPG 2021, by Jonathan Dupuy and Kenneth Vanhoey
Apart from the submodules folder, the code from this repository is released with the CC-BY licence. If you use this work, please cite:
@inproceedings {10.2312:egs.20221028,
booktitle = {Eurographics 2022 - Short Papers},
editor = {Pelechano, Nuria and Vanderhaeghe, David},
title = {{A Halfedge Refinement Rule for Parallel Loop Subdivision}},
author = {Vanhoey, Kenneth and Dupuy, Jonathan},
year = {2022},
publisher = {The Eurographics Association},
ISSN = {1017-4656},
ISBN = {978-3-03868-169-4},
DOI = {10.2312/egs.20221028}
}Clone the repository and all its submodules using the following command:
git clone --recursive git@github.com/kvanhoey/ParallelHalfedgeSubdivision.gitIf you accidentally omitted the --recursive flag when cloning the repository you can retrieve the submodules like so:
git submodule update --init --recursiveThis is a CMake project. The root folder contains the main CMakeLists.txt file. Tested on Window 10 (Visual Studio 2019) and Linux Ubuntu 18.04 (see config file for dependencies).
To compile manually:
mkdir build/ # create compilation folder
cd build/ # move into it
cmake .. # Call cmake on the folder containing CMakeLists.txt
make [<name_of_executable>] # Compile one or all of the executablesBy default, documentation is not compiled. Please set the CMake variable BUILD_DOC to ON using ccmake or by directly editing CMakeLists.txt before hitting cmake and make doc, which will generate the html/index.html file.
The lib/ folder contains the library files: see lib/README.md
The root folder contains several usage examples that do the following:
catmull-clark_cpuCatmull-Clark subdivision using the CPU backendcatmull-clark_gpuCatmull-Clark subdivision using the GPU backendloop_cpuLoop subdivision using the CPU backendloop_gpuLoop subdivision using the GPU backendstatsprovide statistics of a loaded Mesh.
Notes:
- The CPU backend relies on OpenMP for parallelization. By default, it uses as many threads as there are CPU cores available. This can be altered by setting the environment variable
OMP_NUM_THREADSto another value. For example:export OMP_NUM_THREADS=2 - The GPU backend relies on OpenGL (library provided under
lib/gpu_dependencies). Shader files are loaded using relative paths, so the executable has to be launched from a subfolder of the root folder, e.g.,build/. - All executables take for input an OBJ file (note: for Loop subdivision, the mesh should be triangle-only) and a subdivision depth.
- The resulting subdivision is written to disk as an OBJ file. It is triangular for Loop subdivision, and quad-only for Catmull-Clark subdivision.
The meshes folder contains example meshes that can be used as inputs.
The doc folder contains a doxygen file to generate documentation.
