How compute net transform animation

Hi Experts,

I have a question about the net transform animation.
Please see attached keyframe_animation_mesh_transform.usda (1.7 KB): it contains one Xform prim named “Ins1” with the transform animation. “Ins1” has a nested Xform prim named “Ins2” with another transform animation.

When I compute the net transform animation on Xform prim “Inst2” by myself, I save the computed data into attached keyframe_animation_mesh_transform_2.usda (1.4 KB). However, when I play the animation in usdview for keyframe_animation_mesh_transform.usda and keyframe_animation_mesh_transform_2.usda, the animation looks different. Do you know the reason for it? How compute the correct net transform animation on “Inst2”?

def Xform “Ins1” (
kind = “group”
)
{
def Xform “Ins2” (
kind = “component”
)
{
float3 xformOp:rotateXYZ.timeSamples = {
1: (10, 10, 10),
2: (20, 20, 20),
3: (30, 30, 30),
4: (40, 40, 40),
5: (50, 50, 50),
6: (60, 60, 60),
7: (70, 70, 70),
8: (80, 80, 80),
9: (90, 90, 90),
10: (100, 100, 100),
}

uniform token[ ] xformOpOrder = [“xformOp:rotateXYZ”]

Hi @justinwang , sorry this one slipped by. USD performs hierarchical transformation matrix composition from parent to child primitive. Especially with rotations (which are non-linear), you cannot simply add the inputs together. Instead (in general… if your transform is pure rotation there are other options), you must compute the complete transformation of each ancestor of your prim plus the prim itself, and multiple all the matrices together in the right order. If you want to decompose the result into individual ops, you must use something like UsdGeomXformCommonAPI::GetXformVectors() or the underlying Gf functions it uses.

You may find it useful to read the UsdGeom Overview, particularly the section on linear algebra.

Thank you! Will have a try later!