glTF preview models
When ingesting CAD models to Cognite Data Fusion (CDF) a small preview version is generated and stored in the GLTF format (more specifically the GLB-format). This is stored as a separate output type in CDF called preview-glb
. <model-viewer>
can be used to visualize this model, but this component doesn't support authentication. To circumvent this issue we generate a data URL containing binary data.
Below is the code for a wrapper around <model-viewer>
which performs authentication and generates a data URL given a model ID for a revision ID and project.
This component can be used given a CogniteClient
that's authenticated with CDF, a model ID and a revision ID:
Cognite's 3D optimizer now outputs a small GLB file (the binary file format of the gLTF specification) that can be used as a preview for telling models apart.