visgl / loaders.gl

Loaders for big data visualization. Website:
https://loaders.gl
Other
714 stars 195 forks source link

"options.loadLinkedResources: true" Doesn't work in new Tileset3D. #2740

Open IDONKN opened 1 year ago

IDONKN commented 1 year ago

May I kindly inquire about the purpose of this option? Furthermore, could you please provide guidance on how to set this option?

While executing the postProcessGLTF operation, it appears that there is no available method to retain the buffer.arrayBuffer afterwards.

As mentioned in the official website documentation, the following fields will be filled with data from the provided gltf.buffers parameter. It's worth noting that this parameter is populated by the loader by utilizing the options.loadLinkedResources: true configuration:

buffer.arrayBuffer buffer.byteOffset buffer.byteLength Please let me know if there's anything else I can assist you with.

ibgreen commented 1 year ago

Firstly, at first blush I think there may be an issue with the documentation not being updated.

Not sure if it helps, but I think you have also understood that:

ibgreen commented 1 year ago

t appears that there is no available method to retain the buffer.arrayBuffer afterwards.

What do you mean with retain? Make a copy of the buffer so that your app can hold on to it? Why do you need a method? Can't you just copy the buffer from the returned data structure?

IDONKN commented 1 year ago

Hello, my process is as follows:

I'm learning from the following example - how threejs displays a model through the data returned by @loaders.gl/3d-tiles (Tiles3DLoader). https://github.com/visgl/loaders.gl/tree/master/examples/experimental/3d-tiles-with-three.js.

The above example contains this piece of code:


export async function loadGltfModelTile(url) {
     const content = await load(url, Tiles3DLoader, {
         '3d-tiles': {
             loadGLTF: true
         },
         gltf: {
         }
     });

     const tile = {};
     tile.glbData = content.gltfArrayBuffer;
     return tile;
}

When using the new Tile3D method to parse files in B3DM and I3DM formats, "gltfArrayBuffer" is included in the returned data. This should be added by the method parse3DTileGLTFViewSync.

But when parsing GLTF and GLB files, there are no parameters, so I'm trying to find similar variables.

Of course, it's possible that I haven't understood the relationship between buffer.arrayBuffer and BufferViews.

ibgreen commented 1 year ago

When you are working with three.js, you don't want loaders.gl to parse the embedded glTF file. You want to pass the embedded binary (glb) or URL to THREE's gltf loader . I believe this is what the example does.

That example was written before 3DTILES 1.1 which allows tiles to be GLBs. I suspect this is the problem you are running into. It may be that some option is needed in the 3D tile loader to preserve the glb buffer for those cases.