How to load Blob objects?

Hi, I convert glb file to Blob, and I save Blob in indexedDb. How to load Blob object directly, I don’t want to use URL.createObjectURL, I want to load Blob object directly, it will be very fast.

try loader.parse( yourData

1 Like

The parse() method expects an ArrayBuffer. You can use const arrayBuffer = await Blob.arrayBuffer().

Hi,Don McCurdy,
Blob or arrayBuffer did not accelerate the display of 3D models. I would like to ask you if there is a faster accelerated display.
I have a scene, two pages have the same model, I want the model to be displayed very quickly when switching between two pages, I think this has a good experience.

json will probably load faster

You will need to profile your code to see where it spends time. Parsing JSON vs. Binary glTF content has almost no difference, unless you have large embedded Data URIs (always avoid those).

You will always have to re-upload the data to the GPU when loading a new page, and if your textures are large that will be slow. In that case it would be much faster to build a single-page application that can preserve the WebGL state when the URL changes.

Yeah. I use the single-page application. PageA and pageB are below route.

<PageA>
<ThreeCanvas/>
</PageA>

<PageB>
<ThreeCanvas/>
</PageB>

When I enter PageB, PageA unmounted will dispose memory, can the memory sharing of the two pages of the Canvas GPU be maintained?

Yes, but at that point the question has more to do with your chosen SPA framework than with three.js — as long as you hold the same WebGLRenderer and Scene your GPU resources can be reused, you’ll need to prevent PageA from destroying that.

I followed your solution successfully.Thanks!