Categorygithub.com/binzume/modelconv
repository
0.3.5
Repository: https://github.com/binzume/modelconv.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# README

Experimental 3D model converter

Build Status Go Reference license

Goで3Dモデルファイルを読み書きするライブラリ&変換ツールです.

FormatReadWriteComment
.mqo/.mqozボーン・モーフに対応
.gltf/.glb他フォーマットへの変換は暫定実装
.vrmglTF 用のエクステンション
.pmx/.pmd.pmd は Read only
.fbx出力はASCIIのみ
.unityUnity 2018以降のシーンに対応
.vmd暫定実装

仕様が良くわかからないものは実際のファイルを見ながら雰囲気で実装してるので,読み込めないデータがあるかもしれません.

Command-line tool

cmd/modelconv

以下の組み合わせの変換が可能です.

  • (.pmd | .pmx | .mqo | .mqoz | .fbx | .unity) → (.pmx | .mqo| .mqoz | .glb | .gltf | .vrm)
  • (.glb | .gltf | .vrm) → (.glb | .gltf | .vrm) (※1)

※1: glTF同士の変換は特別扱いをしているため,モデルに変更を加えるオプションは未対応です.(scaleは可能)

Install "modelconv" commant

新し目のGoがあればビルドできると思います. Releasesにビルド済みのWindows用の実行ファイルを置いてあります.

go install github.com/binzume/modelconv/cmd/modelconv@latest

Usage examples

MMD to VRM

modelconv -autotpose "右腕,左腕" "model.pmx" "model.vrm"
modelconv -vrmconfig "model.vrmconfig.json" "model.pmx" "model.vrm"

gltf to glb

modelconv "model.gltf" "model.glb"
modelconv -format glb "model.gltf"

Unity to glb

modelconv  "test.unitypackage#Assets/scene.unity" "scene.glb"
modelconv  "YourProject/Assets/Scenes/scene.unity" "scene.glb"

Scaling

modelconv -scale 1.5 "model.glb" "model_scaled.glb"
modelconv -scaleY 1.5 -scaleX 1.3 "model.mqo" "model_scaled.mqo"

Flags

FlagDescriptionDefault
-formatOutput format
-scaleScaleSee Unit
-scaleXScale x-axis1.0
-scaleYScale y-axis1.0
-scaleZScale z-axis1.0
-rot180rotate 180 degrees around Y-axis
-hidehide objects (OBJ1,OBJ2,...)
-hidemathide materials (MAT1,MAT2,...)
-unlitunlit materials (MAT1,MAT2,...)
-vrmconfigConfig file for VRM"inputfile.vrmconfig.json"
-autotposeArm bone names
-chparentreplace parent bone (BONE1:PARENT1,BONE2:PARENT2,...)
-physicsConvert Physics colliders (experinemtal)false

vrmconfig:

設定ファイルのjsonは converter/vrmconfig_presets にあるファイルや, Qiitaの記事も参考にしてください.

MMDからの変換時にはデフォルトで mmd.json が使われます.

hide,hidemat,unlit:

対象のオブジェクトやマテリアルの名前をカンマ区切りで指定してください.ワイルドカード(*)が利用可能です.

autotpose:

腕のボーンを指定するとX軸に沿うように形状を調整します(暫定実装)

Unit:

  • MQO: 1mm
  • MMD: 80mm
  • glTF/VRM: 1m

例: MMD → VRM : default scale = 0.08

API

T.B.D.

Example: .pmx to .mqoz

	mmdModel, err :=  mmd.Load("model.pmx")
	if err != nil {
		return err
	}
	mqDoc, err := converter.NewMMDToMQOConverter(nil).Convert(mmdModel)
	if err != nil {
		return err
	}
	err = mqo.Save(mqDoc, "model.mqoz")
	if err != nil {
		return err
	}

License

MIT License