
Security News
PodRocket Podcast: Inside the Recent npm Supply Chain Attacks
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
gltf-to-glb
Advanced tools
CLI tool for converting glTF to GLB.
gltf-to-glb
extends the functionality of gltf-pipeline by adding hooks for preprocessing of glTF
files and postprocessing of GLB
files allowing you to more easily plug in certain transformations and optimisations without having to modify the core library. It also makes sure to validate your glTF
file using gltf-validator to flag any potential issues before processing.
$ npm install
$ git submodule init
$ git submodule update
$ npm --prefix ./submodules/gltf-pipeline install ./submodules/gltf-pipeline
$ git submodule update --recursive --remote --force
Live demo of a Draco compressed glTF file rendered in Three.js using HDR Image-based Lighting with run-time generated pre-filtered roughness mipmaps.
Before adding further optimizations like Draco and ZLib compression you have to ask yourself: does it make sense in my context? At what point does it start making sense to use these type of optimizations?
I would say: only when you are dealing with a lot of geometry and a lot of models in your scene. Only then the upfront cost of the ZLib inflating, the Draco decoding and decompression will make up for its own cost. When you have a single model like in the live demo it is likely not worth it. A use case as shown in the video Draco 3D Geometry Compression: Comparing Draco to gzip by Google Open Source
shows that it clearly is worth it when dealing with a lot of geometry.
Please note that textures don't compress well so the cost of ZLib inflating is only really worth it if your model is geometry heavy.
glTF to glb
~ 4.8M (gltf embedded) > 3.6M (glb, requires no decompression)
$ node bin/gltf-to-glb.js -i ./submodules/glTF-Sample-Models/2.0/DamagedHelmet/glTF/DamagedHelmet.gltf -o ./output/DamagedHelmet.glb
glTF to glb using Draco compression
~ 4.8M (gltf embedded) > 3.1M (glb, requires Draco decompression)
$ node bin/gltf-to-glb.js -i ./submodules/glTF-Sample-Models/2.0/DamagedHelmet/glTF/DamagedHelmet.gltf -o ./output/DamagedHelmet_draco.glb -d
glTF to glb using Draco compression and ZLib postprocess compression
~ 4.8M (gltf embedded) > 3.0M (glb, requires ZLib inflating and Draco decompression)
$ node bin/gltf-to-glb.js -i ./submodules/glTF-Sample-Models/2.0/DamagedHelmet/glTF/DamagedHelmet.gltf -o ./output/DamagedHelmet_draco_zlib.glb -post ./plugins/ZLibDeflatePostProcess.js -d
-i, --input [example: ./input/example.gltf] [required]
-o, --output [example: ./output/example.glb] [required]
-d, --draco [true / false, default: false] [not required]
-s, --seperateTextures [true / false, default: false] [not required]
-pre, --preProcess [example: ./plugins/examplePreProcess.js] [not required]
-post, --postProcess [example ./plugins/examplePostProcess.js] [not required]
My work is released under the MIT licence.
FAQs
CLI tool for packing glTF to GLB.
We found that gltf-to-glb demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.