Open AlexSchwank opened 6 years ago
Filed as internal issue #157012.
Hi @AlexSchwank, @elrond79 made a PR that adds euler filtering to Maya exports but I think it could be very interesting to see this at a higher level in USD.
Thanks @chadrik , I'm not too concerned about exports at the moment. Importing is a bigger issue for us so I'll fix it in a similar way for now. That said, you're right, this issue is meant to track/discuss general solutions to fix Euler flips at a higher level in USD.
So, it looks like the problem here is that the input rotation doesn't conform the "common xform" stack - the xform stack you give is maya's:
["xformOp:translate", "xformOp:translate:rotatePivotOffset", "xformOp:translate:rotatePivot", "xformOp:rotateXYZ:rotateOffset", "xformOp:rotateXYZ", "!invert!xformOp:translate:rotatePivot", "xformOp:translate:scalePivotOffset", "xformOp:translate:scalePivot", "xformOp:transform:shear", "xformOp:scale:scaleOffset", "xformOp:scale", "!invert!xformOp:translate:scalePivot"]
...while the (fairly simple) common xform only supports stacks with these elements:
["xformOp:translate", "xformOp:translate:pivot", "xformOp:rotateXYZ", "xformOp:scale", "!invert!xformOp:translate:pivot"]
(or other appropriate 1 or 3-axis rotate in place of rotateXYZ).
So the reason why the flip happens in your code snippet is that, since it's not compatible with it's xform stack, it converts to matrix, then decomposes the matrix.
Having said that... noticed you link to a PR that's dealing specifically with maya imports... maya should be able to understand it's own xform stack, and import your test correctly. So something wrong is definitely going on there...
Well, left full details in a comment for the PR, but figured out what was going on... the input xform stack is not actually a maya stack, as I first assumed it was. I still agree that there's a need for a euler filtering option, though, specifically to deal with situations where xform stacks can't be directly translated...
Description of Issue
When using more advanced xform ops, getting rotation values via the XformCommonAPI can lead to Euler flips.
eulerTest.usda zip
XformCommonAPI::GetXformVectors() result
For now, we can fix the rotation for example with Mayas MEulerRotation::setToClosestSolution() but Usd itself should include a
feature for Euler filters.
Thanks, Alex
Steps to Reproduce
Package Versions
Tested in 0.8.2 & 0.8.3