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

Add RetargetModifier3D for realtime retarget to keep original rest #97824

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

TokageItLab
Copy link
Member

@TokageItLab TokageItLab commented Oct 4, 2024

Closes godotengine/godot-proposals#3379

RetargetModifier3D

Add RetargetModifier3D. Currently Godot performs retargeting by overwriting rest. However, that means discarding the bone rest which set in the DCC, and it is quite possible that the axis of rest will be in an unintended direction. It makes re-targeting useless for specifying IK pole vectors and setting constraints for specific axes.

This PR solves this problem by retargeting the parent skeleton with the rest defined in the SkeletonProfile and the child skeleton holding the original rest with the RetargetModifier that will be added in this PR. Also keep in mind that parenting is required to guarantee process order.

image

The Profile specified to RetargetModifier3D is used only as a list of bone names, so if you want to retarget only specific bones, you can create a custom SkeletonProfile with arbitrary bone names only and set it to the RetargetModifier3D.

It has the following two types of retargets by Use Global Pose option.

Use Global Pose option

If enabled, retargeting is enabled when the parent of the source bone is deformed, even if the target bone is less than the source bone. However, as a limitation, the lengths of the bones must be exactly equal. For example a specific use case, adding a dummy bone with zero length helps share animation between models with different numbers of bones.

retmod002.mp4

If disabled, retargeting is not performed when the parent of the source bone is deformed if the target bone is less than the source bone. However, it is possible to retarget bones of different lengths without destroying the appearance of the bones. For example a specific use case, you can retarget a chibi character from a skeleton that matches your real body shape for XR motion tracking. In addition, position, rotation, and scale can be handled individually.

image

Post importer change

Add option to separate unmapped bone library

image

Add option to use RetargetModifier to keep original rest

image image

Note that the Rename Bone option must be enabled.

image

@fire
Copy link
Member

fire commented Oct 5, 2024

Is there particular tests you want us to look at? I'll try to review this as soon as possible.

@TokageItLab TokageItLab force-pushed the retarget-modifier branch 3 times, most recently from 61da730 to 8346442 Compare October 5, 2024 07:19
@TokageItLab
Copy link
Member Author

TokageItLab commented Oct 5, 2024

I put the project that I used to test the behavior on my end. I would appreciate it if you could retarget other models or test the combination with XRModifier like one more RetargetModifier to the GeneralSkeleton parent to retarget from the real body shape skeleton with tracking. cc @Malcolmnixon

retarget-modifier-test.zip

Godette / CC by SirRichard94
Blender Chan! / CC by SearKitchen
Alicia Solid / DWANGO Co., Ltd.

@TokageItLab TokageItLab force-pushed the retarget-modifier branch 2 times, most recently from 3cdd2eb to 42eda8c Compare October 5, 2024 07:46
@TokageItLab
Copy link
Member Author

TokageItLab commented Oct 5, 2024

It may be possible (not so at the current this PR) to modify it so that Skeleton can create a children list even if it is not a direct child of RetargetModifier like:

ParentSkeleton
└RetargetModifier
 └Node
  └ChildSkeleton <- detect

but it will need to be tested.

I will try to improve this in a later Follow up PR, as it could be applied to SkeletonModifier lists that are direct children of Skeleton to organize tree view like:

Skeleton
├Node
│├ModifierA_1
│└ModifierA_2
└Node_2
 ├ModifierB_1
 └ModifierB_2

@TokageItLab TokageItLab requested review from a team as code owners October 15, 2024 13:47
@fire
Copy link
Member

fire commented Oct 15, 2024

I have tested this on https://github.com/V-Sekai/godot-humanoid-project where we retarget a character body without a UpperChest to a character body that has does not have a UpperChest but only has a Chest.

Note that there a difference in animation in the godot-humanoid-project but it is unrelated to this pr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Ready for review
Development

Successfully merging this pull request may close these issues.

Implement Skeleton re-targeting node
2 participants