A physics engine is
computer software
Software consists of computer programs that instruct the Execution (computing), execution of a computer. Software also includes design documents and specifications.
The history of software is closely tied to the development of digital comput ...
that provides an approximate
simulation
A simulation is an imitative representation of a process or system that could exist in the real world. In this broad sense, simulation can often be used interchangeably with model. Sometimes a clear distinction between the two terms is made, in ...
of certain
physical system
A physical system is a collection of physical objects under study. The collection differs from a set: all the objects must coexist and have some physical relationship.
In other words, it is a portion of the physical universe chosen for analys ...
s, typically
classical dynamics, including
rigid body dynamics
In the physical science of dynamics, rigid-body dynamics studies the movement of systems of interconnected bodies under the action of external forces. The assumption that the bodies are '' rigid'' (i.e. they do not deform under the action ...
(including
collision detection
Collision detection is the computational problem of detecting an intersection of two or more objects in virtual space. More precisely, it deals with the questions of ''if'', ''when'' and ''where'' two or more objects intersect. Collision detect ...
),
soft body dynamics
Soft-body dynamics is a field of computer graphics that focuses on visually realistic physical simulations of the motion and properties of deformable objects (or ''soft bodies''). The applications are mostly in video games and films. Unlike in si ...
, and
fluid dynamics
In physics, physical chemistry and engineering, fluid dynamics is a subdiscipline of fluid mechanics that describes the flow of fluids – liquids and gases. It has several subdisciplines, including (the study of air and other gases in motion ...
. It is of use in the domains of
computer graphics
Computer graphics deals with generating images and art with the aid of computers. Computer graphics is a core technology in digital photography, film, video games, digital art, cell phone and computer displays, and many specialized applications. ...
,
video game
A video game or computer game is an electronic game that involves interaction with a user interface or input device (such as a joystick, game controller, controller, computer keyboard, keyboard, or motion sensing device) to generate visual fe ...
s and film (
CGI). Their main uses are in video games (typically as
middleware
Middleware is a type of computer software program that provides services to software applications beyond those available from the operating system. It can be described as "software glue".
Middleware makes it easier for software developers to imple ...
), in which case the simulations are in
real-time
Real-time, realtime, or real time may refer to:
Computing
* Real-time computing, hardware and software systems subject to a specified time constraint
* Real-time clock, a computer clock that keeps track of the current time
* Real-time Control Syst ...
. The term is sometimes used more generally to describe any
software system
A software system is a system of intercommunicating software component, components based on software forming part of a computer system (a combination of Computer hardware, hardware and software). It "consists of a number of separate Computer progr ...
for simulating physical phenomena, such as
high-performance scientific simulation.
Description
There are generally two classes of physics
engine
An engine or motor is a machine designed to convert one or more forms of energy into mechanical energy.
Available energy sources include potential energy (e.g. energy of the Earth's gravitational field as exploited in hydroelectric power ge ...
s:
real-time
Real-time, realtime, or real time may refer to:
Computing
* Real-time computing, hardware and software systems subject to a specified time constraint
* Real-time clock, a computer clock that keeps track of the current time
* Real-time Control Syst ...
and high-precision. High-precision physics engines require more processing power to calculate very
precise physics and are usually used by scientists and computer-animated movies. Real-time physics engines—as used in video games and other forms of interactive computing—use simplified calculations and decreased accuracy to compute in time for the game to respond at an appropriate rate for game play. A physics engine is essentially a big calculator that does mathematics needed to simulate physics.
Scientific engines
One of the first general purpose computers,
ENIAC
ENIAC (; Electronic Numerical Integrator and Computer) was the first Computer programming, programmable, Electronics, electronic, general-purpose digital computer, completed in 1945. Other computers had some of these features, but ENIAC was ...
, was used as a very simple type of physics engine. It was used to design ballistics tables to help the United States military estimate where
artillery
Artillery consists of ranged weapons that launch Ammunition, munitions far beyond the range and power of infantry firearms. Early artillery development focused on the ability to breach defensive walls and fortifications during sieges, and l ...
shells of various mass would land when fired at varying angles and gunpowder charges, also accounting for drift caused by wind. The results were calculated a single time only, and were tabulated into printed tables handed out to the artillery commanders.
Physics engines have been commonly used on supercomputers since the 1980s to perform
computational fluid dynamics
Computational fluid dynamics (CFD) is a branch of fluid mechanics that uses numerical analysis and data structures to analyze and solve problems that involve fluid dynamics, fluid flows. Computers are used to perform the calculations required ...
modeling, where particles are assigned
force vector
In physics, a force is an influence that can cause an object to change its velocity unless counterbalanced by other forces. In mechanics, force makes ideas like 'pushing' or 'pulling' mathematically precise. Because the magnitude and direction ...
s that are combined to show circulation. Due to the requirements of speed and high precision, special computer processors known as
vector processor
In computing, a vector processor or array processor is a central processing unit (CPU) that implements an instruction set where its instructions are designed to operate efficiently and effectively on large one-dimensional arrays of data called ...
s were developed to accelerate the calculations. The techniques can be used to model weather patterns in
weather forecasting
Weather forecasting or weather prediction is the application of science and technology forecasting, to predict the conditions of the Earth's atmosphere, atmosphere for a given location and time. People have attempted to predict the weather info ...
, wind tunnel data for designing air- and watercraft or motor vehicles including racecars, and thermal cooling of computer processors for improving
heat sink
A heat sink (also commonly spelled heatsink) is a passive heat exchanger that transfers the heat generated by an electronic or a mechanical device to a fluid medium, often air or a liquid coolant, where it is thermal management (electronics), ...
s. As with many calculation-laden processes in computing, the accuracy of the simulation is related to the resolution of the simulation and the precision of the calculations;
small fluctuations not modeled in the simulation can drastically change the predicted results.
Tire manufacturers use physics simulations to examine how new
tire tread
The tread of a tire or track refers to the rubber on its circumference that makes contact with the road or the ground. As tires are used, the tread is worn off, limiting its effectiveness in providing traction. A worn tire can often be retr ...
types will perform under wet and dry conditions, using new tire materials of varying flexibility and under different levels of weight loading.
Game engines
In most computer games, speed of the processors and
gameplay
Gameplay is the specific way in which players interact with a game. The term applies to both video games and Tabletop game, tabletop games. Gameplay is the connection between the player and the game, the player's overcoming of challenges, and t ...
are more important than accuracy of simulation. This leads to designs for physics engines that produce results in real-time but that replicate real world physics only for simple cases and typically with some approximation. More often than not, the simulation is geared towards providing a "perceptually correct" approximation rather than a real simulation. However some game engines, such as
Source, use physics in puzzles or in combat situations. This requires more accurate physics so that, for example, the momentum of an object can knock over an obstacle or lift a sinking object.
Physically-based character animation in the past only used
rigid body dynamics
In the physical science of dynamics, rigid-body dynamics studies the movement of systems of interconnected bodies under the action of external forces. The assumption that the bodies are '' rigid'' (i.e. they do not deform under the action ...
because they are faster and easier to calculate, but modern games and movies are starting to use
soft body physics. Soft body physics are also used for particle effects, liquids and cloth. Some form of limited
fluid dynamics
In physics, physical chemistry and engineering, fluid dynamics is a subdiscipline of fluid mechanics that describes the flow of fluids – liquids and gases. It has several subdisciplines, including (the study of air and other gases in motion ...
simulation is sometimes provided to simulate water and other liquids as well as the flow of fire and explosions through the air.
Collision detection
Objects in games interact with the player, the environment, and each other. Typically, most 3D objects in games are represented by two separate meshes or shapes. One of these meshes is the highly complex and detailed shape visible to the player in the game, such as a vase with elegant curved and looping handles. For purpose of speed, a second, simplified invisible mesh is used to represent the object to the physics engine so that the physics engine treats the example vase as a simple cylinder. It would thus be impossible to insert a rod or fire a projectile through the handle holes on the vase, because the physics engine model is based on the cylinder and is unaware of the handles. The simplified mesh used for physics processing is often referred to as the collision geometry. This may be a
bounding box
In geometry, the minimum bounding box or smallest bounding box (also known as the minimum enclosing box or smallest enclosing box) for a point set in dimensions is the box with the smallest measure (area, volume, or hypervolume in higher dime ...
, sphere, or
convex hull
In geometry, the convex hull, convex envelope or convex closure of a shape is the smallest convex set that contains it. The convex hull may be defined either as the intersection of all convex sets containing a given subset of a Euclidean space, ...
. Engines that use bounding boxes or bounding spheres as the final shape for collision detection are considered extremely simple. Generally a bounding box is used for broad phase collision detection to narrow down the number of possible collisions before costly mesh on mesh collision detection is done in the narrow phase of collision detection.
Another aspect of precision in discrete collision detection involves the
framerate, or the number of moments in time per second when physics is calculated. Each frame is treated as separate from all other frames, and the space between frames is not calculated. A low framerate and a small fast-moving object causes a situation where the object does not move smoothly through space but instead seems to teleport from one point in space to the next as each frame is calculated. Projectiles moving at sufficiently high speeds will miss targets, if the target is small enough to fit in the gap between the calculated frames of the fast moving projectile. Various techniques are used to overcome this flaw, such as ''
Second Life
''Second Life'' is a multiplayer virtual world that allows people to create an Avatar (computing), avatar for themselves and then interact with other users and user-created content within a multi-user online environment. Developed for person ...
''s representation of projectiles as arrows with invisible trailing tails longer than the gap in frames to collide with any object that might fit between the calculated frames. By contrast, continuous collision detection such as in
Bullet
A bullet is a kinetic projectile, a component of firearm ammunition that is shot from a gun barrel. They are made of a variety of materials, such as copper, lead, steel, polymer, rubber and even wax; and are made in various shapes and constru ...
or
Havok does not suffer this problem.
Soft-body dynamics
An alternative to using bounding box-based rigid body physics systems is to use a
finite element
Finite element method (FEM) is a popular method for numerically solving differential equations arising in engineering and mathematical modeling. Typical problem areas of interest include the traditional fields of structural analysis, heat tran ...
-based system. In such a system, a 3-dimensional, volumetric
tessellation
A tessellation or tiling is the covering of a surface, often a plane, using one or more geometric shapes, called ''tiles'', with no overlaps and no gaps. In mathematics, tessellation can be generalized to higher dimensions and a variety ...
is created of the 3D object. The tessellation results in a number of finite elements which represent aspects of the object's physical properties such as toughness, plasticity, and volume preservation. Once constructed, the finite elements are used by a
solver
A solver is a piece of mathematical software, possibly in the form of a stand-alone computer program or as a Library (computing), software library, that 'solves' a mathematical problem. A solver takes problem descriptions in some sort of generic ...
to model the stress within the 3D object. The stress can be used to drive fracture, deformation and other physical effects with a high degree of realism and uniqueness. As the number of modeled elements is increased, the engine's ability to model physical behavior increases. The visual representation of the 3D object is altered by the finite element system through the use of a
deformation shader run on the CPU or GPU. Finite Element-based systems had been impractical for use in games due to the performance overhead and the lack of tools to create finite element representations out of 3D art objects. With higher performance processors and tools to rapidly create the volumetric tessellations, real-time finite element systems began to be used in games, beginning with ''
Star Wars: The Force Unleashed'' that used
Digital Molecular Matter for the deformation and destruction effects of wood, steel, flesh and plants using an algorithm developed by Dr. James O'Brien as a part of his PhD thesis.
Brownian motion
In the real world, physics is always active. There is a constant
Brownian motion
Brownian motion is the random motion of particles suspended in a medium (a liquid or a gas). The traditional mathematical formulation of Brownian motion is that of the Wiener process, which is often called Brownian motion, even in mathematical ...
jitter to all particles in our universe as the forces push back and forth against each other. For a
game physics
Computer animation physics or game physics are laws of physics as they are defined within a simulation or video game, and the programming logic used to implement these laws. Game physics vary greatly in their degree of similarity to real-world phy ...
engine, such constant active precision is unnecessarily wasting the limited CPU power, which can cause problems such as decreased
framerate. Thus, games may put objects to "sleep" by disabling the computation of physics on objects that have not moved a particular distance within a certain amount of time. For example, in the 3D
virtual world
A virtual world (also called a virtual space or spaces) is a Computer simulation, computer-simulated environment which may be populated by many simultaneous users who can create a personal Avatar (computing), avatar and independently explore th ...
Second Life
''Second Life'' is a multiplayer virtual world that allows people to create an Avatar (computing), avatar for themselves and then interact with other users and user-created content within a multi-user online environment. Developed for person ...
, if an object is resting on the floor and the object does not move beyond a minimal distance in about two seconds, then the physics calculations are disabled for the object and it becomes frozen in place. The object remains frozen until physics processing reactivates for the object after collision occurs with some other active physical object.
Paradigms
Physics engines for video games typically have two core components, a
collision detection
Collision detection is the computational problem of detecting an intersection of two or more objects in virtual space. More precisely, it deals with the questions of ''if'', ''when'' and ''where'' two or more objects intersect. Collision detect ...
/
collision response system, and the
dynamics simulation component responsible for solving the forces affecting the simulated objects. Modern physics engines may also contain
fluid simulations, animation
control systems
A control system manages, commands, directs, or regulates the behavior of other devices or systems using control loops. It can range from a single home heating controller using a thermostat controlling a domestic boiler to large industrial co ...
and
asset integration tools. There are three major paradigms for the physical simulation of solids:
* Penalty methods, where interactions are commonly modelled as
mass-spring systems. This type of engine is popular for deformable, or
soft-body physics.
* Constraint based methods, where
constraint equations are solved that estimate physical laws.
* Impulse based methods, where
impulses are applied to object interactions. However, this is actually just a special case of a constraint based method combined with an iterative solver that propagates impulses throughout the system.
Finally, hybrid methods are possible that combine aspects of the above paradigms.
Limitations
A primary limit of physics engine
realism is the approximated result of the constraint resolutions and collision result due to the slow convergence of algorithms. Collision detection computed at a too low frequency can result in objects passing through each other and then being repelled with an abnormal correction force. On the other hand, approximated results of reaction force is due to the slow convergence of typical Projected Gauss Seidel solver resulting in abnormal bouncing. Any type of free-moving compound physics object can demonstrate this problem, but it is especially prone to affecting chain links under high tension, and wheeled objects with actively physical bearing surfaces. Higher precision reduces the positional/force errors, but at the cost of needing greater CPU power for the calculations.
Physics processing unit (PPU)
A physics processing unit (PPU) is a dedicated microprocessor designed to handle the calculations of physics, especially in the physics engine of
video game
A video game or computer game is an electronic game that involves interaction with a user interface or input device (such as a joystick, game controller, controller, computer keyboard, keyboard, or motion sensing device) to generate visual fe ...
s. Examples of calculations involving a PPU might include
rigid body dynamics
In the physical science of dynamics, rigid-body dynamics studies the movement of systems of interconnected bodies under the action of external forces. The assumption that the bodies are '' rigid'' (i.e. they do not deform under the action ...
,
soft body dynamics
Soft-body dynamics is a field of computer graphics that focuses on visually realistic physical simulations of the motion and properties of deformable objects (or ''soft bodies''). The applications are mostly in video games and films. Unlike in si ...
,
collision detection
Collision detection is the computational problem of detecting an intersection of two or more objects in virtual space. More precisely, it deals with the questions of ''if'', ''when'' and ''where'' two or more objects intersect. Collision detect ...
,
fluid dynamics
In physics, physical chemistry and engineering, fluid dynamics is a subdiscipline of fluid mechanics that describes the flow of fluids – liquids and gases. It has several subdisciplines, including (the study of air and other gases in motion ...
, hair and clothing simulation,
finite element analysis
Finite element method (FEM) is a popular method for numerically solving differential equations arising in engineering and mathematical models, mathematical modeling. Typical problem areas of interest include the traditional fields of structural ...
, and fracturing of objects. The idea is that specialized processors offload time-consuming tasks from a computer's CPU, much like how a
GPU performs graphics operations in the main CPU's place. The term was coined by
Ageia's marketing to describe their PhysX chip to consumers. Several other technologies in the CPU-GPU spectrum have some features in common with it, although Ageia's solution was the only complete one designed, marketed, supported, and placed within a system ''exclusively'' as a PPU.
General-purpose computing on graphics processing unit (GPGPU)
Hardware acceleration for physics processing is now usually provided by graphics processing units that support more general computation, a concept known as general-purpose computing on graphics processing units (GPGPU).
AMD
Advanced Micro Devices, Inc. (AMD) is an American multinational corporation and technology company headquartered in Santa Clara, California and maintains significant operations in Austin, Texas. AMD is a hardware and fabless company that de ...
and
NVIDIA
Nvidia Corporation ( ) is an American multinational corporation and technology company headquartered in Santa Clara, California, and incorporated in Delaware. Founded in 1993 by Jensen Huang (president and CEO), Chris Malachowsky, and Curti ...
provide support for rigid body dynamics computations on their latest graphics cards.
NVIDIA's GeForce 8 series supports a GPU-based Newtonian physics acceleration technology named ''Quantum Effects Technology''. NVIDIA provides an SDK Toolkit for
CUDA
In computing, CUDA (Compute Unified Device Architecture) is a proprietary parallel computing platform and application programming interface (API) that allows software to use certain types of graphics processing units (GPUs) for accelerated gene ...
(
Compute Unified Device Architecture) technology that offers both a low and high-level API to the GPU. For their GPUs,
AMD
Advanced Micro Devices, Inc. (AMD) is an American multinational corporation and technology company headquartered in Santa Clara, California and maintains significant operations in Austin, Texas. AMD is a hardware and fabless company that de ...
offers a similar SDK, called
Close to Metal (CTM), which provides a thin hardware interface.
PhysX
PhysX is an Open-source software, open-source Real-time computer graphics, realtime physics engine middleware Software development kit, SDK developed by Nvidia as part of the Nvidia GameWorks software suite.
Initially, video games supporting Ph ...
is an example of a physics engine that can use GPGPU based hardware acceleration when it is available.
Engines
Real-time physics engines
;Open source
*
Advanced Simulation Library - open source hardware accelerated multiphysics simulation software
*
Box2D
*
Bullet
A bullet is a kinetic projectile, a component of firearm ammunition that is shot from a gun barrel. They are made of a variety of materials, such as copper, lead, steel, polymer, rubber and even wax; and are made in various shapes and constru ...
*
Chipmunk physics engine - 2D physics engine
*Jolt Physics - Horizon Forbidden West physics engine
*
Newton Game Dynamics
*
Open Dynamics Engine
*
PAL (Physics Abstraction Layer) - A uniform API that supports multiple physics engines
*
PhysX
PhysX is an Open-source software, open-source Real-time computer graphics, realtime physics engine middleware Software development kit, SDK developed by Nvidia as part of the Nvidia GameWorks software suite.
Initially, video games supporting Ph ...
*
Project Chrono
Project Chrono is a physics engine developed by University of Parma, University of Wisconsin-Madison and members of its open source community. It supports simulating rigid body dynamics, rigid and soft body dynamics, collision detection, vehicle ...
- An open source simulation engine for multi-physics applications.
*Rapier
Rapier's official website
/ref> - a 2D and 3D physics engine written in Rust
Rust is an iron oxide, a usually reddish-brown oxide formed by the reaction of iron and oxygen in the catalytic presence of water or air moisture. Rust consists of hydrous iron(III) oxides (Fe2O3·nH2O) and iron(III) oxide-hydroxide (FeO(OH) ...
* Siconos Modeling and the simulation of mechanical systems with contact, impact and Coulomb's friction
* SOFA (Simulation Open Framework Architecture)
* Tokamak physics engine
;Public domain
* Phyz (Dax Phyz) - 2.5D physics simulator/editor.
;Closed source/limited free distribution
* Digital Molecular Matter
* Havok
*Chaos by Epic Games
Epic Games, Inc. is an American Video game developer, video game and software development, software developer and video game publisher, publisher based in Cary, North Carolina. The company was founded by Tim Sweeney (game developer), Tim Sween ...
*Vortex
In fluid dynamics, a vortex (: vortices or vortexes) is a region in a fluid in which the flow revolves around an axis line, which may be straight or curved. Vortices form in stirred fluids, and may be observed in smoke rings, whirlpools in th ...
by CMLabs Simulations
*AGX Multiphysics
AGX Dynamics (previously known as AGX Multiphysics) is a proprietary real-time physics engine developed by Algoryx Simulation AB that simulates rigid body dynamics, collision detection, dry frictional contacts, jointed systems, motors, fluids, d ...
by Algoryx Simulation AB
* Algodoo by Algoryx Simulation AB
*Rubikon by Valve Corporation
Valve Corporation, also known as Valve Software, is an American video game developer, video game publisher, publisher, and digital distribution company headquartered in Bellevue, Washington. It is the developer of the software distribution pl ...
High precision physics engines
* VisSim - Visual Simulation engine for linear and nonlinear dynamics
See also
*Game physics
Computer animation physics or game physics are laws of physics as they are defined within a simulation or video game, and the programming logic used to implement these laws. Game physics vary greatly in their degree of similarity to real-world phy ...
*Ragdoll physics
Ragdoll physics is a type of procedural animation used by physics engines, which is often used as a replacement for traditional static death animations in video games and Animation, animated films. As computers increased in power, it became pos ...
*Procedural animation
A procedural animation is a type of computer animation used to automatically generate animation in real-time to allow for a more diverse series of actions than would otherwise be tedious using predefined animations.
Procedural animation is us ...
*Rigid body dynamics
In the physical science of dynamics, rigid-body dynamics studies the movement of systems of interconnected bodies under the action of external forces. The assumption that the bodies are '' rigid'' (i.e. they do not deform under the action ...
*Soft body dynamics
Soft-body dynamics is a field of computer graphics that focuses on visually realistic physical simulations of the motion and properties of deformable objects (or ''soft bodies''). The applications are mostly in video games and films. Unlike in si ...
*Physics processing unit
A physics processing unit (PPU) is a dedicated microprocessor designed to handle the calculations of physics, especially in the physics engine of video games. It is an example of hardware acceleration.
Examples of calculations involving a PPU mi ...
*Cell microprocessor
The Cell Broadband Engine (Cell/B.E.) is a 64-bit multi-core processor and microarchitecture developed by Sony, Toshiba, and IBM—an alliance known as "STI". It combines a general-purpose PowerPC core, called the Power Processing Element (PPE), ...
*Linear complementarity problem In mathematical optimization theory, the linear complementarity problem (LCP) arises frequently in computational mechanics and encompasses the well-known quadratic programming as a special case. It was proposed by Cottle and Dantzig in 1968 ...
Impulse/constraint physics engines require a solver for such problems to handle multi-point collisions.
*Finite Element Analysis
Finite element method (FEM) is a popular method for numerically solving differential equations arising in engineering and mathematical models, mathematical modeling. Typical problem areas of interest include the traditional fields of structural ...
References
Further reading
* Bourg, David M. (2002)
Physics for Game Developers"> Physics for Game Developers
'. O'Reilly & Associates.
External links
*
{{DEFAULTSORT:Physics Engine
Computer graphics
Video game development
Articles containing video clips