Nonuniform scaling, Hierarchy, & Matrices


On 16/03/2006 at 13:08, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   9.102 
Platform:   Windows  ; Mac  ;  Mac OSX  ; 
Language(s) :     C++  ;

I know that this isn't a problem particular to Cinema 4D or the SDK, but since this involves the SDK and the way Cinema 4D auto-propagates scaling to children, let me proceed.

My plugin uses a hierarchy of plugin modifier objects under a polygonal mesh (i.e.: bones and skinning). The bones can either be propagating or nonpropagating with respect to scales. If the bone propagates its scales to its children (default C4D procedure), there are no problems. If it doesn't and the scale is uniform, there are no problems.

The problem arises with nonpropagating nonuniform scales. See, in order to affect Cinema 4D's auto-propagation of scaling so as to allow for nonpropagation, I inverse scale the direct children bones. This works and is absolutely necessary for nonpropagation and transformation of subsequent children bones. Well, except that rotations on the direct children bones introduce shearing on the mesh. I've read the literature and online material. The solution appears to be that you want all of your scaling to occur before all of your rotations if supporting nonuniform scaling (it is the rotations followed by scaling that causes the shearing (lit. nonorthogonality) to occur in this case).

So I did the naive thing and extracted the Translation and Rotation from the concatentated hierarchy matrix (the one representing all parent influences) and applied them last and moved the Scaling to before any rotations, including those on the current bone/mesh being modified. The results were not pleasing. Also played with using the normalized matrices (Mgn, Mln) with less success.

Very little is discussed about how to remedy this (Eberly directly sympathizes with 3D app plugin developers on this exact situation!). Any solutions seem beyond practical application - Gram-Schmidt orthogonalization, singular value decomposition, or polar decomposition - and are not really talking about remedying the problem rather possibly extracting the component affine transformations or orthogonalizing the matrix.

Help, please.