Background: I’m opening up a discussion that will hopefully influence glTF publishers/exporters to consider data visualization requirements with 3D assets. Before opening up the specific issue detailed below with the Blender developers, I wanted to document the issue and get feedback on possible other considerations.
Use Case: 3D visual assets can be ‘data driven’ by data assets made available in at least two primary ways by a rendering engine.
- The data assets are statically associated with the 3D asset and incorporated into the glTF file.
- The data assets are dynamically associated (by referencing/lookup scheme) with the 3D asset.
This design pattern is used in a prototype application:
In this prototype, individual meshes with individual materials (not shared) are dynamically ‘driven’ with data that corresponds to the 3D images’ sub-components. The 3D images were developed in Blender and then exported with the glTF export tool.
To identify the visual sub-components associated with the data, the ‘extras’ attribute for the meshes were associated with a ‘visualize’ property. That along with the ‘name’ property was sufficient to accurately identify the sub-component and its data association. An good solution for a gen 1 prototype.
Issues/Discussion:
Experimenting with static bound data revealed some issues; at least with Blender. While it supports Custom Properties, it exports a JSON object like the following; in a format that is not immediately parse-able into a JSON object:
"extras": {
"visualDatum": "{cost: 5, price:8}"
}
visualDatum’s value is a string which is not parse-able with modern browsers’ JSON method because the property names are not within double-quotes.
Recommendation(s):
-
gltF exporters should export objects that don’t need to be parsed into JSON objects.
-
Suggested property names to use for a generalized visualization design pattern:
-
“visualKey”: a value (string or number) that the rendering logic uniquely identify a 3D visual’s sub-component to be dynamically accessed.
-
“visualDatum”: an object that represents datum associated with the 3D visual’s sub-component.