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 export: Fix export of skeletons and skins. #53114

Merged
merged 1 commit into from
Sep 29, 2021

Conversation

lyuma
Copy link
Contributor

@lyuma lyuma commented Sep 27, 2021

cc @fire
Create GLTFSkeleton at the same time we create GLTFNode objects.
Create GLTFSkin at the same time we export MeshInstance3D
Also, convert BoneAttachment3D nodes during normal node creation.

This avoids needing special cases during mesh export, and especially exporting skeletons or meshes which are children of BoneAttachment3D.

Should address some of issue #50020. I have not verified the fix, but the old code which dealt with Skeleton or Skin export was very broken so this should be a starting point for future GLTF fixes related to animated or skinned meshes.

This is still in draft state because some of my meshes with blend shapes (but not all of them) fail to load in Blender
Blender error "index 990 is out of bounds for axis 0 with size 990"

Other test cases include the reproduction case I call "Party Hat" since it has a skinned "Party Hat" with springbones attached to a BoneAttachment3D onto the Head bone of a character's Skeleton3D. It seemed to previously reproduce interesting issues on export.

There are a few other glTF files in my collection of cursed glTF models which I still need to test re-exporting, containing duplicate skins, nested skeletons (including cases where a mesh is its own bone), and so on.

modules/gltf/gltf_document.h Outdated Show resolved Hide resolved
@fire
Copy link
Member

fire commented Sep 27, 2021

Some minor problems with variable shadowing and documentation has been modified causing CICD to break.

@fire
Copy link
Member

fire commented Sep 28, 2021

Exporting blend shapes as not reset to default causes the face blendshapes to explode.

@lyuma lyuma force-pushed the export_skin_fixes branch 4 times, most recently from 09c403e to 1f3fe06 Compare September 29, 2021 20:03
@lyuma lyuma marked this pull request as ready for review September 29, 2021 20:03
@lyuma lyuma requested a review from a team as a code owner September 29, 2021 20:03
@lyuma
Copy link
Contributor Author

lyuma commented Sep 29, 2021

I have made some additional fixes to blendshapes. They should no longer have such glitches, hopefully.

This should now be in a mergable state.

Create GLTFSkeleton at the same time we create GLTFNode objects.
Create GLTFSkin at the same time we export MeshInstance3D
Fixes export of blend shape arrays for meshes with multiple surfaces.
Fixes array indexing issues in export of glTF morph target animations.

Converts BoneAttachment3D nodes during normal node creation: this avoids
special cases during mesh export, and especially exporting skeletons or meshes
which are children of BoneAttachment3D.

Co-authored-by: K. S. Ernest (iFire) Lee <ernest.lee@chibifire.com>
Copy link
Member

@fire fire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Passes all the CICD tests.

@akien-mga akien-mga merged commit 0013d6f into godotengine:master Sep 29, 2021
@akien-mga
Copy link
Member

Thanks!

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

Successfully merging this pull request may close these issues.

4 participants