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

GLTF importer does not read the "matrix" property for nodes #82825

Closed
karai17 opened this issue Oct 5, 2023 · 1 comment · Fixed by #83231
Closed

GLTF importer does not read the "matrix" property for nodes #82825

karai17 opened this issue Oct 5, 2023 · 1 comment · Fixed by #83231

Comments

@karai17
Copy link

karai17 commented Oct 5, 2023

Godot version

4.1.2

System information

Godot 4.1.2

Issue description

I am generating valid GLTF files from raw model data. The Node transforms in my data come in mat4 format so I have been using the node.matrix property to dump that data in. My GLTF file loads perfectly fine in Blender, but does not load properly in Godot. After many, many hours of tinkering, of which I will spare the details, the primary issue ended up being that Godot just doesn't read the matrix property and I had to decompose my matrix into the TRS values. I suspect this omission is due to Blender spitting out GLTF files with TRS properties and never the matrix property, and an assumption that Godot users will primarily be using Blender.

Steps to reproduce

  1. Generate or modify a valid GLTF file such that the nodes use the matrix property rather than the TRS properties
  2. Import model into Godot
  3. Model should now have a very strange structure presumably from default TRS values being used rather than the provided matrix

Minimal reproduction project

TRS model (expected behaviour)
buma.zip

Matrix model (unexpected behaviour)
buma (2).zip

Ignore the orientation of the model~

@aaronfranke
Copy link
Member

aaronfranke commented Oct 12, 2023

This seems to be specifically a problem with skeletons. And the current code is bogus:

			skeleton->set_bone_rest(bone_index, node->xform);
			skeleton->set_bone_pose_position(bone_index, node->position);
			skeleton->set_bone_pose_rotation(bone_index, node->rotation.normalized());
			skeleton->set_bone_pose_scale(bone_index, node->scale);

There is no reason where we would ever have separate values for these. In fact, they should be unified, with GLTFNode only storing one transform.

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

Successfully merging a pull request may close this issue.

4 participants