Client-Side Draco Compression Fails on GLB Files Containing WebP Textures #1559
-
Describe the bug I want to make a customizable gaming chair and send it to the server with draco compression. I want to do all the compression as client-side like in https://gltf.report/. The aim of the project is to create an admin panel that can produce the chairs on the main site(https://design.hawkchair.com). Is it possible to do without Node.js? I have reviewed the previous opened topics and bugs and advanced to a point and my problem starts here. If there is no webp in the model, the problem is not seen, but if there is a webp texture, I encounter an error called "Draco compress failed: TypeError: Cannot read properties of undefined (reading 'DT_FLOAT32')". To Reproduce
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
@canberka the WebP extension shouldn't make a difference for Draco, here's an example on JSFiddle: https://jsfiddle.net/donmccurdy/ho7b8ywf/ Note that rather than adding extensions manually it's better to use functions. Adding the WebP extension alone does nothing, you also have to compress the textures. For example, this will add the extensions to the Document for you, and make any other changes required: import { draco, textureCompress } from '@gltf-transform/functions';
await document.transform(
draco(),
textureCompress({ targetFormat: 'webp', resize: [1024, 1024] })
); Also, I would recommend installing glTF Transform with npm/yarn/pnpm. You'll run into other issues trying to use it from a CDN. |
Beta Was this translation helpful? Give feedback.
-
I will ask for another detail for this project. I use model-viewer to show my model. The situation is that I upload an image to the model compressed with blender. Compressed model is 4mb Now, I want to send the model to the server after uploading an image to the model on the client-side. But the export function of model-viewer removes the model from draco. This naturally causes slowdown when sending the model to the server. Do you think the solution to this is to re-draco it and send it to the server? |
Beta Was this translation helpful? Give feedback.
-
I definitely got the situation. I have the draco model but I make changes to its textures via MV on the web browser. That's why the original compressed file changes. My whole purpose is to save the changed file to my own server. I tried to find a short and easy way to do this. Thank you both for your feedback @elalish @donmccurdy |
Beta Was this translation helpful? Give feedback.
@canberka the WebP extension shouldn't make a difference for Draco, here's an example on JSFiddle:
https://jsfiddle.net/donmccurdy/ho7b8ywf/
Note that rather than adding extensions manually it's better to use functions. Adding the WebP extension alone does nothing, you also have to compress the textures. For example, this will add the extensions to the Document for you, and make any other changes required:
Also, I would recommend installing glTF Transform with npm/yarn/pnpm. You'll run into other issues trying to use…