Skip to main content
23 votes
Accepted

Why use Time.deltaTime in Lerping functions?

See also this answer. There are two common ways to use Lerp: 1. Linear blending between a start and an end ...
DMGregory's user avatar
  • 135k
6 votes
Accepted

Resolving prediction error from client side prediction and server reconciliation

I solved the problem on my own. My previous implementation of the networking engine made reconciliation impossible. The code I am using is private, though I plan on open sourcing the Box2D server/...
pjrader1's user avatar
  • 332
5 votes

Why does the kinematic body move in opposite direction after I interpolate its movement, and how do I fix it?

You can't rely on movement.x hitting 0. This is because floating point errors. Instead, check if it is closer to 0 than ...
Theraot's user avatar
  • 27.2k
4 votes
Accepted

GLSL "varying" interpolation: component-wise? Reference in the spec?

TL;DR: Yes, it is component-wise. As you said, GLSL specifications have formulas for computing "datum associated with a fragment", like this one: GLSL 330 spec : 3.5.1 Basic Line Segment ...
HolyBlackCat's user avatar
  • 2,035
4 votes
Accepted

How to smooth rotations?

Yes, in fact that's what quaternions are often used for - interpolating between two different orientations. Other methods of representing orientation suffer from issues like gimbal lock and wrap-...
congusbongus's user avatar
  • 14.8k
4 votes
Accepted

Fixed Timestep with Interpolation | Blurry & Choppy

Your lerps and slerps are backwards: lerp(current, previous, alpha) should be lerp(previous, current, alpha) ie. ...
DMGregory's user avatar
  • 135k
3 votes
Accepted

Why do my sprites jitter when moving diagonally?

With out code, this might be hard, but if I had to take a guess, your sprites aren't gittering, your camera is. I suspect you are moving the camera either to the exact x or y position both when ...
Krupip's user avatar
  • 1,763
3 votes

Multiplayer game server sync

The clock speed matters less, as long as you make sure the server and the client game steps are kept in sync. This article by Gary Weiss discusses this issue. Essentially either the game loop on the ...
OpherV's user avatar
  • 655
3 votes
Accepted

How to smooth viewport panning when using minimap (in typical RTS)?

I think you should avoid setting your viewport position to the value selected in GUI in one, single frame. Instead, I'd add a target position and ...
kolenda's user avatar
  • 1,370
3 votes
Accepted

Suitable interpolation for animating explosions

There are multiple easing functions (https://easings.net) that can help you, more specifically "ease out" functions (faster at the beginning, slower at the end). I have all of those in the ...
Ferreira da Selva's user avatar
3 votes
Accepted

How to smoothly interpolate 2D camera with pan and zoom

For a smooth loop like this, we want to scale the camera viewport from 1 x at the start to \$r\$ x at the end of the first loop (where \$r\$ is the ratio between the inner image size and the outer ...
DMGregory's user avatar
  • 135k
3 votes

Given a set of points with color values, finding a gradated color value from a given position

An idea that occurs to me would be to use something like Voronoi cells to split the area by color, and sort of blend them into each other. Essentially past the border between two colors use a smooth ...
Will Mungas's user avatar
3 votes
Accepted

D3D12: how to enable perspective correction when interpolating UV coordinates?

You've lost perspective correctness due to the way you've written your vertex shader. Ordinarily, we'll transform our vertex from view space to clip space by multiplying it by a projection matrix that ...
DMGregory's user avatar
  • 135k
2 votes

Image Interpolaton for Rotation

What you call unmapped pixels are what appear as "holes" in the rotated image. In image computing (such as analysis, rendering, etc.) a rotation is a manipulation of an image A in order to obtain an ...
liggiorgio's user avatar
  • 4,866
2 votes

HeightMap from a graph

TL;DR: Use bicubic interpolation or spline interpolation. So, you're looking for a method of two-dimensional interpolation. Unfortunately, this isn't a perfect two-dimensional grid (mathematically, it'...
HDE 226868's user avatar
2 votes
Accepted

Points evenly spaced along a bezier curve

Well it has been some time... But I was finally able to solve this problem! Everything you need is in this post: Moving ships between two planets along a bezier, missing some equations for ...
Foaly's user avatar
  • 241
2 votes

Why is interpolation passed into the rendering routine when the position and speed are related to the update routine?

Combining a physics engine that uses a fixed time-step with a variable-timed rendering loop can lead to very choppy movement. Sometimes you have two physics frames between two renders, sometimes none ...
Philipp's user avatar
  • 120k
2 votes

Clientside interpolation - update rate fixed to client framerate

One approach is to give each server step a incrementing number. For example, a server may be currently executing step 500, and after one second, this server running at 60 FPS will have reached step ...
Gary Weiss's user avatar
2 votes

Why aren't regular quadratic and cubic splines used much in games?

A nice place to start (without the mathematical heaviness associated with the Differential Geometry of Curves and Surfaces) would be this. The author discusses the uses and practical advantages or ...
teodron's user avatar
  • 3,301
2 votes
Accepted

real-time multiplayer server, interpolation and prediction validation

At 1: possibility to use NTP time and sync between the two? Possible but wrong. NTP is not designed for synchronizing as a game needs. You also don't want to synchronize time anyway. You want to ...
Sean Middleditch's user avatar
2 votes
Accepted

Aim/Scope Oscillation Algorithm

Using polar coordinates would do the trick. Here’s a graph of the function r=sin(2.3θ), with θ going from 0 to 2π: Given ...
Noah Witherspoon's user avatar
2 votes

Suitable interpolation for animating explosions

Yes, the velocities are the highest at detonation time, and as the explosion progresses, the system loses energy. So fast growth that fizzles out would be a good model. So a function with a fifth ...
Bram's user avatar
  • 3,719
2 votes
Accepted

Slerp to slerp smoothing

I hadn't actually aligned in CatmullRom, it was one of my other tests. It got lost in all the messy code. The problem was solved by aligning the start and end points of the spline input. (params: pre, ...
John Smith's user avatar
2 votes
Accepted

How do I interpolate an object from point A to B such that it accelerates, overshoots, and bounces back to target position?

A few small fixes: Cache your initial position, and lerp from there to your end, to avoid a feedback loop where transform.position is being used to modify itself. ...
DMGregory's user avatar
  • 135k
2 votes

How do you determine which 4 pixels to interpolate, using bilinear interpolation?

Conventionally, the pixels (or "texels") in a texture are arranged in a 2D grid. Let's say it looks like this: ...
DMGregory's user avatar
  • 135k
1 vote
Accepted

Can't figure out what's making the player teleport back to spawn

Your method for blending to the new updated position definitely looks dicey. While there are times when we want to use the pattern ...
DMGregory's user avatar
  • 135k
1 vote
Accepted

Smooth Rotate Object While Orbiting

For anyone running into a similar issue, the solution (for me at least) was to just change it to rotating around the local z-axis rather than the world z-axis: ...
DRiFTy's user avatar
  • 586
1 vote

Fixed timestep updates with a variable timestep update

The reason we do fixed timestep updates in the first place is to ensure our realtime game simulations stay consistent. Take a simple object falling under gravity of -9.8 m/s^2 under Euler integration,...
DMGregory's user avatar
  • 135k
1 vote

Unity multiplayer with custom server - interpolation jumping

Before starting, Period: The time it takes to complete one full turn of a repetitive event. So, Period = 1/Frequency. The method you are using can work pretty ...
starikcetin's user avatar
  • 5,295
1 vote

Why use Time.deltaTime in Lerping functions?

You are right, the method Quaternion Slerp(Quaternion a, Quaternion b, float t) interpolates between a and ...
Ludovic Feltz's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible