question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Export] Link-duplicated characters don't re-use armatures, copied armatures balloon file size.

See original GitHub issue

Describe the bug Animated characters that have been link duplicated in the same file export a single mesh, material and animation. But the armature, which is set to be the same on each, is exported once for each character.

This causes the file size to expand significantly as the number of these characters grows. Since the bone data is duplicated needlessly.

To Reproduce Steps to reproduce the behavior:

  1. Attach an armature and animation to the default object.
  2. Alt + D duplicate the object multiple times.
  3. Export everything to GLTF with animation.
  4. Examine the GLTF file to see re-used material, but copied armature & bones.

Expected behavior Only one armature is exported and re-used, just like the re-used mesh and material.

Version

  • OS: macos 10.15.6
  • Blender Version: 2.83 and 2.90

Context In case some additional context happens there this question is also on the Blender SE: https://blender.stackexchange.com/questions/192398/multiple-link-duplicated-characters-dont-re-use-armature-on-gltf-export

I am wondering if this is at all related to this: https://github.com/KhronosGroup/glTF-Blender-IO/issues/331

Thanks for any advice!

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
emackeycommented, Sep 7, 2020

It’s not too widely supported yet, but there is an instancing extension for glTF called EXT_mesh_gpu_instancing. There’s no Blender import/export support for this currently. I think BabylonJS has support only in their recent alpha builds.

Here’s a sample Fox model with a bunch of instances: FoxInstances.zip

Try un-zipping this, multi-select the 4 files from inside, and drag-and-drop them together on Babylon Sandbox.

Again, don’t expect Blender to import more than one fox, as it doesn’t currently know about the instancing extension. I’m mentioning this here just to gauge the interest level and usefulness of such an extension.

1reaction
scurestcommented, Sep 17, 2020

Okay, thanks. Can you also say more about what you expected the glTF file to look like?

The thing is, glTF has no notion of an “armature”. It also has no notion of a subtree of nodes that can be reused. So here’s you file

arma

So if we go through all the stuff that’s duplicated in the glTF…

  • node

    Since each bone has a different world transform and there is no way in glTF to reuse nodes at all, all bones become different nodes. That is unavoidable.

  • skin

    Because each mesh is affected by a different node (bone), they must have different skin.joints arrays, so they all have different skins too. That is also unavoidable.

  • skin.inverseBindMatrices

    The exporter currently writes all skinned meshes in world space (meaning the mesh data is stored in world space, and the inverse binds are given relative to world space), see #994 for some discussion about that. That means since all the different bones have different world transforms, they all need different skin.inverseBindMatrices.

  • mesh

    Since meshes are given in world space, and all your meshes have different world space positions, they have different POSITIONs. So they can’t be reused. (However, they should be able to share a single eg. TEXCOORD_0 accessor since that doesn’t depend on the world transform. That was wrong, because how the attributes get ordered/deduplicated depends on all the attributes, including the POSITIONS.)

^^^^ The above two things could theoretically be fixed if the exporter gave meshes in armature space instead of world space.

  • animation sampler.output

    This could theoretically be shared right now but it isn’t. I don’t know enough about how the animation export works to speculate meaningfully on why though.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting duplicated armatures when exporting character with ...
I have been trying to export this character with NLA strips from blender with two animations, one for walking (from mixamo) and nodding ......
Read more >
Can't duplicate a proxy armature with mesh
The workaround I currently use is to create a copy of the file (or a file link if the os supports that) with...
Read more >
Maya User's Guide: What are wire deformers? - Autodesk
Wire deformers are like the armatures used by sculptors to shape objects. With a wire deformer, you use one or more NURBS curves...
Read more >
qandamaster320.xml - Chegg
... https://www.chegg.com/homework-help/questions-and-answers/dimensions- ... using-two-files-link-one-nationsdictdat-dictionary-contain-193-n-q24309779 0.8 ...
Read more >
Blender: Transfer Bones BETWEEN Armatures (In 60 Seconds!!)
There are very few tutorials that show you how to move bones from one armature to another in Blender - It's really easy,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found