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.

GLTF2 exporter ignores childless nodes in the scene hierarchy

See original GitHub issue

Bug

The GLTF2 Exporter seems to be ignoring any Mesh or TransformNode that does not have children in the scene hierarchy before exporting/serializing the scene.

Here is the line of code that seems to be responsible for this behaviour: https://github.com/BabylonJS/Babylon.js/blob/v4.0.0/serializers/src/glTF/2.0/glTFExporter.ts#L1342

Problem

This can be troublesome as sometimes it is useful to have an empty transform that stores a location (for example a spawn point for a prefab instance, a player, etc) or an orientation, etc. I’m not sure if this is something that is necessary because of the way the GLTF specs are, if it is I would be glad to know more about this subject.

Notes

The repro code in the Babylon Playground creates two sets of Mesh and TransformNode instances. If you export them and reimport them in the Babylon Sandbox for example, you will noticed in the Inspector that the nodes without children have been ignored at export-time.

These instructions can also be found in the repro playground:

NOTE: To export to GLB:
1- Select the GEAR icon in the Babylon Inspector toolbar above
2- Select Inspector in the displayed menu
3- In the Inspector panel that should have opened to the right, select the WRENCH icon.
4- In the SCENE EXPORT section, select Export to GLB
5- Load the downloaded file in https://sandbox.babylonjs.com/ by dragging it in the middle of the scene.
6- Open the Babylon Inspector at the bottom of the window
7- Expand the + Nodes section
8- Notice that only meshes and transform nodes that have children haven been exported

Versions

Tested in BabylonJS 4.0.3, seems to also be occurring in latest version (master branch).

Playground

Expected result

Exported scene should have all the meshes and transform nodes regardless of if they have children or not?

Current result

Any Mesh or TransformNode without children will be ignored when exporting to GLB

Workaround

It seems like an easy workaround would be to add a temporary child mesh to the meshes we wish to preserve.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
deltakoshcommented, Nov 12, 2019

Well this is more a bug so no worries for backward compat

2reactions
deltakoshcommented, Nov 12, 2019

@osmanzeki fancy doing a PR to fix it?

Read more comments on GitHub >

github_iconTop Results From Across the Web

gltf2.0 export ignores "Inherit Rotation" property changes
glTF has a straightforward node hierarchy, where children always inherit all of their parent's transforms. It may not be able to exactly ...
Read more >
glTF/glB File Converter, Viewer and Exchanger - Okino
This geometry import converter reads in glTF (JSON) and GLB (binary glTF) v2 or newer files in a mathematically precise and intelligent manner....
Read more >
Import and export GLTF - SideFX
The GLTF Hierarchy node can import an entire scene GLTF scene into an OBJ network. Unlike the SOP GLTF importer, the GLTF Hierarchy...
Read more >
How the glTF Exporter Handles Unreal Engine Content
Unlit. It treats unsupported shading models as Default Lit. If the material expression graph specifies the shading model, the exporter tries to evaluate...
Read more >
glTF 2.0 — Blender Manual - Import-Export
However, if the exporter finds a custom node group by the name of glTF Material ... which parts of the scene are visible...
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