Damping Velocity: How Does it Solve Numerical Inaccuracy?

  • Thread starter Thread starter The-Mad-Lisper
  • Start date Start date
  • Tags Tags
    Damping Velocity
Click For Summary

Discussion Overview

The discussion centers around the concept of damping in physics engines, particularly in the context of numerical accuracy and energy conservation. Participants explore how damping can mitigate issues arising from numerical inaccuracies in simulations, especially when using methods like Euler integration. The conversation touches on the implications of damping for energy conservation and the challenges of accurately modeling physical interactions in real-time game physics.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • Some participants note that damping is introduced to counteract numerical inaccuracies in physics engines, allowing for a more stable simulation of motion.
  • Others argue that damping, as a dissipative force, does not conserve mechanical energy in real-world scenarios, contrasting its role in simulations.
  • A participant raises a question about the specifics of Euler integration, suggesting that it does not conserve energy and can lead to increasingly unrealistic behavior in simulations.
  • Another participant mentions that the collision detection system can inadvertently increase the mechanical energy of objects, complicating the simulation further.
  • One contributor shares a personal solution to the problem of increasing bounce heights by implementing a rounding method to introduce a form of drag without explicitly coding it.
  • There is a discussion about the limitations of numerical methods and the necessity for simplicity in game physics engines to achieve real-time performance.

Areas of Agreement / Disagreement

Participants express differing views on the role of damping in energy conservation and the effectiveness of various numerical methods. There is no consensus on the best approach to mitigate numerical inaccuracies or the implications of damping in simulations.

Contextual Notes

Participants highlight the challenges of accurately modeling complex physical interactions, particularly in real-time applications. The discussion reveals limitations in current numerical methods and the trade-offs involved in achieving performance versus accuracy.

Who May Find This Useful

This discussion may be of interest to game developers, physics engine designers, and those studying numerical methods in simulations, particularly in the context of real-time applications.

The-Mad-Lisper
Messages
12
Reaction score
1
In an excerpt from Ian Millington's Game Physics Engine Development, the author mentions a "damping" force:
"In our physics engine we could simply assume that there are no forces at work and use [Newton's First Law] directly. To simulate drag we could add special drag forces. This is fine for the simple engine we are building in this part of the book, but it can cause problems with complex systems. The problem arises because the processor that performs the physics calculations isn't completely accurate. This inaccuracy can lead to objects getting faster of their own accord.
A better solution is to incorporate a rough approximation of drag directly into the engine. This allows us to make sure objects aren't being accelerated by numerical inaccuracy, and it can allow us to simulate some kinds of drag. If we need complicated drag (such as aerodynamic drag in a flight simulator or racing game), we can still do it the long way by creating a special drag force. We call the simple form of drag 'damping' to avoid confusion."
He later mentions something along the lines that damping helps conserve energy of the system, but doesn't go into any specifics. How exactly does damping solve numerical inaccuracy when rounding errors do not necessarily cause an increase in a particle's speed? How does it conserve energy?
 
Technology news on Phys.org
The-Mad-Lisper said:
He later mentions something along the lines that damping helps conserve energy of the system, but doesn't go into any specifics. How exactly does damping solve numerical inaccuracy when rounding errors do not necessarily cause an increase in a particle's speed? How does it conserve energy?
In the real world, damping doesn't conserve mechanical energy. Like friction, damping is a dissipative force that turns mechanical energy into heat.

In the real world, a ball dropped from a height onto a floor will bounce a few times (maybe more than a few times if its a superball), but eventually come to rest on the floor. There are dissipative forces in the bounce. Drop hundreds of superballs all at once and you'll have collisions between balls as well as collisions between the ball and the floor. But eventually, everything will slow down and all the balls will be at rest on the floor.

Properly modeling a single bounce is hard. Modeling hundreds, all at once, that's very hard. Game physics engines are worried about getting the appearance of the bounces correct, and doing so in apparent realtime on a typical home computer (or tablet nowadays). This means some amount of sacrifice in the integrators and solvers inside the engine. Typically, the sacrifice is to use Euler integration. Euler integration does not conserve energy. Oftentimes, it spirals out of control. The balls bounce higher and higher, smash into one another harder and harder.

Adding a not-quite physical damping is a simple kludge that (usually) keeps things under control.
 
  • Like
Likes   Reactions: The-Mad-Lisper
D H said:
Typically, the sacrifice is to use Euler integration. Euler integration does not conserve energy. Oftentimes, it spirals out of control. The balls bounce higher and higher, smash into one another harder and harder.
So by Euler integration, do you mean using x=x_0+vdt rather than x=x_0+v{dt}+\frac{1}{2}a{dt}^2?
Also, does the ball gain mechanical energy because the collision detection system flips both the ball's position with respect to the ground and the sign of the vertical component of the ball's velocity without taking into account that negative work must be done to translate the ball upward?

Edit: Corrected above equations.
 
An N-dimensional second order differential equation can always be recast as a 2N-dimensional first order differential equation. That can then be numerically integrated to advance state over time. The problem is that this throws out the geometry of the problem. The problem with using geometric integrators is that these don't mix well with the types of problem game engines need to solve. Things collide in games. Simulated people run; their feet collide with ground. Cars drive; their wheels collide with the ground. Bullets fly, etc. There are lots of collisions in game physics. To solve these, the games typically use an LCP (Linear complementarity problem) solver. Those are extra things that need to be integrated, and the result is a big matrix. So geometry of the physics (that Newtonian mechanics is a second order ODE is "geometry") has to be tossed aside.

People who play video games don't have a supercomputer with thousands of parallel CPUs and thousands of GPUs, each with thousands of processors, available to them. This means the techniques must necessarily be simple to get realtime performance.
 
I've dealt with this before, it's really frustrating writing code that perfectly describes physics, then dropping an object and having it bounce higher and higher and higher. I solved this issue not by artificially adding a drag, but by forcing my calculations to round down. I only take the 4 most significant digits after the decimal, this introduces "drag" without any special code.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 6 ·
Replies
6
Views
11K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 15 ·
Replies
15
Views
2K
  • · Replies 32 ·
2
Replies
32
Views
3K
  • · Replies 3 ·
Replies
3
Views
9K
  • · Replies 2 ·
Replies
2
Views
3K
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K