A node.js CLI tool for converting packed LDraw models (.mpd) to GLTF's binary
.glbformat.
mpd2glb reads packed .mpd LDraw models (see below for details) and generates a new GLTF binary model .glb with most similar features to the original LDraw model.
The final .glb model will have the real-world dimensions of the original model, i.e. scaled to centimeters instead of LDUs.
- Multi-platform - Built on node.js with cross-platform dependencies
- Automated conditional lines clean-up - Avoids visual artifacts on the output model
- Rescaling models to real-world size - Converts LDU dimensions to real-world metrics:
.glbmodels are real-size ones! - Meshopt optimized - For quick load times and rendering on browser or elsewhere!
- No LDraw parts library dependency - Requires input .mpd models to be packed first, take a look at:
I've built and tested this tool with the following (other versions could also work):
git clone https://github.com/anteloc/mpd2glb.git
cd mpd2glb
npm install # install required node modules
npm run build # outputs: mpd2glb.mjs executablenpm main.mjs
# or
bun main.mjs
# or (bun only!)
bun mpd2glb.mjsThis is a very simple tool, try it with a sample packed model (included):
node main.js models/f1-car-packed.mpd f1-car.glb
# or (faster execution!)
bun mpd2glb.mjs models/f1-car-packed.mpd f1-car.glbTo see the result, open the f1-car.glb model on an editor, like e.g. Three.js Editor
- The resulting
.glbfiles can be imported and edited with other tools - World-size models (centimetres): on some editors, they will look very small or even hard to find
- Editable parts: individual parts can be handled independently.
