/subd-and-conquer

Primary LanguageC++MIT LicenseMIT

SubD and Conquer

(WIP) Study and implementation of subdivision techniques. Currently implemented Catmull-Clark subdivision surface for 2-manifold meshes with arbitrary topology, with or without boundaries and holes. Now working on table driven subdivision schemes.

In parallel to table driven subdivision implementation, I'm working on some rendering features for the OpenGL side. Currently, I'm working on the triangulation of the quads (since after one Catmull-Clark subdivision step, all the triangles and n-gons will be quadrangulated) to send the data to the GPU as triangles.

While I work on my custom OpenGL renderer for this task, below are presented some outputs generated by Polyscope to verify that the Catmull-Clark subdivision is working correctly. As control mesh, it was used a default cube (quad faces), a tetrahedron (triangular faces) and a dodecahedron (pentagonal faces), all created on Blender, demonstrating that the method works on meshes with n-gons. (By the way, here is a very nice way to create dodecahedrons on Blender without add-ons!). The left column is the result of my subdivision implementation; right column is the subdivision generated on Blender (with the "Use Limit Surface" option disabled), saved as a Wavefront file and imported to Polyscope. In all cases, the control mesh is displayed as a transparent surface.

Scene Scene
Scene Scene
Scene Scene

Features

  • Standard Catmull-Clark subdivision of 2-manifold closed meshes with arbitrary topology [1].

  • Catmull-Clark subdivision with DeRose modified rules for boundary edges and vertices [2, 3].

  • Loading of general polygon meshes using tinyobjloader

  • More things soon

Gallery

TODO

References

[1]: Catmull, E., & Clark, J. (1978). Recursively generated B-spline surfaces on arbitrary topological meshes. Computer-aided design, 10(6), 350-355.

[2]: DeRose, T., Kass, M., & Truong, T. (1998, July). Subdivision surfaces in character animation. In Proceedings of the 25th annual conference on Computer graphics and interactive techniques (pp. 85-94).

[3]: De Goes, F., Desbrun, M., Meyer, M., & DeRose, T. (2016). Subdivision exterior calculus for geometry processing. ACM Transactions on Graphics (TOG), 35(4), 1-11. The Subdivision Rules are provided in the supplemental materials.

Build

Build Instructions

This project uses CMake as build system generator. It's necessary to have it installed on your system. Additionaly, git submodules is used to add vcpkg as a dependency manager and to add geometry-central as a dependency. Execute the following commands on the command-line to clone, configure and build the project:

# If you hadn't clone the repository yet:
git clone --recurse-submodules https://github.com/math-araujo/subd-and-conquer.git
# NOTE: Did you remember to clone recursively using --recurse-submodules?

cd subd-and-conquer

# On Windows + MSVC
cmake --preset=msvc

cmake --build build --config Release

# On Unix
cmake --preset=default-unix

cmake --build build

In case you forgot to clone the repository recursively, run the following command with the command line open on the root of the repository:

git submodule update --init --recursive

Feel free to open an issue should any problem arise.

Failure to use FetchContent Usually I don't use git submodules and use CMake FetchContent module, even for downloading and building vcpkg. However, an enigmatic error arised when trying to use FetchContent to download both vcpkg **and** geometry-central. The configuration was successfull using either one, but failed when I tried to use FetchContent for both repositories simultaneously. I'm still investigating this issue, but for the time being I settled with using both vcpkg and geometry-central through git-submodules.

Controls

  • A/S/D/W Key - Move left/backward/right/forward

  • Q/E Key - Move down/up

  • F Key - Switch between free FPS movement and locked FPS movement

  • P Key - Switch between polygon mode and wireframe mode

  • ESC Key - Exit application

  • Left Mouse Button - Hold and move mouse to look-around when in locked FPS mode

LICENSE

All the code is released under MIT License. Check the LICENSE file on this repository for details.