Fix wrong interpolation ratio in glTF TrackData.populateTransform()#2897
Open
DieterDePaepe wants to merge 1 commit into
Open
Fix wrong interpolation ratio in glTF TrackData.populateTransform()#2897DieterDePaepe wants to merge 1 commit into
DieterDePaepe wants to merge 1 commit into
Conversation
When a node's translation/rotation/scale channels carry different keyframe timestamps, update() merges them onto one shared time grid and gap-fills missing samples via populateTransform()/interpolate(). The blend ratio for that interpolation was computed as "currentKeyFrame.time / (nextKeyFrame.time - lastKeyFrame.time)", missing "- lastKeyFrame.time" in the numerator. Instead of the intended 0..1 blend position within [lastKeyFrame.time, nextKeyFrame.time], this passed the clip's absolute elapsed time into Quaternion.nlerp(), which doesn't clamp its blend parameter and so extrapolated wildly rather than interpolating.
Contributor
There was a problem hiding this comment.
Code Review
This pull request corrects the interpolation ratio calculation in TrackData.java by subtracting the last keyframe's time from the current keyframe's time, ensuring proper interpolation between keyframes. There are no review comments, so I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a node's translation/rotation/scale channels carry different keyframe timestamps, update() merges them onto one shared time grid and gap-fills missing samples via populateTransform()/interpolate(). The blend ratio for that interpolation was computed as
"currentKeyFrame.time / (nextKeyFrame.time - lastKeyFrame.time)", missing "- lastKeyFrame.time" in the numerator. Instead of the intended 0..1 blend position within [lastKeyFrame.time, nextKeyFrame.time], this passed the clip's absolute elapsed time into Quaternion.nlerp(), which doesn't clamp its blend parameter and so extrapolated wildly rather than interpolating.
Only triggers on the "channels don't share identical keyframe times" merge
path (
equalTimes(timeArrays)false) — simple clips where every channel issampled at the same rate never hit it.
Verified against a real affected clip: a bone was rotating >100° from bind
mid-clip in a stretch where the source data is smooth; after the fix,
motion is normal throughout.
Forum discussion: https://hub.jmonkeyengine.org/t/wrong-interpolation-in-gltf-loader/49640
(Created with help from AI)