Optimizing hierarchical transform
- by Geotarget
I'm transforming objects in 3D space by transforming each vector with the object's 4x4 transform matrix. In order to achieve hierarchical transform, I transform the child by its own matrix, and then the child by the parent matrix. This becomes costly because objects deeper in the display tree have to be transformed by all the parent objects. This is what's happening, in summary:
Root -- transform its verts by Root matrix
Parent -- transform its verts by Parent, Root matrix
Child -- transform its verts by Child, Parent, Root matrix
Is there a faster way to transform vertices to achieve hierarchical transform? What If I first concatenated each transform matrix with the parent matrices, and then transform verts by that final resulting matrix, would that work and wouldn't that be faster?
Root -- transform its verts by Root matrix
Parent -- concat Parent, Root matrices, transform its verts by Concated matrix
Child -- concat Child, Parent, Root matrices, transform its verts by Concated matrix