Giter VIP home page Giter VIP logo

subdivisionskinning's Introduction

Skinning Catmull-Clark Subdivision Surfaces

This code implements the subdivision surface portion of our SIGGRAPH Asia 2014 paper Skinning Cubic Bézier Splines and Catmull-Clark Subdivision Surfaces by Songrun Liu, Alec Jacobson, and Yotam Gingold. The implementation consists of a library and a GUI for posing subdivision surfaces with skeletons.

Compiling

This code depends on:

  • OpenSubDiv 2.x
  • libigl
    • included sub-dependencies:
      • AntTweakBar
      • embree
      • tetgen
      • yimg
      • tetgen
    • not included sub-dependencies:
      • CGAL (e.g. brew install cgal)
    • MOSEK (optional)
  • eigen (e.g. brew install eigen)

Academics can install MOSEK for free, but this is optional. The CMakeFiles define the flag -DIGL_NO_MOSEK to disable Mosek support when building this project.

Download and compile the OpenSubdiv 2.x dependency

git clone https://github.com/PixarAnimationStudios/OpenSubdiv.git
(
    cd OpenSubdiv
    &&
    git reset --hard 25cee425f32758a7e0e8812da628007a8eeecce6
    &&
    mkdir build
    &&
    cd build
    &&
    cmake -DCMAKE_BUILD_TYPE=Release ..
    &&
    make
    )

To compile using gcc on Mac OS X, consider replacing the last two commands with:

cmake -DCMAKE_BUILD_TYPE=Release -DNO_EXAMPLES=1 -DNO_GCD=1 -DNO_CUDA=1 ..
&&
make osd_static_cpu

If you installed opensubdiv somewhere other than this directory, then create a symbolic link to it. For example,

ln -s ~/Documents/OpenSubdiv OpenSubdiv

Download libigl and compile the third-party dependencies

git clone https://github.com/libigl/libigl.git
( cd libigl/external/AntTweakBar/src && make )
( cd libigl/external/embree && mkdir build && cd build && cmake .. && make )
( cd libigl/external/tetgen && make )
( cd libigl/external/yimg && make )

Compile this project (libsubdivision_skinning and subdivgui)

mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make
cd ..

Using the library

The library is compiled into

build/lib/libsubdivision_skinning.{a,dylib}

The library interface is exposed through a simple pure-C interface. The header file describing the functions is in

lib/subdivision_skinning_wrapper.h

A simple usage example can be found in

lib/subdivision_skinning_wrapper_test.cpp

Running the included GUI

Prepare a coarse subdivision surface cage as a .obj file cage.obj and a skeleton using the .tgf file format of libigl skeleton.tgf. You could use the libigl/examples/skeleton-builder/ example to build your skeleton with a GUI.

Run this program for the first time to compute bounded biharmonic weights:

./build/subdivgui/subdivgui cage.obj skeleton.tgf [computation_level evaluation_level [weights.dmat]]

The computation and evaluation level parameters specify the (integer) level of subdivision to use when computing skinning weights and when evaluating the energy described in the paper. Skinning weight computation can be lengthy, so computation level is allowed to be a smaller number than evaluation level. The defaults are 1 and 3, respectively. For very coarse subdivision control meshes, 2 and 4 are more sensible.

You can run the included torus example:

./build/subdivgui/subdivgui subdivgui/torus{.obj,.tgf} 2 4 subdivgui/torus-weights.dmat

This will attempt to clean the model by meshing self-intersections, and filling holes. Then it will compute a tetrahedral mesh of the surface's solid volume. Finally it will compute bounded biharmonic weights for each skeleton bone. When finished the weights will be saved to the provided path weights.dmat in the .dmat file format of libigl.

The GUI will now start and you may follow the standard output instructions to interact and change visualization settings.

Subsequent runs of

./build/subdivgui/subdivgui cage.obj skeleton.tgf computation_level evaluation_level weights.dmat

will load weights from weights.dmat rather than recompute them. (Computation and evaluation level must be the same between runs.)

subdivisionskinning's People

Contributors

alecjacobson avatar yig avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

subdivisionskinning's Issues

About the CGAL dependency

How big is the dependency on CGAL? It has GPL license, so, after building your code, the GPL affects all the project and derived works. If that dependency could be removed, it would be great.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.