GithubHelp home page GithubHelp logo

modelconv's Introduction

Experimental 3D model converter

Build Status Go Reference license

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

Format Read Write Comment
.mqo/.mqoz ボーン・モーフに対応
.gltf/.glb 他フォーマットへの変換は暫定実装
.vrm glTF 用のエクステンション
.pmx/.pmd .pmd は Read only
.fbx 出力はASCIIのみ
.unity Unity 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 -physics -unlit "*" -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

Flag Description Default
-format Output format
-scale Scale See Unit
-scaleX Scale x-axis 1.0
-scaleY Scale y-axis 1.0
-scaleZ Scale z-axis 1.0
-rot180 rotate 180 degrees around Y-axis
-hide hide objects (OBJ1,OBJ2,...)
-hidemat hide materials (MAT1,MAT2,...)
-unlit unlit materials (MAT1,MAT2,...)
-alpha override material alpha (MAT1:A1,MAT2,A2)
-morph apply morph (MORPH1:value1,MORPH2,value2)
-vrmconfig Config file for VRM "inputfile.vrmconfig.json"
-autotpose Arm bone names
-chparent replace parent bone (BONE1:PARENT1,BONE2:PARENT2,...)
-physics Convert 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

modelconv's People

Contributors

binzume avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

modelconv's Issues

scaleMat is always empty in ApplyTransform

Hello,
could you help me figure it out? As i can see scaleMat is always empty and never changes.

scaleMat := geom.NewMatrix4().Clone()
scaleMat[12], scaleMat[13], scaleMat[14] = 0, 0, 0 // remove translate

Because of this, almost all code does nothing. And model transforms incorrectly. Could you say what wrong with it?
I tried to use transformMat without transition (and some other combinations), but it doesn't work too.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.