[x3d-public] gltf metadata

John Carlson yottzumm at gmail.com
Fri Feb 1 08:04:16 PST 2019


Re: containerField of value (oops)

You might check the JSON schema, but I’m not sure “value” is the preferred name for a containerField. “children” may be preferred. That is, convert the X3D to JSON, and then check against the JSON 3.3 schema.  Generally “value” => 1 value and “children” =>  >1  value

Sent from Mail for Windows 10

From: Andreas Plesch
Sent: Friday, February 1, 2019 9:43 AM
To: X3D Graphics public mailing list
Subject: [x3d-public] gltf metadata

Here is how x3dom currently translates gltf metadata into x3d. Since
x3dom translates the non-binary gltf data into dom and makes it
(optionally) available as a dom node tree under the inline, translated
metadata can then be accessed as well, to show somewhere or do
whatever.

gltf has the ability to provide unstructured or optionally structured
metadata for the global asset and for each resource. This is similar
to the Metadata nodes in x3d.

glTF metadata can be provided in an 'extras' property which is
available to each kind of node. In addition, the toplevel asset node
contains metadata in defined properties.

The asset node data is translated into a WorldInfo node in the following way.

The copyright, generator, version, and minversion properties of the
toplevel asset node go into WorldInfo as a MFString info field: '
"copyright:(c)2020 sb" "version:2.0" ..' .The property name is joined
together with its value by a colon. [ There are alternatives, such as
property name followed by property value. ]

extras of the toplevel asset node go into the WorldInfo metadata field
packaged inside a MetadataSet holding node with name 'global':

<WorldInfo info= ' "copyright:(c)2020 sb" "version:2.0" '
title='asset.extras.title value if given'>
  <MetadataSet name='global' containerfield='metadata'>
    <MetadataSet name='asset-extras' containerfield='value'>
      extras (see below)

The asset extras metadata are named 'asset-extras'.

There is no defined 'title' property in gltf but if there is an
asset.extras.title string property it goes in the title field of
WorldInfo.

[ I am starting to think that it would be better to not use the info
field and just have an additional entry into the global MetadataSet,
an 'asset-properties' entry ].

The 'global' holding node also contains the extras of the gltf scene node.

<WorldInfo>
  <MetadataSet name='global' containerfield='metadata'>
    <MetadataSet name='asset-extras' containerfield='value'>
      extras (see below)
    <MetadataSet name='scene-extras' containerfield='value'>
      extras (see below)

The scene extras metadata are name 'scene-extras'.

The scene metadata are put into WorldInfo metadata because X3D Scene
itself cannot have a Metadata node (X3D Metadata nodes are not child
nodes) and because using the META statements in the X3D header would
then require managing the X3D header. Also, it seems logical to group
all scene-wide data together.

All other extras properties in nodes go into metadata nodes as
required in the following way. The gltf extras json property can have
any json value, including arrays and objects. It is recommended to use
a json object as name:value map but any json value is allowed.
A json string becomes a MetadataString.
A json number becomes a MetadataFloat.
A json boolean becomes a MetadataBoolean.
A json array or object becomes a MetadataSet. An array is actually an
object with numerical, ordered keys: {'0':v0, '1':v1 ..}. It can be
treated as an object.
The name field for each metadata node is 'extras' by default or the
key name in case of values for MetadataSet.
Here are examples:
<Transform>
  <MetadataString name='extras' value='extras_value_string'
containerfield='metadata'/>
----
<Transform>
  <MetadataSet name='extras'  containerfield='metadata'>
    <MetadataString name='component' value='rotor' containerfield='value'/>
    <MetadataString name='warehouse' value='StarlingCity'
containerfield='value'/>
----
<WorldInfo>
  <MetadataSet name='global' containerfield='metadata'>
    <MetadataSet name='asset-extras' containerfield='value'>
      <MetadataString name='created' value='2/3/2345' containerfield='value'/>
      <MetadataString name='author' value='art artist' containerfield='value'/>
      <MetadataString name='license' value='CC 4.0,
http://license.org/CC' containerfield='value'/>
-----

This description is probably longer than the lines of code it takes to
implement this kind of translation.

Any input or feedback much appreciated while this effort is underway.

-Andreas


-- 
Andreas Plesch
Waltham, MA 02453

_______________________________________________
x3d-public mailing list
x3d-public at web3d.org
http://web3d.org/mailman/listinfo/x3d-public_web3d.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20190201/4e041523/attachment-0001.html>


More information about the x3d-public mailing list