-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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 position track normalization to importer retarget #63138
Add position track normalization to importer retarget #63138
Conversation
4437a59
to
3daaefe
Compare
I have one concern: skeletons with motion scale make it difficult to handle position tracks in inspector and somewhere. As noted in the documentation, the position of a skeleton with a non 1.0 motion scale does not match the value of the position track key. Although I made the normalization depend on the motion scale when inserting the key, it may still be confusing because the actual position and the key value are different. The smarter way I can think of is to add a With the above implementation, non-normalized keys can be written and played. Then by adding a method for conversion, it can be converted to normalized track as needed. However, in the past, I had a huge dispute with @reduz about adding attributes to tracks and creating 3D Skeleton animations on Godot, so for now, this is a simplified implementation as it is now. I will send additional PR later if really needed the additional track attribution. |
c0cbd7f
to
2231353
Compare
2231353
to
5e3f6dd
Compare
5e3f6dd
to
7cf604b
Compare
3e7afe0
to
444037e
Compare
b23b130
to
014235f
Compare
014235f
to
dde235a
Compare
@reduz I fixed the part pointed out. |
Looks great!! |
Thanks! |
Section 4 and 5 (partialy) of godotengine/godot-proposals#4510.
Solves problems caused by the combination of body height differences and position tracks.
This should allow for sharing of animations among some models in most simple cases, except for the bone mapping hassle.
Add position track normalization to importer and add
motion_scale
to Skeleton3DThe importer retarget assumes the motion scale to be the height from the world origin of the bone specified as the bone of
motion_scale_base
in the profile. In most cases, themotion_scale
will match the hips height.As far as I know, most game engines and retargeting systems use hips height as the motion scale.
The key value of the imported position track is normalized by dividing by the
motion_scale
. The motion scale is then stored in the skeleton, and when the animation is played back, the position track is multiplied by themotion_scale
of the skeleton to which it is applied.Also, added
_post_process_key_value()
toAnimationPlayer
andAnimationTree
as a virtual function.The
motion_scale
multiplication is done in it. In some cases, we can override this function in a custom module to implement real-time retargeting, etc.1Add Track Organizer
Unimportant Positions
Remove unimportant position tracks (other than Root and motion_scale_base ≈ Hips) that have been mapped.
Unmapped Bones
Remove unmapped bone TRS3D tracks.
Other fixes
_pre_fix_animations()
,_post_fix_animations()
from_post_fix_node()
. As side effect, fixed Discrepancy between built-in animation and same animation saved to file from imported gltf #63158.Test model
Blender Chan! / CC by SearKitchen
https://sketchfab.com/3d-models/blender-chan-6835f0d60e0c4813812c0247e3b73da7
Footnotes
It might be better to use
GDVIRTUAL
, it is possible to override function while the game is running, but we could not function it on the editor. ↩