HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Geometry Capture Attributes

An important part of the character tools is the weighting of geometry to bones and then deforming the geometry when they move. The basic setup when capturing skin geometry to bone objects is via two sets of SOPs: the various Bone Capture SOPs and the Bone Deform SOP. When capturing the geometry, a set of capture attributes is produced. Then when the bones move, the Bone Deform SOP does it work according to these capture attributes along with the current positions of the bones.

In reality, Houdini does not capture geometry to Bone objects, but rather to the capture region primitives that are found in their geometry. Their transform is considered inside the Bone along with the Bone's world transform. Houdini supports multiple capture regions per bone although it is rare.

The capture attributes that are used by the Bone Deform SOP for bones are:

Note
The "boneCapture" point attribute encapsulates both the "pCapt" point data and the "pCaptPath" and "pCaptData" detail attributes from older versions.

The basic deformation algorithm is also described below.

boneCapture

This point index-pair float attribute is created by the various Bone Capture SOPs. It stores information on the capture regions and point weighting. The attribute is structured as a list of data about the capture regions and per point pairs of (capture region index, weight). The capture region index points into the paths provided by the pCaptPath property property.

Currently, Houdini maintains lists of the same length across all points, so there are frequently unused entries at the end of the attribute. These must be filled with (-1, -1) pairs.

Note
The (-1, -1) pairs must appear after all of the point attribute values.

The HDK_Sample::BouncyAgent example demonstrates how to set such an attribute using the AIF_IndexPair interface.

Capture Region Data

Index-pair attributes store information about capture regions in a list of objects, with properties stored for each object. Each capture region index points to one of these objects. Information about a capture region is stored in that object's property values.

The properties that are used by the Bone Deform SOP for bones are:

pCaptPath property

This string property is created by the various Bone Capture SOPs. It indicates the regions used in the capture process. Each entry consists of a path to the SOP relative to the value of the pCaptSkelRoot attribute followed by the corresponding primitive number in the SOP. This means that Houdini's capture system is actually a "capture region" system. It supports bone objects which contain more than one cregion primitive.

Indices from the pCapt attribute refer to the path values here.

pCaptData property

This float property is created by the various Bone Capture SOPs. It contains the rest transforms of the capture regions at the time of capturing. The pCaptData property property contains exactly 20 floats. The layout of the pCaptData for each region is as follows:

Offset
(float entries)
Description
0-15 4x4 row-major matrix to convert points from world space to the canonical rest transform space of the region. Note that point positions are intended to be left-multiplied onto the transform.
16 Top height of the region
17 Bottom height of the region
18 Ratio of (top x radius of tube)/(bottom x radius of tube) adjusted for orientation
19 Ratio of (top z radius of tube)/(bottom z radius of tube) adjusted for orientation

pCaptAlpha

This point float[1] attribute is created by the Capture Layer Paint SOP. It contains the painted alpha information and should be in the [0,1] range.

pCaptSkelRoot

This detail index (string) attribute is created by the various Bone Capture SOPs. It contains the parent node path of all entries in the pCaptPath property attribute. This can be an absolute or relative path. If it is a relative path, then it is relative to the SOP currently evaluating it.

pCaptFrame

This detail float[1] attribute is created by the various Bone Capture SOPs. It contains the rest frame at which the data was captured. This attribute is only added if the Use Capture Pose parameter is off. By default, this attribute is not created. If it does not exist, then the capture pose parameters on bones are used as the rest pose instead.

tubeCapt

This primitive float attribute is created by the Capture Region SOP for each cregion primitive. It stores the rest and animation transforms associated with generated cregion primitive. It is used by the various Bone Capture SOPs to generate the pCaptData attribute.

Deformation

In most common scenarios, you only need the 4x4 matrix of the cregions. Houdini itself performs additional calculations if the ratio of the cregion top and bottom radii are not 1. To perform a deformation, the basic process is something like this:

For each point pt:
pt = (0,0,0)
For each (cregion,weight) pair from pCapt of this point:
xform = cregion_rest_xform (taken from pCaptData) * cregion_xform (taken from bone's cregion sop)
pt += weight * (rest_pt * xform)

Note that the cregion_xform and cregion_rest_xform matrices are in world space. If you're transforming the rest_pt's inside an object NOT at the world origin, then you also need to take that into account.