Skip to content

fix anims interpolating from 0 instead of valid initial data#76

Open
RetroZelda wants to merge 1 commit into
HailToDodongo:mainfrom
RetroZelda:fix/jank-animation
Open

fix anims interpolating from 0 instead of valid initial data#76
RetroZelda wants to merge 1 commit into
HailToDodongo:mainfrom
RetroZelda:fix/jank-animation

Conversation

@RetroZelda
Copy link
Copy Markdown

kfCurr and kfNext are zero from calloc(line 53|54). Without priming them, the first t3d_anim_update() interpolates from zero toward the first keyframe value, causing bones to blend in from the origin.

This will read the first keyframe for every channel so kfNext holds real data, then mirror it into kfCurr so both ends of the interpolation start at the actual first-frame pose. rewind_anim() resets timeEnd and the file position without touching kfCurr/kfNext, leaving the animation ready for normal playback at t=0.

Before:
image

After:
image

@HailToDodongo
Copy link
Copy Markdown
Owner

HailToDodongo commented May 11, 2026

In theory this shouldn't happen already, the way keyframes are stored is that they encode the time when they are needed to be fetched, not when they start.
So the next KFs are always fetched in advance, even after the very first animation update.
Meaning at the start, there should be 2 KFs queued up to do so.

If this is broken, then the fix should be to emit proper KFs at build to make sure current and next are filled by default without any special logic.

Can you post a model where this happens / the code to trigger this issue?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants