0
\$\begingroup\$

In Fix Your Timestep, they briefly address the remainder time in relation to rendering. Saying that remainder can be used to generate an interpolated rendering.

We can use this remainder value to get a blending factor between the previous and current physics state simply by dividing by dt. This gives an alpha value in the range [0,1] which is used to perform a linear interpolation between the two physics states to get the current state to render.

http://web.archive.org/web/20190506030345/https://gafferongames.com/post/fix_your_timestep/

So let's say your last two physics updates we'll call A and B are from 00:10.033 and 00:10.066, and it is now 00:10.070 when we want to perform a render. We have a remainder of .004.

I take "interpolation between the two physics states" to mean we compare all the objects in update A and B and slide them back from B towards A by 88% (.033-.004)/.033). This would mean I'm actually rendering the physical state at 00:10.037, correct? So my physics updates A and B are really more like previous and next and my interpolation is between the previous and the next, correct?

\$\endgroup\$
1
\$\begingroup\$

Exactly as you think. You use interpolation to render a state between 'previous' and 'next' state. If your timer says you're 88% between frames, you draw objects at 88% the distance between their previous and next position.

You can also use extrapolation, which removes the need to store previous state of the world, but you can (and probably many times will) overshoot, and your objects will render in the obstacles.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.