Skip to content

anteloc/mpd2glb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mpd2glb

A node.js CLI tool for converting packed LDraw models (.mpd) to GLTF's binary .glb format.

Node.js v24.11 License: MIT

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.

Features

  • 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: .glb models 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:

Quick Start

Prerequisites

I've built and tested this tool with the following (other versions could also work):

Building from source (no other way for now!)

git clone https://github.com/anteloc/mpd2glb.git
cd mpd2glb
npm install # install required node modules
npm run build # outputs: mpd2glb.mjs executable

Verify it works

npm main.mjs
# or
bun main.mjs
# or (bun only!)
bun mpd2glb.mjs

Usage

This 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.glb

To see the result, open the f1-car.glb model on an editor, like e.g. Three.js Editor

alt text

Notes

  • The resulting .glb files 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.

About

A CLI tool for converting packed LDraw models (.mpd) to GLTF (.glb) format

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors