View Full Version : Question about nonuniform scaling on hierarchies
03-21-2006, 08:15 AM
I asked this over at PluginCafe, but don't really expect an answer (any time soon). ;)
It's a toughie, so read carefully.
How would you allow a set of bones to be nonuniformly scaled and not propagate the scales to child bones and avoid introducing skew into the children when rotated?
This has been bugging me for a very long time and research shows that the solutions are not feasible in realtime situations (and there is no description of a process for this that I've encountered). David Eberly avoids nonuniform scaling like the plague in his 3D engine (and he's like a Master PhD in uber mathematics - which I'm not). :) That says more than enough about the deepness of the problem!
For the most part, Cinema 4D can handle nonuniform scales the way it usually does (propagated to children). But add in active countermeasures to implement non-propagating scales and any child rotations immediately get skewed - the more rotation and/or nonuniform scaling, the more skewed the child's coordinate basis.
I have not really found a way to counteract this basis skewing (i.e.: keep it from becoming nonperpendicular). I do have code used for initial rigging that works for the most part - but it is for a different system (standard C4D bones, not my plugin bones) and speed was not as much of an issue since it was not for active transformations.
Oh well, thanks for reading nonetheless... :)
changes to PSR of children are not propagated, they are implicit. Each object only stores it's local matrix which is combined with the parent matrix. If you change a parents scale the scale of the children is not affected, it's just that the childrens scale is always relative to the parents scale.
If you want to avoid the resulting effect you have to adjust the childrens scaling by yourself each time you change the parents scaling. If you change the parent scaling by a factor of 2 you have to change all the childrens scaling by 0.5 to counteract this.
An easy solution would be to store the global matrix of the children before making changes to the parent and restore that information to the children after the change is done.
03-21-2006, 04:39 PM
Yes, this I understand. And it is exactly the counteraction that introduces the skew into the child's basis system, I think. This might be why not applying countermeasures when the nonuniform scaling is 'implicit' doesn't have the same consequences.
Remember that I ask here because this is being implemented in hierarchy modifier plugin object code. It could get really slow going through the hierarchy once and then again to restore the effected matrices. Luckily, the type of system being employed works best when traversing the hierarchy backwards (from the children to the root) which would allow caching of the global matrices before changing the parent. Will have to try this and see if it avoids the skewed bases.
03-21-2006, 04:39 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.