Saving layers as nodes in glTF

We are working on visualizing data to our costumers via the web. We want to implement a few diagrams. I am working on the generator, building the scene (the diagramm as a whole) and the corresponding gltf-file.
My thought was that I can create layers with nodes. Something like:

Example

  • Layer 0 (largest distance to orthographic camera): contains the grid,
  • Layer 1: contains objects represented as lines
  • Layer 2 (smallest distance to orthographic camera): contains objects represented as points

The idea is following the layered structures in karthographic maps.

Now my problem: When I look at nodes in the glTF-spec, I think it might not work like I think it would.
Questions: Does every node need to have a camera or is it enough to define the camera for the root-node?
Can somebody please verify if my thought is correct, that I can use nodes for layers?

Thanks in advance
SabDi

Nodes do not need to have cameras, or any other property for that matter. Most glTF files do not include a camera at all. If you do include a camera, it would be most common to put the camera on a leaf node, i.e. a node without any children, so that the node exclusively represents that camera.

Can somebody please verify if my thought is correct, that I can use nodes for layers?

It’s certainly OK to group your objects under nodes however you like. But “layers” can mean different things in different software, so it’s worth noting that layers are higher level of abstraction than glTF’s nodes. Nodes have no particular effect on their content, except that the content inherits a world transform from them, and the runtime application could use the node to manipulate its content as a group.

1 Like

Thanks for the reply, it is very helpful.