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