-
Notifications
You must be signed in to change notification settings - Fork 410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[vrm-animation] VrmAnimationExporter の実装と bvh 変換の実験 #2093
Conversation
GltfExportSettings settings) | ||
: base(data, settings) | ||
{ | ||
settings.InverseAxis = Axes.X; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VRM-1.0 仕様に合わせて、x-inverse
{ | ||
base.Export(new RuntimeTextureSerializer()); | ||
|
||
addFrames(this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ここで具体的なエクスポートをする。
- 初期化
- each frame
- 書き出し
// setup | ||
// | ||
var map = new Dictionary<HumanBodyBones, Transform>(); | ||
var animator = bvh.Root.GetComponent<Animator>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
humanoid を利用するため animator 経由で transform を得る
var vrmBone = Vrm10HumanoidBoneSpecification.ConvertFromUnityBone(kv.Key); | ||
var parent = GetParentBone(map, vrmBone) ?? bvh.Root.transform; | ||
vrma.AddRotationBoneAndParent(kv.Key, kv.Value, parent); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ここまでで T-Pose
を登録している
state.time = (float)time.TotalSeconds; | ||
animation.Sample(); | ||
vrma.AddFrame(time); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
各フレームのデータを取得している
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ちなみに BVH ファイルはかなりあいまいな仕様フォーマットだという認識がありますが、この BVH to VRMA 変換において BVH ファイルに暗黙に求めている条件などありますか?
あるなら、それをコメントに書いておくと忘れなくてよさそうです。
たとえば 1 フレームは T ポーズを求めている、とか(わからないけど)
使える bvh の条件と、humanbone 割り当て関連の注意書きを追加しました。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
API としてはもうちょっと分かりやすいものにできそうだけど、とりあえず動くものを。
の3ステップに組み替えて Exporter を隠蔽した方が良いかもしれない。