loaders.gl icon indicating copy to clipboard operation
loaders.gl copied to clipboard

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

Open IDONKN opened this issue 1 year ago • 4 comments

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.

IDONKN avatar Oct 26 '23 08:10 IDONKN

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

  • I can't find any mention of loadLinkedResources in the actual 4.0 code base (master).
  • The GLTFLoader supports options.gltf.loadBuffers and options.glTF.loadImages.
  • I believe these are both true by default so all linked resources should be loaded.

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

  • postProcessGLTF() does not load anything, just works with what the GLTFLoader loaded.

ibgreen avatar Oct 26 '23 10:10 ibgreen

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?

ibgreen avatar Oct 26 '23 10:10 ibgreen

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.

IDONKN avatar Oct 26 '23 12:10 IDONKN

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.

ibgreen avatar Oct 26 '23 13:10 ibgreen