Gltf loader, where do we find the image src and the source image data ( threejs r119 )

In the release (r119), GltfLoader has few changes,

  1. Image type (normal image to canvas image) and
  2. standard material to physical material changes

I need to use the source image data, so i can save the texture images in the png/jpeg (small sized) when i export the data using .toJSON, this used to work in the older version. I do understand the changes, but what can be done to seamlessly export as required?

Is there any option so that we can obtain Image with url as before rather than canvas Image?

Also for info … why do we use “Canvas Images” :slightly_smiling_face: … just asking …

This is a regression in r119, thanks for pointing it out. I’ve filed https://github.com/mrdoob/three.js/issues/20051.

  • Image type (normal image to canvas image) and

This is done, in browsers that support it, because it allows models to be loaded without freezing the page during texture->GPU upload as much. If exporting is not working after loading models, you may want to file a bug on the three.js repo with a demo to reproduce the issue.

It works, that’s not the issue!
The only issue (specific to me) is that since image is converted to canvas or url … then while exporting using .toJSON after the scene has loaded, causes to re-encode the data to a higher file size …
So i have used an hackish way to additional pass data url as src (i may or may not have used inline async call to fileread blob) … that way the toJSON uses the original encoded data (saving up to 1/4 of the data while exporting of default way)
If any other way is suggested i’ll be ready to use that …

Hm, I see. The quick workaround might be to try something like:

// Disable ImageBitmap API.
delete window.createImageBitmap;

But maybe we should have a method on GLTFLoader to opt out of this — feel free to open a feature request on GitHub!

Thanks for the help above, and as suggested posted a feature request https://github.com/mrdoob/three.js/issues/20055