[x3d-public] conversion of glTF metadata to X3D metadata

Brutzman, Donald (Don) (CIV) brutzman at nps.edu
Mon Oct 9 15:40:41 PDT 2023


Great to learn of all this potential consistency and interoperability!

 

I think it is very appropriate for X3D Working Group to collect bidirectional mapping rules between X3D and glTF metadata.

 

*	This can be super informal at first,
*	We can collect and publish examples,
*	We can write corresponding metadata-conversion validation rules and integrate those test diagnostics in our tool suite,
*	This can become a Web3D Consortium Recommend Practice,
*	This will be of definite interest to Metaverse Standards Forum (MSF) 3D Web Interoperability Group,
*	This might eventually be part of X3D 4.1 specifications.

 

all the best, Don

-- 

Don Brutzman  Naval Postgraduate School, Code USW/Br        brutzman at nps.edu

Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA    +1.831.656.2149

X3D graphics, virtual worlds, navy robotics https://faculty.nps.edu/brutzman

 

-----Original Message-----
From: x3d-public <x3d-public-bounces at web3d.org> On Behalf Of Andreas Plesch
Sent: Monday, October 9, 2023 10:49 AM
To: Michalis Kamburelis <michalis.kambi at gmail.com>
Cc: X3D <x3d-public at web3d.org>
Subject: Re: [x3d-public] conversion of glTF metadata to X3D metadata

 

Thanks, Michalis. x3dom does pretty much the same mapping of extras to metadata, with minor differences:

 

The name of the MetadataSet is "extras" except for "scene_extras" and "asset_extras" for WorldInfo MetadataSets.

 

Numbers become MetadataFloat rather than MetadataDouble.

MetadataDouble is more appropriate for the json number type, I believe, but MetadataFloat seems more commonly used in X3D since 32bit suffices in most cases.

 

Here is the full conversion:

https://github.com/x3dom/x3dom/blob/master/src/util/glTF/glTF2Loader.js#L149

 

Does CGE convert the asset object as well ?

 

I am also looking for examples of uses of the glTF metadata xmp extension but could not find much so far. I suspect Adobe may have such examples.

 

Best, Andreas

 

On Mon, Oct 9, 2023 at 1:20 PM Michalis Kamburelis < <mailto:michalis.kambi at gmail.com> michalis.kambi at gmail.com> wrote:

> 

> In CGE/view3dscene we convert glTF "extras" to X3D Metadata.

> 

> Our practical use-case for it is that Blender allows to define "custom 

> properties" on various objects (Blender meshes, objects, cameras...) 

> and the Blender->glTF exporter puts these "Blender custom properties"

> in "glTF extras". Being able to read these things in Castle Game 

> Engine allows authors to define some things in Blender that can be 

> game-specific and that are attached to particular objects, e.g.

> 

> - "this is a monster spawn point",

> - "this is a destructible wall with 123 hit points",

> - "this is lava",

> - "walking on this floor hurts the player, taking 4 hit points per 

> second",

> - "this is a water volume, if player is inside this then it should be 

> treated as underwater".

> 

> So we convert glTF extras tro X3D Metadata, and give CGE users easy 

> way to access this metadata, and everyone is happy, no matter what 

> tool and format they use -- they get possibilities :) See

>  <https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcastle-engine.io%2Fblender%23_custom_properties&data=05%7C01%7Cbrutzman%40nps.edu%7C7b4de2dc055541b84b2108dbc8f0399f%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C638324706343579427%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Xpv5MHdNU54VlqbxMSsjnyQ4jB2g92%2Fxyu%2B%2FsvPZzLk%3D&reserved=0> https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcastle-engine.io%2Fblender%23_custom_properties&data=05%7C01%7Cbrutzman%40nps.edu%7C7b4de2dc055541b84b2108dbc8f0399f%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C638324706343579427%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Xpv5MHdNU54VlqbxMSsjnyQ4jB2g92%2Fxyu%2B%2FsvPZzLk%3D&reserved=0 .

> 

> To turn glTF (most typical) key-map into X3D Metadata, we wrap it into 

> X3D MetadataSet called "ContainerForAllMetadataValues" .

> 

> glTF extras like this:

> 

> """

>     "meshes" : [

>         {

>             "extras" : {

>                 "mesh_custom_property" : 1,

>                 "mesh_property_2" : "some string"

>             },

>             "name" : "Cube",

> """

> 

> -> are converted into X3D metadata like this:

> 

> """

>         metadata MetadataSet {

>             name "ContainerForAllMetadataValues"

>             value [

>                 MetadataDouble {

>                     name "mesh_custom_property"

>                     value 1

>                 }

>                 MetadataString {

>                     name "mesh_property_2"

>                     value "some string"

>                 }

>             ]

>         }

>         children Shape {

> """

> 

> See

>  <https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgith> https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgith

> ub.com%2Fcastle-engine%2Fdemo-models%2Ftree%2Fmaster%2Fblender%2Fcusto

> m_properties&data=05%7C01%7Cbrutzman%40nps.edu%7C7b4de2dc055541b84b210

> 8dbc8f0399f%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C6383247063437

> 35644%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJB

> TiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=kNU3YJFvT%2Br2iMl2ybY

> 272DG4yvy2BNW79fHW3cLjpU%3D&reserved=0

>  <https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgith> https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgith

> ub.com%2Fcastle-engine%2Fdemo-models%2Ftree%2Fmaster%2Fblender%2Fcusto

> m_properties_2&data=05%7C01%7Cbrutzman%40nps.edu%7C7b4de2dc055541b84b2

> 108dbc8f0399f%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C63832470634

> 3735644%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLC

> JBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=%2BBwXTwnSh81onXJMz

> aOMktrWiJ9HZz%2B1hYoMtx9s1zY%3D&reserved=0

> for more examples, including both glTF, resulting X3D, and also source 

> Blender files.

> 

> Regards,

> Michalis

> 

> pon., 9 paź 2023 o 16:49 Andreas Plesch < <mailto:andreasplesch at gmail.com> andreasplesch at gmail.com> napisał(a):

> >

> > Hi Holger,

> >

> > Thank you for your feedback. I did not think too much about the name 

> > for the Metadata node which holds the scene.extras json value.

> >

> > To me "scene.extras" is more of a programming convention whereas the 

> > value of a name string should be more abstract, or descriptive in a 

> > linguistic sense. So a dot would mean a full stop which would not 

> > make a lot of sense. But I can see that this is a rather aesthetic 

> > consideration, and that a direct json path style name has its own 

> > benefits by following very closely the glTF source..

> >

> > Let us know what you think,

> >

> > Cheers, Andreas

> >

> > On Mon, Oct 9, 2023 at 7:25 AM Holger Seelig < <mailto:holger.seelig at yahoo.de> holger.seelig at yahoo.de> wrote:

> > >

> > > In X_ITE I also create a WorldInfo, but parse only the toplevel metadata so far.

> > >

> > > I like the way you described it, but why do you translate 'scene.extras' to 'scene_extras'? I would leave it as it is.

> > >

> > > Holger

> > >

> > > --

> > > Holger Seelig

> > > Leipzig, Germany

> > >

> > >  <mailto:holger.seelig at yahoo.de> holger.seelig at yahoo.de

> > >  <https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2F> https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2F

> > > create3000.github.io%2Fx_ite%2F&data=05%7C01%7Cbrutzman%40nps.edu%

> > > 7C7b4de2dc055541b84b2108dbc8f0399f%7C6d936231a51740ea9199f75789633

> > > 78e%7C0%7C0%7C638324706343735644%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiM

> > > C4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7

> > > C%7C%7C&sdata=CIAucgq0iTAEa5jfliJ6ZJiRVKhxrqXn0DsUb9lRJf4%3D&reser

> > > ved=0

> > >

> > > Am 09.10.2023 um 00:14 schrieb Andreas Plesch < <mailto:andreasplesch at gmail.com> andreasplesch at gmail.com>:

> > >

> > > glTF can contain rich metadata, on the toplevel and very targeted 

> > > at any sublevel.

> > >

> > > At any level, there is an "extras" property which can contain any 

> > > value including objects with arbitrary key:value pairs.

> > >

> > > At the toplevel, there is an asset object which has a set of 

> > > defined keys such as "copyright" (as well as its own "extras" property).

> > >

> > > In addition to this unstructured metadata for core glTF, there is 

> > > a metadata extension for more structured metadata, extensible 

> > > through

> > > namespaces:

> > >

> > >  <https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2F> https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2F

> > > github.com%2FKhronosGroup%2FglTF%2Fblob%2Fmain%2Fextensions%2F2.0%

> > > 2FKhronos%2FKHR_xmp_json_ld%2FREADME.md&data=05%7C01%7Cbrutzman%40

> > > nps.edu%7C7b4de2dc055541b84b2108dbc8f0399f%7C6d936231a51740ea9199f

> > > 7578963378e%7C0%7C0%7C638324706343735644%7CUnknown%7CTWFpbGZsb3d8e

> > > yJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%

> > > 7C3000%7C%7C%7C&sdata=hbpLcxJiMrjkkdvJgqwCCmZ%2FygW0hVDEsLk34ipndm

> > > Y%3D&reserved=0

> > >

> > > There are many ways to map glTF metadata to X3D metadata. How 

> > > should we manage this ? It may make sense to coordinate systematic behaviour.

> > >

> > > x3dom uses the WorldInfo node for toplevel metadata:

> > > - asset object properties go into the info field as key:value string pairs.

> > > - asset.extras go into a WorldInfo MetadataSet "asset_extras"

> > > - scene.extras  go into a WorldInfo MetadataSet "scene_extras"

> > >

> > > In addition, "extras" at lower levels go into MetadataSets of 

> > > corresponding nodes, using the json value types for Metadata types.

> > >

> > > How do other browsers translate "extras" ?

> > >

> > > x3dom should also support the KHR_xmp_json_ld extension, by 

> > > staying very close and literal to the glTF data.

> > >

> > > One feature of the extension is that sets (packets) of metadata 

> > > are defined once at the toplevel, and then referenced 

> > > (instantiated) from any other level. This seems to map well into 

> > > DEF/USE. A large "KHR_XMP_GLTF" root MetadataSet would contain all 

> > > metadata and just referenced by USE from Shapes/Material etc. I 

> > > think this could work well. I think json property names can become 

> > > Metadata name values, and json value types can be mapped into Metadata types.

> > >

> > > If there have been thoughts or attempts to implement the glTF 

> > > metadata extension, any ideas or feedback would be great. Would it 

> > > be useful to start to think about a xml Metadata schema which 

> > > follows the glTF extension requirements and recommendations ? This 

> > > may not be feasible due to the extensible nature of the extension..

> > >

> > > Cheers, Andreas

> > >

> > > --

> > > Andreas Plesch

> > > Waltham, MA 02453

> > >

> > > _______________________________________________

> > > x3d-public mailing list

> > >  <mailto:x3d-public at web3d.org> x3d-public at web3d.org

> > >  <http://web3d.org/mailman/listinfo/x3d-public_web3d.org> http://web3d.org/mailman/listinfo/x3d-public_web3d.org

> > >

> > >

> >

> >

> > --

> > Andreas Plesch

> > Waltham, MA 02453

> >

> > _______________________________________________

> > x3d-public mailing list

> >  <mailto:x3d-public at web3d.org> x3d-public at web3d.org

> >  <http://web3d.org/mailman/listinfo/x3d-public_web3d.org> http://web3d.org/mailman/listinfo/x3d-public_web3d.org

 

 

 

--

Andreas Plesch

Waltham, MA 02453

 

_______________________________________________

x3d-public mailing list

 <mailto:x3d-public at web3d.org> x3d-public at web3d.org

 <http://web3d.org/mailman/listinfo/x3d-public_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/20231009/fa298a21/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5464 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20231009/fa298a21/attachment-0001.p7s>


More information about the x3d-public mailing list