Skip to content

Avatar interpolation#2169

Open
ada-tv wants to merge 9 commits intooverte-org:masterfrom
ada-tv:feature/avatar-lerp
Open

Avatar interpolation#2169
ada-tv wants to merge 9 commits intooverte-org:masterfrom
ada-tv:feature/avatar-lerp

Conversation

@ada-tv
Copy link
Copy Markdown
Collaborator

@ada-tv ada-tv commented Apr 10, 2026

Fixes #1280

In both demo videos the client being looked at is limited to 5 FPS to make the interpolation more visible.

Master

avatar-lerp-master.webm

This PR

avatar-lerp-pr.webm

@ada-tv ada-tv added enhancement New feature or request needs CR This pull request needs to be code reviewed needs QA This pull request needs to be tested NLnet labels Apr 10, 2026
Copy link
Copy Markdown
Member

@HifiExperiments HifiExperiments left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oooo this is super cool

@ada-tv
Copy link
Copy Markdown
Collaborator Author

ada-tv commented Apr 10, 2026

Something 7 and I have found in testing is that clients at a higher framerate seem to jitter and ones at low framerates are smooth. I'm not sure yet what the problem might be

@ksuprynowicz
Copy link
Copy Markdown
Member

I sorted out the jitter issue. I'll try to have pull request ready in the evening :)

@ksuprynowicz
Copy link
Copy Markdown
Member

I think I figured it out:
ada-tv#2

@ksuprynowicz
Copy link
Copy Markdown
Member

I got backtrace for the crash:

OtherAvatar::interpolateJoints OtherAvatar.cpp:282
OtherAvatar::simulate OtherAvatar.cpp:423
AvatarManager::updateOtherAvatars AvatarManager.cpp:346
Application::update Application.cpp:2319
Application::idle Application.cpp:1875
Application::event Application_Events.cpp:103
QApplicationPrivate::notify_helper(QObject *, QEvent *) 0x00007fffe7764240
Application::notify Application_Events.cpp:61
QCoreApplication::notifyInternal2(QObject *, QEvent *) 0x00007ffff6ee9f88
QCoreApplicationPrivate::sendPostedEvents(QObject *, int, QThreadData *) 0x00007ffff6eed444
<unknown> 0x00007ffff6f48ba7
<unknown> 0x00007fffddf0166e
<unknown> 0x00007fffddf049ff
g_main_context_iteration 0x00007fffddf05190
QEventDispatcherGlib::processEvents(QFlags<…>) 0x00007ffff6f481ca
QEventLoop::exec(QFlags<…>) 0x00007ffff6ee88ba
QCoreApplication::exec() 0x00007ffff6ef146f
main main.cpp:850
__libc_start_call_main 0x00007fffe6f3df75
__libc_start_main_impl 0x00007fffe6f3e027
_start 0x00005555557d3771

@ksuprynowicz
Copy link
Copy Markdown
Member

The crash happens due to _jointHistory still being empty at the time interpolateJoints is called. Would checking for _jointHistory size and skipping interpolation when the size doesn't match _jointData a reasonable workaround?

@ada-tv
Copy link
Copy Markdown
Collaborator Author

ada-tv commented Apr 11, 2026

Would checking for _jointHistory size and skipping interpolation when the size doesn't match _jointData a reasonable workaround?

I think that's the only solution, if there's no history to interpolate from then it can't interpolate

@ksuprynowicz ksuprynowicz added QA approved This pull request has been successfully tested and removed needs QA This pull request needs to be tested labels Apr 12, 2026
@ksuprynowicz
Copy link
Copy Markdown
Member

After the fix this PR is rock-solid now :)

@ada-tv
Copy link
Copy Markdown
Collaborator Author

ada-tv commented Apr 12, 2026

I could hook up rotation interpolation, but I'd need your help getting it to be smooth. My naive impl was stuttering like joints were before your fix.

Position might be harder since avatars have separately networked local and global positions. Some day we need to clean up AvatarData to always just use local positions even when there's no parent, like how avatar rotation is currently. For now I think the forever-ease-out on the global position is good enough until we can get around to that.

@ksuprynowicz
Copy link
Copy Markdown
Member

If you add rotation, I'd love to help on signal processing side as with joint positions :)

@ada-tv
Copy link
Copy Markdown
Collaborator Author

ada-tv commented Apr 12, 2026

Now that avatars move smoothly, it's been revealed that #1634 affects entities parented to OtherAvatars too, not just MyAvatar. It was just harder to notice because avatars were already jittery when moving. Weirdly, they seem to stutter when new joint frames are received, but look smooth between each frame. This bug is unrelated to this PR and will have to be fixed later.

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

Labels

enhancement New feature or request needs CR This pull request needs to be code reviewed NLnet QA approved This pull request has been successfully tested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Avatar motion interpolation

3 participants