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

Does GLTF 2.0 permit shared nodes? #2461

Closed
Densaugeo opened this issue Dec 7, 2024 · 4 comments
Closed

Does GLTF 2.0 permit shared nodes? #2461

Densaugeo opened this issue Dec 7, 2024 · 4 comments

Comments

@Densaugeo
Copy link

I attempted to create a .gltf file consisting of several gears. There is a mesh for a gear tooth, and each gear is a node with several teeth arranged in a circle. However, when I attempt to place a second gear in the same scene it isn't rendered (I am using three.js for display).

The spec for node-children states: "Each element in the array MUST be unique" and "Each element in the array MUST be greater than or equal to 0", so there is no obvious restriction on this.

Someone in another issue thread on this repo (#1547) claims that "We specify that a node cannot be a child of two different nodes", but I cant find that in the spec so I don't know if it's current.

I can find very little on Google about this topic. There's a few discussions of "joint nodes", but those seem to be something else.

Can I get a clarification on whether the spec permits multiple references to the same node?

@javagl
Copy link
Contributor

javagl commented Dec 7, 2024

Section 3.5.2. Nodes and Hierarchy of the specification says

The node hierarchy MUST be a set of disjoint strict trees. That is node hierarchy MUST NOT contain cycles and each node MUST have zero or one parent node.

@javagl
Copy link
Contributor

javagl commented Dec 7, 2024

(So the answer to the question in the title is "No" 🙂 )

@Densaugeo
Copy link
Author

Didn't see that section earlier, that is pretty clear.

@donmccurdy
Copy link
Contributor

donmccurdy commented Dec 9, 2024

One pedantic exception – different scenes may contain references to the same (root) nodes. So client implementations do need some capability to instantiate a particular node more than once. But as @javagl mentions, reuse of a node within a given scene is not allowed, and so in practice the reuse of data within a scene means having different nodes that point to the same resources (meshes, lights, etc.).

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

3 participants