mgear_legacy
mgear_legacy copied to clipboard
Joint rotation order can't be customized
For compatibility with a particular game engine or pipeline, you may need the joints to use a different rotation order than XYZ. Customizing the rotation orders per joint seems unnecessarily complicated, and per component might not be that useful. However, it should be feasible to customize it globally ("per rig") at least.
I'm working on adding this for myself. It doesn't seem too difficult, tho that might indicate I'm doing it wrong. It involves a change to the addJoint() method in component.Main, and some UI and other stuff of course. Is this something you want mGear to support, @miquelcampos?
@Ruuttu thanks for the head up on this. I didn't know about that.
right now I am working to make mGear more friendly for game engine. So any addition is welcome. Can you explain me about the rotation order? what engines?
btw: I am moving everything to the new separated repository configuration. I will prepare some video ASAP of how to contribute with the new structure. For the moment, if you prefer, you can make the pull request in this repo, and I will copy manually to the new structure.
Thanks, Miquel
Unfortunately I don't have a full picture of the issue at this time.
Apparently one reason to control rotation orders is to minimize euler flipping. That's when the euler values derived from a matrix suddenly change even if the motion is continuous, for example from 180 degrees to -180 degrees. These flips can cause noticeable artifacts if the euler curves go through a lossy animation compression process. Unfortunately almost all in-game animation has to be compressed in some manner.
If you connect the quaternion from a decomposeMatrix node to a quatToEuler node you can compare the effect of different rotation orders. With default XYZ rotation orders, the inputs 45, 135, -1
and 45, 135, 1
give wildly different outputs -135, 45, 179
and 45, 135, 1
. If you set the quatToEuler node to use YZX, you get -35.6, 145.4, -30.8
and -34.9, 144.1, -29.2
, which looks weird, but would avoid the flipping in this case.
Hi @Ruuttu
Is this a flipping issue that you have found exporting to game engine? sample date will be very helpful, do you have any?
Thanks again! Miquel