fix: Lerp smoothing frame rate dependence and freeze at maximum interpolation - #4132
fix: Lerp smoothing frame rate dependence and freeze at maximum interpolation#4132NoelStephensUnity wants to merge 3 commits into
Conversation
…polation time The lerp smoothing pass used by the Lerp and SmoothDampening interpolation types applied a fixed factor of 1.0 minus the maximum interpolation time once per frame, with no delta time. The wall clock smoothing rate therefore scaled with the frame rate, so the same setting smoothed by different amounts on different hardware. The factor is now raised to the number of 60fps reference frames elapsed, which makes the rate a function of elapsed time. Results at 60fps are unchanged for every legal setting. Separately, a maximum interpolation time of 1.0 (the upper bound of the inspector range) produced a factor of exactly 0, so the interpolated value never advanced and the transform stopped moving entirely on all three axes. The retained portion is now clamped just below 1.0. This is an independent defect, as raising 1.0 to any power is still 1.0. The LegacyLerp path was already frame rate correct and is unchanged. The documentation on the lerp smoothing fields described the LegacyLerp formula for all interpolation types and has been corrected.
Codecov ReportAll modified and coverable lines are covered by tests ✅ @@ Coverage Diff @@
## develop-3.x.x #4132 +/- ##
=================================================
+ Coverage 78.00% 78.03% +0.03%
=================================================
Files 153 153
Lines 26260 26264 +4
=================================================
+ Hits 20483 20496 +13
+ Misses 5777 5768 -9
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 5 files with indirect coverage changes
|
There was a problem hiding this comment.
💡 Harness Review
The time-based smoothing implementation correctly preserves the 60 Hz behavior for the updated interpolation modes, but its public documentation now overstates the guarantee for the legacy path.
Reviewed commit 363c94d
🤖 Helpful? 👍/👎
| /// When enabled, the <see cref="BufferedLinearInterpolator{T}"/> will apply a final lerping pass where the "t" parameter is calculated by dividing the frame time divided by the <see cref="PositionMaxInterpolationTime"/>. | ||
| /// When enabled, the <see cref="BufferedLinearInterpolator{T}"/> will apply a final lerping pass towards | ||
| /// the interpolated result at a rate determined by <see cref="PositionMaxInterpolationTime"/>.<br /> | ||
| /// This is frame rate independent for all <see cref="InterpolationTypes"/>, but the same value will not |
There was a problem hiding this comment.
This guarantee is not true for LegacyLerp: UpdateInterpolation continues to route that mode to the three-argument legacy overload, whose final smoothing factor remains deltaTime / MaximumInterpolationTime. Repeated application of that factor produces different convergence at different frame rates, whereas only the newer Lerp and SmoothDampening path uses the new retention formula. The same inaccurate sentence is repeated for rotation and scale. Limit the claim to the two updated modes (or make the legacy implementation time-independent if that compatibility change is intended), so users do not select LegacyLerp expecting frame-rate-invariant smoothing.
🤖 Helpful? 👍/👎
Purpose of this PR
This is an up-port of #4130
(see original PR for extended details)
Jira ticket
NA
Changelog
LerpandSmoothDampeninginterpolation types to smooth by different amounts at different frame rates. Results at 60fps are unchanged.NetworkTransformfrom interpolating at all when using theLerporSmoothDampeninginterpolation types.Documentation
Testing & QA (How your changes can be verified during release Playtest)
Functional Testing
Manual testing :
Manual testing doneAutomated tests:
Covered by existing automated testsCovered by new automated testsDoes the change require QA team to:
Review automated tests?Execute manual tests?Provide feedback about the PR?Up-port
Not needed (this is an up-port).
Backports
Not needed.