Skip to content
This repository has been archived by the owner on May 19, 2022. It is now read-only.

Joint rotation order can't be customized #227

Open
Ruuttu opened this issue Jun 20, 2018 · 4 comments
Open

Joint rotation order can't be customized #227

Ruuttu opened this issue Jun 20, 2018 · 4 comments

Comments

@Ruuttu
Copy link
Contributor

Ruuttu commented Jun 20, 2018

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.

@Ruuttu
Copy link
Contributor Author

Ruuttu commented Jun 20, 2018

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?

@miquelcampos
Copy link
Member

@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

@Ruuttu
Copy link
Contributor Author

Ruuttu commented Aug 28, 2018

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.

@miquelcampos
Copy link
Member

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants