godotengine / godot

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

Animation on imported .blend file plays incorrectly at different playback_speed rates. #64594

Closed jitspoe closed 2 years ago

jitspoe commented 2 years ago

Godot version

v4.0.alpha.custom_build [2475393f2]

System information

Windows 10, GLES3, NVidia RTX 3080

Issue description

I noticed the animations were playing faster in-game than the animation I had in blender. I thought perhaps the animation was playing at the fps of my monitor instead of the animation framerate, since I had a 144hz monitor, so as an experiment, I tried setting the playback_speed to 60/144, and that's when I noticed the animation played differently. Like the bones don't rotate as much or it's skipping frames or something.

I have a kick animation that brings the foot all the way up to the crosshair: image

But if I set the playback_speed to a smaller value, the kick doesn't go as high. Here at 0.3, the foot only shows up on the bottom of the screen and makes it nowhere near the center where the crosshair is:

image

Steps to reproduce

Import a .blend file with an armature and animations at 60fps (not sure if 60fps matters. That's just what I'm using both in blender and the import settings). Play the animation using the AnimationPlayer3D .play() function. Set the playback_speed to 0.3 Play the animation again and note differences.

Minimal reproduction project

Here's the .blend file I had the problem with. Animation is "kick_left_1".

main_character.zip

jitspoe commented 2 years ago

Note: It seems like the in-game animation player is ignoring the time between keyframes, maybe, and just playing them all with the same time? I extended the keyframes with the foot out for like several seconds, and the foot still returns immediately, even though the editor animation player keeps the leg extended for a while.

fire commented 2 years ago

Will need to check https://github.com/godotengine/godot/pull/64132

jitspoe commented 2 years ago

Will need to check #64132

I tried completely disabling the optimizer when importing, and that didn't seem to have any impact on it. image

Also, that throws out my hypothesis about the blank frames getting ignored and it just playing the anim as if all the key frames have the same time between them. There's now a key frame for every frame of animation.

image

Really unsure as to what's going on here.

fire commented 2 years ago

Some notes:

  1. you have some error on rigging. Might need to use delta mush via svd optimization. https://blendermarket.com/products/corrective-smooth-baker "Bulging."

  2. Scaling the keyframes by 4 seems to find your desired keyframe. [edited] try 60 * 4 fps [edited] try 120 fps

    Screenshot 2022-08-19 053515
  3. I tried bake animation with no effect

  4. I pushed animations down https://github.com/tinmanjuggernaut/blender-pushdownall with no effect

main_character.zip

fire commented 2 years ago

@calinou is there a reason why we have limited fps to 120? Trying to use 240 fps

@jitspoe Try 120 fps.

Calinou commented 2 years ago

@Calinou is there a reason why we have limited fps to 120? Trying to use 240 fps

Not that I know of, but I see very few practical reasons to use animations authored at a framerate higher than 120 FPS.

jitspoe commented 2 years ago

Closing this -- I think it was just a script error on my part (playing an animation that canceled out the animation before it had a chance to fully play). My bad!