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

Implement additive animation using a base pose in AnimationNodeAdd2 #2700

Closed
josefkaragoli opened this issue May 8, 2021 · 10 comments
Closed
Milestone

Comments

@josefkaragoli
Copy link

Describe the project you are working on

3D project with animations

Describe the problem or limitation you are having in your project

The only method currently in Godot to mix animations is through Blend nodes (Blend2/3, BlendSpace1D/2D, Blendtree) and Add nodes (Add2/3). These two types of blending effectively do the same thing, as they use the same internal blend_input() function (see godotengine/godot#37661).

A vital part of character locomotion nowadays is to include additive animations - namely, animations that are overlayed upon other animations to create various realistic effects eg. leaning/changing character stance etc.

godotengine/godot#42302 attempts to address this issue by exposing a 'add_directly' parameter, but
it's very limited and is unclear in functionality. This is because additive animation requires a base pose from which the animation offsets can be calculated - the additive data should be extracted RELATIVE to a base pose, and the pull request does not actually specify or allow you to change what base pose is being used.

Here is an example of how UE4 allows you to change the base pose from which animation offsets are calculated.
image

Describe the feature / enhancement and how it helps to overcome the problem or limitation

My proposal is to remove the old functionality of Add2/3 since they effectively do the same thing as Blend2/3 albeit in a different format. I haven't seen anyone using Add over Blend since it's not really more useful, and its also harder to understand what it actually does (less straight forward than blending two anims).
Instead, Add2/3 should solely be used for additive animations and a new graph input should be exposed called 'base' which will be used to extrapolate additive offsets.

Example use case from Stride engine:
download
Leftmost animation = Walk animation
Rightmost animation = Idle animation
Two animations in the center = Walk and Idle animations with Reload animation added ontop

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

image

'in' is the input feed.
'add' is the additive animation that is overlayed on top of the input feed ('in')
'base' is the reference pose used to calculate the offset of 'add' to apply to 'in'

If this enhancement will not be used often, can it be worked around with a few lines of script?

Additive animation is used very often to create a variety of different movements with lesser amounts of animation clips. Also, AnimationNode behaviour can not be scripted outside of core.

Is there a reason why this should be core and not an add-on in the asset library?

There is no way to change functionality of AnimationNodes outside of core.

Additional references :

https://doc.stride3d.net/latest/jp/manual/animation/additive-animation.html - see "Difference Clips" section (basically Stride's way of saying additive animation)

https://docs.unrealengine.com/udk/Three/AdditiveAnimations.html

@Calinou Calinou changed the title Additive animation using a base pose in AnimationNodeAdd2 Implement additive animation using a base pose in AnimationNodeAdd2 May 8, 2021
@josefkaragoli
Copy link
Author

I would also like to add that the same thing be applied to AnimationNodeAdd3, since it would use the same framework.

@josefkaragoli josefkaragoli changed the title Implement additive animation using a base pose in AnimationNodeAdd2 Implement additive animation using a base pose in AnimationNodeAdd2 and AnimationNodeAdd3 May 8, 2021
@TokageItLab
Copy link
Member

TokageItLab commented May 10, 2021

In glTF Godot 3 animation, all poses value are relative to the default pose (e.g. T Pose). I've read that AdditiveAnimation creates a value relative to the Idle Pose instead of T Pose.

I agree that removing the old NodeAdd2/Add3 behavior. See also #34134. However, adding the input of Base to the current NodeAdd2 is may be bound to cause confusion.

Is In: A, Add: B, Base: C the desired result A + (B - C)? If so, how about simply implementing NodeSub2 to do the subtraction?

@josefkaragoli
Copy link
Author

@TokageItLab Your points are valid and the NodeSub2 idea is a good solution, especially since its easier to understand. It might be a bit harder to implement though, but I'm not 100% sure

@josefkaragoli
Copy link
Author

Should I update the proposal?

@TokageItLab
Copy link
Member

TokageItLab commented May 13, 2021

We don't know yet how it will be implemented in fact. You have been able to tell us what you want to do, so I think if the substance doesn't change significantly, you don't have to update it.

@josefkaragoli josefkaragoli changed the title Implement additive animation using a base pose in AnimationNodeAdd2 and AnimationNodeAdd3 Implement additive animation using AnimationNodeAdd2/3 and AnimationNodeSub2/3 May 14, 2021
@Mikeysax
Copy link

Isn't this fixed?

godotengine/godot#57675

@TokageItLab TokageItLab changed the title Implement additive animation using AnimationNodeAdd2/3 and AnimationNodeSub2/3 Implement AnimationNodeSub2/3 for additive animation Nov 21, 2022
@TokageItLab
Copy link
Member

The addition is now done correctly, but the extraction node is not yet implemented. Changed title.

@TokageItLab
Copy link
Member

Well, I would guess from the original title that this can be closed. The blending is now calculated based on rest correctly, so the Additive Blend should work fine.

@TokageItLab TokageItLab changed the title Implement AnimationNodeSub2/3 for additive animation Implement additive animation using a base pose in AnimationNodeAdd2 Dec 21, 2022
@TokageItLab
Copy link
Member

Closed by godotengine/godot#57675

@TokageItLab TokageItLab added this to the 4.0 milestone Dec 21, 2022
@Riordan-DC
Copy link

Can these animation fixes benefit 3.x also?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants