Skip to content
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

COLLADA2GLTF can't convert Maya's moved group pivot information correctly. #551

Closed
emadurandal opened this issue Mar 16, 2016 · 11 comments
Closed

Comments

@emadurandal
Copy link
Contributor

Hi there.

I tried latest COLLADA2GLTF, but I found a little weird covert result.

Look at this maya scene file (group_pivot.mb in attached zip file).
In this scene, there is a group whose pivot position is moved to (0, 5, 0).
You can see this animation scene at https://youtu.be/-BME5VZRDUQ

I exported this scene to collada file (group_pivot.dae) using ColladaMaya exporter.
I checked that this collada file is correct. Because MacOS preview function showed correct animation.
https://youtu.be/NwhLpZD2gBM

Then, I converted this collada file to gltf file (group_pivot_original.gltf, group_pivot.bin, group_pivot0FS.glsl and group_pivot0VS.glsl) using COLLADA2GLTF.
But Its data (group_pivot_original.gltf) seem wrong.

This video is the result of group_pivot_original.gltf using my original WebGL library, GLBoost. It’s wrong animation as you can see.
https://youtu.be/ZapNp3LNB6A

I think that the cause is the following part (in group_pivot_original.gltf).

    "nodes": {
        "_group1": {
            "children": [
                "_group1_pCube1"
            ],
            "name": "group1",
            "rotation": [
                0,
                0,
                0.707107,
                0.707107
            ],
            "scale": [
                1,
                1,
                1
            ],
            "translation": [       <- ?
                5,
                5,
                0
            ]
        },
        "_group1_pCube1": {
            "children": [],
            "matrix": [       <- ?
                1,
                0,
                0,
                0,
                0,
                1,
                0,
                0,
                0,
                0,
                1,
                0,
                0,
                0,
                0,
                1
            ],

So, I fixed the data (group_pivot_fixed.gltf) as following.

    "nodes": {
        "_group1": {
            "children": [
                "_group1_pCube1"
            ],
            "name": "group1",
            "rotation": [
                0,
                0,
                0.707107,
                0.707107
            ],
            "scale": [
                1,
                1,
                1
            ],
            "translation": [
                0,
                5,
                0
            ]
        },
        "_group1_pCube1": {
            "children": [],
            "matrix": [
                1,
                0,
                0,
                0,
                0,
                1,
                0,
                0,
                0,
                0,
                1,
                0,
                0,
                -5,
                0,
                1
            ],

Then, My GLBoost Renderer showed correct Animation.
https://youtu.be/zyV3JKvEZqE

In conclusion, I think that COLLADA2GLTF should export like group_pivot_fixed.gltf, not group_pivot_original.gltf.
Or, If there is a pivot infomation in glTF spec. COLLADA2GLTF should export it.
I guess that this problem is caused by COLLADA2GLTF’s bug, not my GLBoost library’s bug.

group_pivot.zip

@pjcozzi
Copy link
Member

pjcozzi commented Mar 21, 2016

@emadurandal wow, thanks for the carefully written issue. I agree this sounds like a bug in COLLADA2GLTF so I labeled this issue accordingly.

In the meantime, you could try converting this model with Cesium's converter, which does some extra processing that may help, or the Autodesk FBX to glTF converter, which also works with COLLADA, but I have not tested myself, or Assimp.

Let me know if you try any of these.

Also, let me know when glTF support in GLBoost is in a state you are happy with and we'll list GLBoost here: https://github.com/KhronosGroup/glTF#webgl-engines

@emadurandal
Copy link
Contributor Author

@pjcozzi Thank you for your reply.
I'll check those other tools and report the results 😄

Also, let me know when glTF support in GLBoost is in a state you are happy with and we'll list GLBoost here: https://github.com/KhronosGroup/glTF#webgl-engines

Wow! It's my great pleasure for GLBoost to could be listed there! my friends and I are making the library better gradually. and we are going to try human skinning animations support using glTF.
When we get the progress, I'll let you know that. Thank you!

@emadurandal
Copy link
Contributor Author

@pjcozzi I tried Cesium's converter, but the same problem happened.
I posted feedback to Cesium's forum. http://cesiumjs.org/forum.html
Next, I'm now trying Autodesk FBX to glTF converter. but the build steps are a little too much work. 😅

@pjcozzi
Copy link
Member

pjcozzi commented Mar 25, 2016

@cyrillef are there pre-built binaries for your FBX to glTF converter?

@emadurandal I suspect Cesium's converter issue is the same bug as COLLADA2GLTF.

@cyrillef
Copy link

@pjcozzi - I'll post them asap - I am just back from the trip to Montreal

@lasalvavida
Copy link
Contributor

@emadurandal When I open your attached COLLADA file in Blender I see this:
maya_pivot

Is the file you attached correct?

@pjcozzi
Copy link
Member

pjcozzi commented May 2, 2016

@lasalvavida also try Visual Studio or Mac preview incase the Blender importer has an issue.

@lasalvavida
Copy link
Contributor

lasalvavida commented May 2, 2016

@pjcozzi I'm not sure if Visual Studio can play animations, either way I opened it in this viewer and it displayed correctly, so it must be an issue in Blender. It is interesting that Blender and COLLADA2GLTF have a similar issue, so the culprit may be OpenCOLLADA.

@emadurandal
Copy link
Contributor Author

@lasalvavida @pjcozzi I apologize for the late reply.
I'm relieved that my attached COLLADA file appears to be correct.

@lasalvavida
Copy link
Contributor

lasalvavida commented May 24, 2016

I've been playing with this a bit, and I think I understand what's happening, but I don't have a fix yet.

Maya is pivoting around a point by translating, rotating and then translating back

COLLADA2GLTF flattens these transformations to make the node matrix
latex_1346dd360b023d6ec0e289556d73e22e

However, the animation targets latex_693a5af43d7d7bf270b32f27a10bf0a6, which just gets naively applied to the node matrix

It should be fairly obvious that latex_573d55a2d07a5f87243526b37432de72

One possible avenue would be to force animations in situations like this to be in matrix form and apply the proper transformation to each keyframe as shown for this example
latex_9fdc7de28bb62c48914975e37b638fcb

@lasalvavida
Copy link
Contributor

@emadurandal Sorry for the long wait. This should get fixed by #684.

@tfili tfili closed this as completed in #684 Sep 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants