godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.42k stars 20.24k forks source link

Skeleton3D Rest Pose Does Not Effect Final Pose As Expected #75343

Open Kalcen opened 1 year ago

Kalcen commented 1 year ago

Godot version

v4.0.1.stable.official [cacf49999]

System information

Windows 10

Issue description

I'm trying to change a bone's rest pose transform by editing its scale, but it doesn't seem to have any effect when playing an animation clip. The animation clip has no keyframes for scale, and I changed some import settings such as [AnimationPlayer -> Compression -> false], and [AnimationPlayer -> Import Tracks -> Scale -> Never] just in case. However I expect the scale to take effect regardless of what keyframes are in the animation based on this excerpt from the description section of Skeleton3D:

The overall transform of a bone with respect to the skeleton is determined by the following hierarchical order: rest pose, custom pose and pose.

If this isn't the intended use for rest pose, then the next best option I'm guessing would be the "custom pose", but I can't find any mention of the custom pose anywhere else besides in Skeleton3D's description.

https://user-images.githubusercontent.com/38251868/227752543-0f06ea45-9fd5-40d0-8292-8adeb15b3fc3.mp4

Steps to reproduce

Minimal reproduction project

RestPoseIssue.zip

TokageItLab commented 1 year ago

This is the intended behavior of Godot4; in Godot3 the Pose was relative to the Rest, but in Godot4 the Rest is now included in the Pose.

If you want to apply the scale of Rest to the final pose, you need to add it to the AnimationTree's NodeAdd, script the scale to the Pose itself, or use the RealTimeRetarget module to apply a LocalTransform (equivalent to Godot3's Pose system). Well, the custom module is a pain to install, so I am planning to make it an add-on later.

Kalcen commented 1 year ago

but in Godot4 the Rest is now included in the Pose.

I really don't understand what that means. here's my understanding: pose = keyframes of current animation. So then shouldn't there be something underneath those keyframes, and wouldn't it make sense to assume that they would be labeled as the rest pose? Also if the rest pose is "included" in the pose, then shouldn't any changes to the rest pose persist in the pose? I don't understand the difference between the two descriptions you gave. Also what's the deal with custom pose??

you need to add it to the AnimationTree's NodeAdd-

There's no such thing as NodeAdd in AnimationTree, do you mean the Add2 node? Because I tried to add the RESET pose (animation with no keyframes named RESET) to the test animation with keyframes and nothing changed.

Unnamed2

Scripting the scale is definitely an option (albeit becomes a nightmare when trying to keep a child bone from being skewed from a parent bone's non-uniform scale, but that's a whole separate issue I plan to submit at some point). But I thought that there would be a more straight forward approach to this given the way the docs describe things.

TokageItLab commented 1 year ago

It means that:

This change was made primarily because the model output from Maya does not have a Rest, and to allow simpler retargeting with simpler data. See also Animation data rework for 4.0.

However, there is certainly a disadvantage if you want the Rest to have any information, so an alternative is the implementation of the RealTimeRetarget plugin.

TokageItLab commented 1 year ago

Well, for those who don't need an exaggerated implementation like RealTimeRetarget, we can distribute a custom class as an add-on that simply extends AnimationPlayer to reproduce Godot 3's behavior. Sorry, but I'm busy with other things at the moment, so please wait a while.