GLTFExporter output file size regression
See original GitHub issueDescribe the bug
Importing a glTF with jpeg textures and reexporting it is now causing a major bloat in file size compared to the original (~2.5x for DamagedHelmet). I’m pretty sure this is due to https://github.com/mrdoob/three.js/pull/23857, as we’re now using the convertToBlob
method of OffscreenCanvas instead of the toBlob
method of Canvas. This feels like it might also be a Chrome bug? It is correctly outputting JPEGs of the proper dimensions, they are just much larger, like the quality setting is defaulting to something a lot higher than the usual 0.85. @donmccurdy @robertlong Thoughts? Our regression tests caught this in <model-viewer>
when I tried to upgrade.
To Reproduce
Steps to reproduce the behavior:
- Go to the model-viewer editor and select DamagedHelmet
- Click on “Download Scene”
- Open the zip and inspect DamagedHelmet.glb - note it is now 9.3MB
Expected behavior
The GLB should be ~4MB, similar to the 3.8MB original
Screenshots
If applicable, add screenshots to help explain your problem (drag and drop the image).
Platform:
- Device: Desktop
- OS: MacOS
- Browser: Chrome
- Three.js version: r140
Issue Analytics
- State:
- Created a year ago
- Comments:5 (5 by maintainers)
Top GitHub Comments
It looks like Blink has a default JPEG quality of 92% and default WebP quality of 80%. And yeah for some reason this default quality is not being used when using
convertToBlob
. I can go ahead and use those defaults for those mimetypes if that makes sense? OffscreenCanvas really is only supported in Blink-powered engines right now and those defaults seem like good defaults for us to use for now.Have you filed this issue on Chrome?