-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
Bugfix: Fix Anim Tree blending inconsistency #34134
Conversation
3845363
to
b5fb7ce
Compare
I had to change it because there was also a problem with the previous approach (blending from an empty quaternion) that I can't remember now.. let me grab lunch and I can give a check to this |
Updated to master |
Updated to master 4.0 |
@marstaik Is this still desired? If so, it needs to be rebased on the latest master branch. |
Yes, it needs to go in still. Ill see if I can rebase it today. Edit: Done |
7e4b9c8
to
2b5fb6e
Compare
CC @TokageItLab |
I've tried cherry-picking this commit for 3.2.4 to fix my own issue (#46038). This pull request fixes my issue, but it introduces a smaller bug. For some reason this causes animations to have the wrong transforms for a single frame after calling (Edit) I fixed the bug. I don't know if it would work in the general case, but I'll just share it here. I modified
|
Does this issue explain this, where I'm blending two identical rotation degrees (0,0,0) at 50% and it's returning a glitchy rotation? See: https://media4.giphy.com/media/vG6EWD3HUkbqU3Umf0/giphy.gif |
Superseded by #53903. Thanks for the contribution nonetheless! |
This is a too late, but I found a hint to fix this correctly in Godot3, so I am leaving this as a reminder. In Godot4, some of the blend calculation methods have been changed, but as described in #80813, the correct blending can be calculated by computing the total weights first. After all, the main problem with Godot3 blending is that it calculates each blend without knowing the total weights, which leads to incorrect final weight for each. |
Reduz had done some work on this to make it a "nicer" blend, but the logic is non-linear and non-deterministic.
In the old blending method, there is a rot_blend_accum that gets increased for each blend, and then the blend percentage is divided over the maximum.
This leads to non-linear scaling that is non-deterministic, since the order of the blends makes the blend weights different.
IE:
Blend 1 : 0.4 percent
Blend 2: 0.5 percent
Blend 3: 0.1 percent
-> (0.4/0.4 * rotation) * (0.5 / 0.9 * rotation) * ( 0.1 / 1.0 * rotation)
If you change the order:
Blend 3: 0.1
Blend 1: 0.4
Blend 2: 0.5
-> (0.1/0.1 * rotation) * (0.4 / 0.5 * rotation) * (0.5 / 1.0 * rotation)
...Which is inconsistent for the reasons above
This change also causes the triangles in blend spaces to jump dramatically between two zones, as you would go from blending triangle A into triangle B (where Blend 2 & 3 are the common edge between the triangles):
Blend 1: 0.1
Blend 2: 0.5
Blend 3: 0.4
->
Blend 2: 0.5
Blend 3: 0.4
Blend 4: 0.1
Strangely enough, the root motion code above it actually calculates all of the transforms correctly.