Transformation & Deformation

Attaching high resolution geometry to a different piece of animated geometry is a common Houdini operation.

Often the geometry you are targeting is the low-res output of simulation (Vellum, FEM, RBD) and by deforming high-res geo post-sim you can keep the sim stable and running fast. It also comes up when attaching geometry to animated characters where building a system in a static ‘Rest’ pose and deforming it later makes life easier.

Typing 'Deform' into SOP Tab menu in search of the right tool reveals an overwhelming number of options. There are different approaches you can take depending on the situation and these vary in speed, accuracy and flexibility.

A lot of choices even without 3rd party libraries

I will aim to use the following terms for consistency:

  • Source geo / High-res geo: the geometry we want to deform. Usually this lines up spatially with our reference geo and is sometimes built directly from it.

  • Reference geo / Proxy geo: the driver geometry in its static rest pose (usually low-res). For characters this would be a T-Pose and for simulations it’s the pre-sim geometry or first simulated frame.

  • Target geo: the driver geometry in its animated/deforming state (usually low-res).

Download the Hip File here

Rigid Transforms

With all deformations our goal is to match a target shape while minimising the distortion being applied. Sometimes you can deform geometry with zero distortion. If the target geo is rigid or close to “rigid” (the motion comprises only translations and rotations) you can extract a single transformation matrix which can be applied directly to the source geo with no weighting or approximations required.

The Extract Transform SOP can be used for this. It calculates positional and rotational offsets between reference and target geo and outputs a point describing these offsets with instance attributes. Feed this point into a Copy-To-Points SOP with your source geo on the left to replicate the transformation. The parameters on Extract Transform also allow it to work with multiple objects using a name attribute (there is a demo of this in the hip file) which is much more efficient than doing a similar thing in a for-loop. Extract Transform is particularly useful if you are ingesting geometry from an external source (e.g Alembic character) and have no access to the original transformation data.

Dealing with multiple rigid objects naturally occurs during RBD sims which use Packed primitives. These have their transforms stored as hidden ‘intrinsic primitive’ attributes and manipulating them directly is unintuitive for new Houdini users. The Transform Pieces SOP can extract packed transforms and reapply them to source geo on a piecewise basis. It is a key step in the “Proxy” workflow used by the RBD Bullet Solver SOP.

The MOPs Extract/Apply Attribute SOPs perform a similar task to Transform Pieces within the MOPs toolset using a couple of short attrib wrangles. Dive inside either node to see how VEX is used to interrogate and adjust the intrinsic attributes. I sometimes use MOPs Extract/Apply for standard workflows if Transform Pieces is acting up. I’ve left a small example in the hip file which demonstrates a clean piece-instancing setup created with Merge Packed & Attribute From Pieces which is converted to MOPs. There is also a demo of ‘Pack Inject’ which is brand new and acts as a convenient macro for piece replacement.

With KineFX we have another rigid transformer available in Capture Packed Geometry / Bone Deform. The main application is of course for rigging but since KineFX works in SOPs on simple polylines and edge networks it could be used for other effects.

Exact Attachment

Often we want to attach source geometry directly onto a point, edge or face on our reference geo. There are a number of nodes and VEX functions available which can calculate an attachment location on our reference geo and store in attributes. With a matching lookup nodes/function we can calculate the position (or other attribute) on our target and apply this to our source geo.

the xyzdist() function is most commonly used for this. it outputs a “primnum” integer and “primuv” vector to fully define the a position on the surface of a mesh. This is usually paired with either primuv() to lookup a position, or Attribute Interpolate SOP which can lookup any number of attributes. The Ray SOP can also output primnum/primuv, as can the Scatter SOP.

The uvdist() VEX function is a lesser know cousin to xyzdist() and outputs the same primnum/primuv data from a lookup done in UV space. With function you can map geometry onto a reference even when there is no spatial coherence between the two. The Creep SOP does a similar thing but this node is rather old!

Finally, the Guide Deform SOP used for grooming is an example of exact attachment combined with rigid transformation. The root point of a guide hair is fixed to the animated skin, and a rigid rotation matrix is built to orient the rest of the curve (in the default setup at least).

Weighted Interpolation / Specific Forms

If the source geometry does not lie directly on the reference geo creating a mapping is more complex and requires weighting/sampling against multiple points on the reference. The Point Deform SOP is generally the first port of call here. It’s an amazing node which is fast and has several parameters which can be tweaked to optimise the shape transfer. The 'piece attribute' parameter allows the node to capture and deform matching named pieces without the performance hit of a for-loop.

You can speed Point Deform up considerably (up to 5x) by unticking the “additional attributes” toggle if all you care about is deforming P. Although the node is fast this can help with heavy source geo. A number of other nodes use Point Deform internally such as ‘RBD Deform Pieces’.

Surfaces

If our reference geo is a surface like a single sided cloth there are options which may offer better quality than Point Deform. An obvious one to try is the Cloth Deform SOP. It has visual guides to show the capture area of each point on the cloth. Performance is unfortunately very slow but quality is usually better than point deform for surface reference geo.

Another option is to use an extended version of the ‘xyzdist’ attachment discussed above - this time storing the primnum, primuv and a difference vector between the source point and the surface, using the surface normal for assistance. This produces results similar to Cloth Deform but is significantly faster (since it’s not weighting against multiple points).

Polylines

When our reference geo is deforming polylines the Path Deform SOP is the best bet - although you must be able to build source geo along a straight line in order to use it properly. As well as performing a high quality deformation you have options for twist and roll, rigid pieces and animation.

If you cannot build source geo along a major axis you can give the Wire Deform SOP a try. Like the Cloth Deform SOP it has existed for a while and performance is pretty slow.

Wrap

Download Here

This is a seriously good 3rd party plugin which boasts the ability to deform by surfaces, paths and edge networks with great results. It’s fast as well - definitely worth trying out. Under the hood it appears to use the ‘extended xyzdist’ approach mentioned above and is very fast.

Post-Deform Polish

The Deltamush SOP is a piece of real Houdini magic which reduces distortion and preserves surface details even for strong deformations. There are parameters available to control how strongly the correction is applied.

Volumes

A proper Volume Deform SOP was finally added in Houdini 19. The 'capture' and 'deform' steps are broken up into 2 nodes and it’s intuitive and fast. The official docs are all you need

Miscellaneous

Radial Basis Functions

RBF Deformations are apparently used quite commonly in rigging as they are capable of producing very smooth results with relatively few reference points. The computation process is much more complex than the methods discussed above as it requires building and solving large matrix equations. I do not claim to have a deep understanding and instead point you towards an excellent article by Hunter Williams and a freely available HDA by XAPKOHHEH (a Houdini guru of the highest degree) which works on both meshes and volumes.

Hunter Williams Article

RBF HDA plus other amazing stuff

Deformation Wrangle

In an post about deformations I should probably mention the Deformation Wrangle. In truth I don’t think I’ve ever needed to use this directly. It computes the derivates of a user-defined transformation, allowing it properly reorient attributes such as N and v. You can find one inside the Bend SOP.

End.

Patreon Plug

Previous
Previous

Surface Skinning

Next
Next

Bubble Trouble