GLTF Pipeline error: require() of ES modules not supported

When i try to use this command: gltf-pipeline -i model.gltf -o modelDraco.gltf -d i get error “Warning: require() of ES modules is not supported”. And in folder i pointed appears"optimized file" which is ~3kb smaller then original. I have downloaded this car and size of it is like 161kb while my a lot simpler object weighs 32MB

Using https://gltf-viewer.donmccurdy.com validation i get another warning IMAGE_FEATURES_UNSUPPORTED Image contains unsupported features like non-default colorspace information, non-square pixels, or animation. /images/2

p.s i cant find any GLTF optimisers that would work. gltf.insimo.com hide download button after draco is finished optimizing. Would love to get some instructions how to optimize GLTF files

The file i want to optimize: https://drive.google.com/file/d/1QfFrh7578aRvDWcqViWWYPt6_bQ5ZEVB/view?usp=sharing

What version of nodejs are you using? Sounds like it might just be out of date. This works for me, and reduces the file from 32MB to 24MB.

Also note: The model’s large size is almost entirely due to the textures. You can skip Draco compression (which affects only geometry) and just convert the .gltf to a normal .glb, and you’ll get the same 24MB size you get with Draco.

You probably want to resize these textures, 4K textures don’t seem necessary for this model.

1 Like

I’d suggest avoiding this tool, unfortunately. It creates files that don’t follow the glTF spec. glTF-Pipeline or Blender will create correct Draco-compressed files instead, but you only need Draco optimization if you have a lot of geometry – textures are a different problem.

Im using nodejs version: 12.15.0 LTS just installed today for the first time. Thank you for advice, indeed textures were taking crazy size. I thought it was supposed to be like this and for web applications i had to use draco as it was advertised to reduce up to 90% file size.

Yeah, Draco is great but it won’t help with textures. :slight_smile:

Once you’ve got gltf-pipeline working, my suggestion would be to do:

# unpack textures into external files
gltf-pipeline -i original.gltf -o unpacked.gltf -s`

Then run each texture through https://squoosh.app/ and adjust until you’re happy with the size. Keep it in the same format, with the same filename. If you have to change the format (e.g. PNG to JPG) you’d need to edit the .gltf file in a text editor or Blender, to rename the image. Image types other than PNG and JPG aren’t currently supported.

2 Likes

There’s an ongoing issue with modern node: https://github.com/AnalyticalGraphicsInc/gltf-pipeline/issues/507 node 13 doesn’t work at all, node 12 prints warnings. I had to downgrade to make it work. The problem isn’t directly with gltf-pipeline but cesium.