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

Node matrices being converted to translations during load #511

Open
coolcomfort opened this issue Jan 15, 2025 · 1 comment
Open

Node matrices being converted to translations during load #511

coolcomfort opened this issue Jan 15, 2025 · 1 comment

Comments

@coolcomfort
Copy link

When loading a GLTF/GLB file containing nodes with matrix transforms, the matrix data appears to be converted into simple translations, losing rotation and scale information
.
Steps to reproduce:

Create a GLTF file with a node containing a 4x4 transformation matrix
Load the file using tinygltf
Examine the node data after loading

Example GLTF node:

    "name": "Branches",
    "matrix": [
        -0.6029826998710632, -1.0390753746032715, -0.9840571880340576, 0.0,
        -0.0003272023459430784, 0.0021713832393288612, -0.0020922916010022163, 0.0,
        0.8188902139663696, -0.17849361896514893, -0.3133031129837036, 0.0,
        -12.268609046936035, 7.965075492858887, -5.933340549468994, 1.0
    ]

After loading, the node.matrix array is empty (size 0), and instead the transform has been converted to a simple translation:

node.matrix.size() == 0
node.translation == [-12.2686, 7.96508, -5.93334]

Expected behavior:

Node matrix should be preserved as-is in node.matrix
No automatic conversion to translation/rotation/scale components

This conversion breaks complex transformations that can't be accurately decomposed into TRS components. Is there a way to preserve the original matrix data? If not, could this be added as an option?
Environment:

tinygltf
Platform: Windows
Compiler: MSVC

Let me know if you'd like me to modify or add any details to the issue.

@syoyo
Copy link
Owner

syoyo commented Jan 15, 2025

You should first check the expected behavior by referencing GLTF spec.

Then if you think the issue does follow GLTF spec, you should attach minimal reproducible scene file/code with expected behavior.

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

No branches or pull requests

2 participants