Skip to content

Clearer relationship between tileset and glTF metadata #828

@j9liu

Description

@j9liu

Tileset and glTF metadata are near-identical in schema/spec, yet they are functionally independent from each other. A tileset may have no metadata while its glTF contents contain metadata—and it's possible for each glTF to use different schemas. There is no sure way to deduce this information from a tileset.json.

However, there are some use cases where this creates friction with certain implementations. I've described two of them below.

Voxels

We override this behavior in the current version of 3DTILES_content_voxels, under the Class section:

The class property refers to a class ID in the root tileset schema. The class describes which properties exist in the voxel grid.
[...]
The class MUST match the class used to classify the glTF voxels in their EXT_structural_metadata extension.

This is because our current voxel rendering implementations require pre-allocating resources for a tileset's properties. These resources must be appropriately sized based on the TILESET_TILE_COUNT semantic and the types of metadata attributes. It helps that the extension explicitly forbids metadata differences among voxel tiles, but is this worth resolving against the base 3D Tiles spec?

Runtime Styling

Another case that exposes this inconsistency is metadata styling in Cesium for Unreal. CesiumJS can build a shader for every primitive it loads in a tileset, but Unreal cannot create shaders/materials at runtime. So in the Unreal Editor, we have to build a catch-all material that anticipates what metadata properties it will find to apply styling based on their values. To build that material, we have an "autofill" function that queries all tiles visible in the Editor viewport for their EXT_structural_metadata (and their EXT_mesh_features). But it's possible for properties of the same name to have different definitions in EXT_structural_metadata.

For instance, in OSM buildings there is a Year property that is null for some features. In an old implementation, this property was assigned a string type whenever null values were seen for the property (as a fallback). However, that resulted in Year having dual int and string definitions within the tileset. The metadata type that appeared for the user depended on which tile the algorithm found first.

(I think we may have patched this out, but it still illustrates the possible problems.)

Conclusion (or lack thereof)

These examples show how it is necessary (or at least helpful) to have tileset-level awareness of the metadata types within the glTF. It may be strong to argue for it as a requirement, but the lack of knowledge hurts some use cases.

I'm waffling on some of the potential avenues we could take. I don't think we should enforce one schema for the entire tileset, especially for tilesets with too many varying properties. Otherwise, if you wanted to grab a single model that only used one metadata property from the tileset, it would still depend on a very huge schema.

Plus, I think the current conception between glTF and 3D Tiles is that glTFs are the payload, and theoretically you should be able to render / handle a glTF independently of the tileset it comes from. But, that argument is hand-wavey if you think about factors like the coordinate system changes. Because 3D Tiles is z-up, the glTF contents are often rotated to cancel out the coordinate system change. But otherwise, the tiles are weirdly oriented in a solo context.

I don't know what a nice resolution to this problem would be, but it would be nice to figure out as we're thinking of #822. Thoughts and discussion welcome :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions