22 lines
1.5 KiB
Markdown
22 lines
1.5 KiB
Markdown
# Mson -> THREE
|
|
|
|
Convert [Mson](https://github.com/MineLittlePony/Mson) models to THREE.js object JSON or GLTF.
|
|
|
|
## Setup
|
|
|
|
1. Clone and `npm install`. Optional dependencies are required when using this on Node.js (see implementation notes below).
|
|
2. copy the folder at https://github.com/MineLittlePony/Mson/tree/1.20.2/src/main/resources/assets/mson/models/entity as `inputs/mson`
|
|
3. build `npm run build`
|
|
4. run `node lib/cli.js export <model name>`
|
|
|
|
Output will be placed in `outputs`. For more options run `node lib/cli.js export -h`.
|
|
|
|
## Implementation notes
|
|
|
|
1. Mson models seem to have the X and Y coordinates inverse of what THREE.js uses (and Minecraft for that matter, lol).
|
|
2. Many Mson example models do not work. They seem to be all either outdated or just outright broken. Mine Little Pony works fine, though.
|
|
3. Most of the code here makes a lot of assumptions. This project is a reverse engineering of the format, not a Java to JavaScript port of Mson's rendering engine. It should not be used in any serious capacity, as it was only made as an experiment.
|
|
4. THREE.js GLTF exporter does not support Node.js by default, so some extra junk was included to support it. You can omit pretty much the entire `optionalDependencies` array of items (and `src/cli.ts` + `src/node`) to use this library on the browser.
|
|
5. The parser and object generator by themselves have no dependencies except for THREE.js, of course.
|
|
6. Output could be further optimized by merging composite objects into a single geometry, but this is not yet done.
|