-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Fix quaternion orientation in glm::decompose
#1012
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thanks for contributing! |
I think something is wrong with this "fix". Let's say we have a quat Q. Let M = mat4_cast(Q) and let Q2 be the quaternion resulted by decomposing M. We should get the same results with transforming a vec3 by Q, M and Q2. However, it's not the case. It seems that transforming with Q and M are results the same vector but with Q2 we get different result. `
` xQ = {0.707106709, 0.00000000, -0.707106829} |
I Agree, I'm still using the version before the fix as it was working perfectly for my use case. I don't get all the comments about conjugate in the stackoverflow thread though, maybe it was a side effect somewhere else that has been fixed since? I would expect a simple decompose/recompose operation to always fall back on the initial matrix, like before:
|
Yes, I used this function before and it worked well. Now it's wrong and because I also used it only for matrices composed of scales, rotations and translations, now I use my own simpler decomposeAffineMatrix which decomposes to scale, translation and 3x3 rotation mat and then use glm::quat_cast which seems also working well. |
Do you think we should revert ? |
I think I've convinced myself that it ought to be reverted. I think the confusion on my (and stack overflow's) part may stem from the column-major indexing of GLSL/glm. In particular, the way |
Between 0.9.8 and 0.9.9 a change to the implementation of
decompose
caused the conjugate of the rotation quaternion to be returned. This has also been noted in this Stack Overflow question, in particular this comment. This seems like a regression that ought to be fixed to avoid having to conjugate the result ofdecompose
in the future.