Skip to content
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

Merged
merged 5 commits into from
Jul 3, 2023

Conversation

ousttrue
Copy link
Contributor

@ousttrue ousttrue commented Jun 19, 2023

API としてはもうちょっと分かりやすいものにできそうだけど、とりあえず動くものを。

  • 初期化(T-Pose)
  • 各フレーム
  • 書き出し

の3ステップに組み替えて Exporter を隠蔽した方が良いかもしれない。

GltfExportSettings settings)
: base(data, settings)
{
settings.InverseAxis = Axes.X;
Copy link
Contributor Author

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);
Copy link
Contributor Author

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>();
Copy link
Contributor Author

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);
}
Copy link
Contributor Author

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);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

各フレームのデータを取得している

Santarh
Santarh previously approved these changes Jul 3, 2023
Copy link
Contributor

@Santarh Santarh left a 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 ポーズを求めている、とか(わからないけど)

@ousttrue
Copy link
Contributor Author

ousttrue commented Jul 3, 2023

使える bvh の条件と、humanbone 割り当て関連の注意書きを追加しました。

@ousttrue ousttrue requested a review from Santarh July 3, 2023 09:49
Copy link
Contributor

@Santarh Santarh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ousttrue ousttrue merged commit 6ba2cd2 into vrm-c:master Jul 3, 2023
1 check failed
@ousttrue ousttrue mentioned this pull request Jul 5, 2023
2 tasks
@ousttrue ousttrue deleted the fix/vrma_export branch January 24, 2024 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants