Graphics Reference
In-Depth Information
3.2.5 Parent Switch in Hierarchy
In a 3D engine we often need to modify objects' parent-children relationship. One
condition that most engines try to enforce is that after changing the parent of
an object, the object's global transformation remains unchanged. In other words,
we want to change the local transformation such that the global transformation
is still the same. Obviously, that forces us to recompute local TRS values of the
object whose parent we're changing. Note that if the previous parent's scale is
nonuniform and it's different from the nonuniform scale of the new parent, the
skew of the object will change and as such the geometrical appearance of the
object will be different.
Having our condition from the previous paragraph in mind, we can see that the
TRS decomposition problem is a special case of the parent switching problem—
when we move an object to the top of the hierarchy so that it has no parent,
its new local TRS becomes also its global TRS. Obviously, we want our parent
switching algorithm to work in the general case, but given the algorithm from
Section 3.2.4, that is a short way to go.
To get from the current local space to a new local space (parent changes,
global transform stays the same), we first need to find the global transform of the
object by going up in the hierarchy to the root node. Having done this we need
to go down the hierarchy to which our new parent belongs.
Let M 0 be the new parent's local transformation matrix. Let that new parent
have n ancestors in the hierarchy tree with local transformations M 1 , M 2 ,
,
M n ,where M i = S i R i T i . The new local transformation matrix can thus be
found using the following formula:
···
M n ( M 0 M 1 ···
M n ) 1
M TRS Σ = M 0 M 1 ···
M n M n 1 M n 1 1
M 0 1 .
= M 0 M 1 ···
···
Similarly,
R n T n ( R 0 T 0 R 1 T 1 ···
R n T n ) 1
M TR = R 0 T 0 R 1 T 1 ···
R n T n ( R n T n ) 1 ( R n 1 T n 1 ) 1
( R 0 T 0 ) 1 .
= R 0 T 0 R 1 T 1 ···
···
Now we simply use the algorithm from Section 3.2.4 to get the new local TRS
values.
3.2.6 Alternative Systems
Here we present some alternatives to the standard TRS system.
Uniform scale. This is probably the simplest solution proposed in [Eberly 07].
Instead of allowing the system to handle nonuniform scale, we might decide that
Search WWH ::




Custom Search