Cubica: a toolkit for subspace deformations


Cubica Usage Instructions

Cubica uses a toolchain approach, where a separate program is built for each individual task, and the results are then strung together. Unix, for example, is a famous version of this approach. The canonical usage example will be the Armadillo example from the SCA 2011 paper, which what is pictured at the top of this page.

The following chain of commands should successfully create and run an articulated, subspace version of that model. All of the commands are called from the top-level cubica-1.0 directory.

./bin/OdeIsoStuffer ./cfg/ode.armadillo.cfg

This calls an implementation of the Isosurface Stuffing paper to generate a tetrahedral mesh from a triangle mesh. The triangle mesh path and triangle mesh name parameters in the config file ode.armadillo.cfg tell it the location of the triangle mesh, and the output path parameter tells it where to place the final tetrahedral mesh. A GL window will pop up when the program is complete. Press 'q' to make the window quit.

./bin/OdeTetViewer ./cfg/ode.armadillo.cfg

This will read in the positions of the bones of a ragdoll skeleton, based on the pose path parameter in the config file. It will assume that the first skeleton in that directory is the skeleton rest pose. The tetrahedra that lie along the skeleton bones will then be constrained to move with those bones. A new tetrahedral mesh with the constrained tetrahedral will be output to the output path.

./bin/ArpackLMA ./cfg/ode.armadillo.cfg

This will perform a linear modal analysis (LMA) on the tetrahedral mesh and compute the eigenvectors and eigenvalues of the stiffness matrix at the mesh's rest pose. These quantities will later be added to the subspace deformation basis and allow for richer dynamics. They are also a way of computing a subspace basis for a mesh without having to compute any actual simulation data. The eigensystem will be output to the output path.

./bin/ModalDerivatives ./cfg/ode.armadillo.cfg

This computes higher order modes, the derivatives of the LMA modes, to further enrich the basis. See Barbic and James, 2005 for more details. The results are again saves to output path.

./bin/OdePoseSpaceSampler ./cfg/ode.armadillo.cfg

This reads in a set of 100 random skeleton poses from pose data, and performs a full non-linear quasistatic finite element solve to determine what deformations would occur given each skeleton pose. The results of each solve are then saved to data path. This is by far the most time-consuming part of the toolchain. However, since the solve for each pose is totally independent, the computation can be trivially parallelized. OdePoseSpaceSampler accepts range parameters in the form of OdePoseSpaceSampler (start pose #) (end pose #). So, on a two-core system, running ./bin/OdePoseSpaceSampler ./cfg/ode.armadillo.cfg 0 50 and ./bin/OdePoseSpaceSampler ./cfg/ode.armadillo.cfg 50 100 would deploy half of the solves to one core, and the other half to the other.

./bin/OdePartitioner ./cfg/ode.armadillo.cfg

This will partition the tetrahedral mesh into "body parts" that can each be simulated efficiently. The partitions will be saved to output path.

./bin/OdePoseLMACubatureGenerator ./cfg/ode.armadillo.cfg

This combines the results of ArpackLMA, ModalDerivatives, and OdePoseSpaceSampler to compute the final subspace deformation model. It distributes the results of all three of those programs to each body part, and then runs Principal Component Analysis (PCA) on the resulting sets to obtain final, per-body part subspace bases. A cubature scheme, as described in our SIGGRAPH Asia 2008 paper, is then computed for each body part so that the internal material forces for each body part can be computed efficiently at runtime. The results are saved to output path.

./bin/OdePrecomputeSandwiches ./cfg/ode.armadillo.cfg

This program precomputes the rank-3 tensor, the Fast Sandwich Transform described in our SCA 2011 paper, and stores it in output path. Coupling forces need to be introduced between body parts so that unsightly, non-physical cracks do not form between the parts. This tensor allows these forces to be computed efficiently at runtime.

./bin/OdeCubatureViewer ./cfg/ode.armadillo.cfg

This produces the final results for the Armadillo demo. You should see an Armadillo falling between two balconied walls, as in the SCA 2011 video.

Finally, here are all of the commands lumped together, so you can cut and paste them into a script:

./bin/OdeIsoStuffer ./cfg/ode.armadillo.cfg
./bin/OdeTetViewer ./cfg/ode.armadillo.cfg
./bin/ArpackLMA ./cfg/ode.armadillo.cfg
./bin/ModalDerivatives ./cfg/ode.armadillo.cfg
./bin/OdePoseSpaceSampler ./cfg/ode.armadillo.cfg
./bin/OdePartitioner ./cfg/ode.armadillo.cfg
./bin/OdePoseLMACubatureGenerator ./cfg/ode.armadillo.cfg
./bin/OdePrecomputeSandwiches ./cfg/ode.armadillo.cfg
./bin/OdeCubatureViewer ./cfg/ode.armadillo.cfg


Questions You May Have
  • Why does ArpackLMA crash or give me a series of mmap errors?

    The mesh generated by ./cfg/ode.armadillo.cfg is quite high resolution. If your system does not have enough memory, you will encounter this error. You can instead try running the ./cfg/ode.armadillo.medium.cfg or ./cfg/ode.armadillo.small.cfg files provided in the distribution. The only difference is that the bcc res parameter in the config files have been set lower, so the underlying grid that the Isosurface Stuffer uses will be coarser. I ran the high-res version successfully on a Mac Pro with 32 GB RAM, and the medium and low resolutions on a MacBook Pro with 8 GB RAM.

  • How do I author new ragdoll motions?

    The ragdoll motions were computed using ODE. The exact files used to compute the randomized poses and the ragdoll motions are provided in cubica-1.0/projects/ODE. You can generate new ragdoll data by modifying these files and building them against ODE. Note that these will dump the ragdoll data out to cubica-1.0/projects/ODE/data. It is your responsibility to copy these files to the correct path so that Cubica sees them. In the case of the Armadillo model, this path would be cubica-1.0/data/armadillo.ragdoll.teeth/.

  • What is the vertex and face ordering of the tetrahedral meshes in Cubica?

    A PDF containing these orderings can be found here. Print out the PDF, and fold it into a tetrahedron. It will tell you the vertex and face indices, as well as the winding order of each face.


Cubica was written by Theodore Kim, with contributions from Doug James, Steven An, Jeff Chadwick, and Alan Bandurka.

This work was supported in part by the National Science Foundation (CAREER-0430528, EMTCompBio-0621999), the National Institutes of Health (NIBIB/NIH R01EB006615), NSERC (Many-core Physically Based Simulations), the Alfred P. Sloan Foundation, and donations from Intel, Pixar, and Autodesk.