Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load GLB file with Properties / Inspector #1535

Closed
AlexanderMelde opened this issue Jun 14, 2024 · 4 comments
Closed

Load GLB file with Properties / Inspector #1535

AlexanderMelde opened this issue Jun 14, 2024 · 4 comments
Labels
question Further information is requested

Comments

@AlexanderMelde
Copy link

Hello,

we are currently evaluating the use of xeokit for our BIM viewer and we are looking for an simple way to load GLB / GLTF files into the xeokit viewer.

The GLTFLoaderPlugin seems like the perfect fit, but we cannot load Properties (IFC propertysets etc.) with it, the inspector does not open properly.

loadGlbOrGltf('/mypath/test1.glb', bimViewer.viewer);

Full Source Code index.html (from your example)

Someone else asked how to use the loader plugin a year ago, but did not get a very detailed answer.

When using the default loader, the inspector is shown:

const modelId = requestParams.modelId;
if (modelId) {
    bimViewer.loadModel(modelId);
}

This code seems to do it in your own viewer, but that one can only load xkt, not glb: https://github.com/xeokit/xeokit-bim-viewer/blob/master/src/BIMViewer.js#L211C38-L211C54

Can you provide us with an example of how to open glb files and inspect their properties?

When using convert2xkt.js we need an additional json file to include properties in the xkt file, so were hoping the GLTFLoaderPlugin can open glb files with properties without the additional json file.

Kind Regards
Alexander

@AlexanderMelde AlexanderMelde added the question Further information is requested label Jun 14, 2024
@xeolabs
Copy link
Member

xeolabs commented Jun 14, 2024

Hi Alexander,

Note that glTF/GLB does not contain IFC semantic data (metadata), it only contains model geometry and materials.

To load IFC semantic data, you need to also load a JSON file alongside the glTF/glb that supplies the element hierarchy and property sets to xeokit, eg:

    const sceneModel = gltfLoader.load({
        id: "myModel",
        src: "../../assets/models/gltf/Schependomlaan/glTF-Embedded/Schependomlaan.gltf",
        metaModelSrc: "../../assets/models/gltf/Schependomlaan/Schependomlaan.json",
        edges: true
    });

Note also that we usually convert the glTF/glb to XKT for best results. Loading glTF/glb is possible, but XKT does some pre-conditioning to the data that makes it load a lot faster for large models.

We offer a couple of flavors of IFC->glTF/XKT conversion, but only one of them supports property sets at this time.

More information on IFC conversion here: https://xeokit.github.io/xeokit-model-conversion-tests/ifc-tests.html

If your enterprise needs prioritised support while evaluating xeokit, we'd be happy to help - if so, please get in touch here: https://creoox.com/en/contact/

thanks
Lindsay

@AlexanderMelde
Copy link
Author

Hello Lindsay,

thank you for these explanations!
The links provided are useful as well for understanding the different file types.

I now have two follow-up questions:

  1. Does the GLTFLoaderPlugin use convert2xkt.js internally?
  2. Does the metamodel JSON file follow a certain standard, or is this a xeokit-specific format? I found a repo called xeokit-metadata, does this schema contain the structure for these JSON files? And I assume it is not ifcJSON?

Thank you for your help!

@xeolabs
Copy link
Member

xeolabs commented Jun 14, 2024

Hi no problem -

  1. Does the GLTFLoaderPlugin use convert2xkt.js internally?

No, that just loads the glTF/glb directly into the xeokit Viewer. Note that as it does this, it will do a couple of things to the geometry on-the-fly ( 1. convert vertex coordinates to tiled coordinate system for precise double-precision rendering, and 2. quantize the vertex positions to integers for lower memory usage), that convert2xkt does offline when creating XKT. This is one reason we often pre-convert to XKT first, so those two things don't have to happen at loading time.

FYI we use the loaders.gl library internally within that plugin, to parse the glTF/glb.

Also FYI: although XKT is what we recommend for IFC models, that plugin is actually the best option for loading triangulated LiDAR comprised of textured triangle meshes. It handles the big textures more smoothly than XKT does.

  1. Does the metamodel JSON file follow a certain standard, or is this a xeokit-specific format? I found a repo called xeokit-metadata, does this schema contain the structure for these JSON files? And I assume it is not ifcJSON?

Yes, xeokit metamodel JSON conforms to the schema described here: https://github.com/xeokit/xeokit-convert/blob/main/specs/index.md

Currently we're at v10. It's not ifcJSON - it's more optimized for loading into xeokit.

The BIMSpot tool is not something we're collaborators on, so I'm not sure what the conformance of that is with our latest spec.

@xeolabs xeolabs closed this as completed Jun 17, 2024
@AlexanderMelde
Copy link
Author

Thank you, this helps us a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants