500 likes | 534 Views
Explore the world of physics engines in gaming applications, comparing real-time and high-precision options like Havok, Bullet, PhysX, and ODE. Learn about collision detection, fluid simulation, and more!
E N D
Survey of Physics Engines for Games Thursday, October 11, 2012
General information of Physics Engines - Description - Real-time vs. high-precision physics engines - Basis for a physics engine - Real-time physics engines Havok, Bullet, PhysX and ODE - Introduction - Comparison Contents
1 No physics. 2 Gravity, no collision detection. 3 Gravity and collision detection, no rigid body dynamics. 4 Gravity, collision detection and rotation calculations. Physics Simulations by a physics engine These are four examples of a physics engine simulating an object falling onto a slope. The examples differ in accuracy of the simulation:
A physics engine: - computer software - approximate simulation of certain physical systems - in the domains of computer graphics, video games and film - Mainly used in video games (simulations are in real-time) What is a physics engine? A physics engine in the context of a game application
There are generally two classes of physics engines: real-time and high-precision. Real-time physics engines - video games & interactive computing - simplified calculations - decreased accuracy - compute in time High-precision physics engines - scientists and computer animated movies - more processing power - precise Real-time vs. high-precision
Identifies and provides approximate simulation of certain simple physical systems. Rigid body dynamics Soft body dynamics Fluid Simulation Collision detection & response … Basis for a physics engine
Rigid body dynamics is used heavily in analyses and computer simulations of physical systems and machinery where rotational motion is important, but material deformation does not have a significant effect on the motion of the system. The Rigid body dynamics basically must deal with: - Rigid body linear momentum - Rigid body angular momentum - Angular momentum and torque Rigid body dynamics
Soft body dynamics focuses on visually realistic physical simulations. Generally, it only provide visually plausible emulations rather than accurate scientific/engineering simulations. This simulation can be done by using a variety of approaches: - Mass-spring models - Finite element simulation - Energy minimization methods - Shape matching - Rigid body based deformation Soft body dynamics
Fluid simulation is increasingly popular. A fluid simulator uses the Navier-Stokes equations. Simulations range in complexity from extremely time-consuming high quality animations for film & visual effects, to simple real-time particle systems used in modern games. Some techniques for liquid simulation is as follows: - Eulerian grid-based methods - Smoothed particle hydrodynamics (SPH) methods - Vorticity-based methods - Lattice Boltzmann methods Fluid Simulation
Collision detection typically refers to the computational problem of detecting the intersection of two or more objects. Collision response deals with simulating what happens when a collision is detected. Solving collision detection problems requires extensive use of concepts from linear algebra and computational geometry: - Collision Detection for Flexible Surfaces - Collision Detection for Convex Polyhedra - Collision Response Using Springs - Collision Response Using an Analytical Solution - Collisions of Dynamic Objects with Non-Dynamic Objects Collision detection & response
Real-time physics engines • Commercial Physics Engines (usually written in C++) • Most have license options that are attractively priced for indie and hobby developers
Real-time physics engines • Open Source and Freeware Physics Engines
Real-time physics engines • XNA-Compatible ports • Other ports • "Abstraction Layers"
Havok Physics is designed primarily for video games, and allows for real-time collision and dynamics of rigid bodies in three dimensions. Features: - Collision Detection - including Continuous Physics - MOPP Technology - for compact representation of large collision meshes - Dynamics and Constraint Solving - Vehicle Dynamics - Data Serialization and Art Tool Support - Visual Debugger for in-game diagnostic feedback Introduction-Havok
Crash Nitro Kart、Half-Life 2、Max Payne 2、Medal of Honor、F.E.A.R.、Lord of the Rings: Middle Earth Online Projects
PhysX is a proprietary real-time physics engine middleware SDK. PhysX SDK is only solution with fully-functional GPU/PPU physics acceleration pipeline. Features: - Massively Parallel Physics Architecture - High-speed GDDR3 Memory Interface - Universal Continuous Collision Detection - Physical Smart Particle Technology - Complex Object Physics System - Scalable Terrain Fidelity - Dynamic Gaming Framework Introduction-PhysX
Game engines: Unity 3D, Gamebryo, Vision (version 6 onwards), Instinct Engine, Panda3D, Diesel, Torque, HeroEngine and BigWorld. Games: Bulletstorm, Need for Speed: Shift, Castlevania: Lords of Shadow, Mafia II, Alice: Madness Returns, Batman: Arkham City. Software: Active Worlds (AW), Autodesk 3ds Max, Autodesk Maya and Autodesk Softimage, DarkBASIC Professional (with DarkPHYSICS upgrade), DX Studio, Futuremark 3DMark Vantage, Microsoft Robotics Studio., Nvidia SuperSonic Sled and Raging Rapids Ride, technology demos, OGRE (via the NxOgre wrapper) Projects
Bullet is an open source physics engine featuring 3D collision detection, soft body dynamics, and rigid body dynamics. It is used in games, and in visual effects in movies. Features: - Multi Platform support - Supports various shape types - Discrete Collision Detection for Rigid Body Simulation - Single Queries - Sweep and Prune Broad phase - Documentation and Support - Auto generation of MSVC project files, comes with Jam build system Introduction-Bullet
- Bullet Collision Detection works with Bullet Dynamics, but there is also a sample integration with Open Dynamics Engine - Framework with 2 different Constraint Solvers - Hinge, Point to Point Constraint, Twist Cone Constraint (ragdolls) - Automatic de-activation (sleeping) - Generic 6 Degree of Freedom Constraint, Motors, Limits - LCP Warm starting of contact points - Collada 1.4 Physics Import using F Collada and COLLADA-DOM - Convex Decomposition Code Introduction-Bullet
Movies: 2012, The A-Team, Hancock, Sherlock Holmes. Games: Toy Story 3, Grand Theft Auto IV, Red Dead Redemption, Trials HD by RedLynx, Free Realms, HotWheels, Madagascar Kartz, Regnum Online, 3D Mark 2011, Blood Drive, Hydro Thunder Hurricane. Tools: Blender, Cheetah3D. Projects
The Open Dynamics Engine (ODE) is a physics engine in C/C++. Its two main components are a rigid body dynamics simulation engine and a collision detection engine. It was quite popular in 2005-2006. Currently ODE’s development seems to be suspended. ODE is a popular choice for robotics simulation applications, with scenarios such as mobile robot locomotion and simple grasping. Features: - Rigid bodies with arbitrary mass distribution. - Joint types: ball-and-socket, hinge, slider (prismatic), hinge-2, fixed, angular motor, linear motor, universal. - Collision primitives: sphere, box, cylinder, capsule, plane, ray, and triangular mesh, convex. - Collision spaces: Quad tree, hash space, and simple. - Simulation method: The equations of motion are derived from a Lagrange multiplier velocity based model due to Trinkle/Stewart and Anitescu/Potra. Introduction-ODE
- A first order integrator is being used. It's fast, but not accurate enough for quantitative - engineering yet. Higher order integrators will come later. - Choice of time stepping methods: either the standard ``big matrix'' method or the newer iterative QuickStep method can be used. - Contact and friction model: This is based on the Dantzig LCP solver described by Baraff, although ODE implements a faster approximation to the Coulomb friction model. - Has a native C interface (even though ODE is mostly written in C++). - Has a C++ interface built on top of the C one. - Many unit tests, and more being written all the time. - Platform specific optimizations. Introduction-ODE
BloodRayne 2, Call of Juarez, S.T.A.L.K.E.R, Titan Quest, World of Goo, X-Moto and Open Simulator Projects
Most multi-purpose physics engines usually implement several methods: several different constraint solvers, friction models, collision detection method etc. ODE for example has both a pivoting/direct method and iterative methods such as blocked projected Gauss–Seidel (PGS). Bullet has similar iterative methods and is exploring nonsmooth nonlinear conjugate gradient methods as well. PhysX and Bullet has focused on using GPUs in their simulators. The algorithmic choices are still based on iterative methods in these works. Most game physics engines use a constraint solver based on iterative methods like the ones known from ODE and Bullet. The methods are confusingly named “sequential impulses” by the computer gaming community but the models are based on the constraint based paradigm and are solved using an iterative method such as PGS or similar. Comparison-Methods
A collision detection module and an object joint module are very important for physics engines. The physics engine calculates the joint value of the inside object and the collision detection, and the changed position of the object and rotation value. Newton's equation of motion is applied in this case. Comparison-Methods
The Euler method approximates y(x) ignoring more than the first differential coefficient in the process by Taylor series when differential equation and initial condition were given in the Eq. Comparison-Methods
The improved Euler method approximates to the second differential coefficient. The following way shows the process of calculating to the second differential coefficient in Eq. Comparison-Methods )
The Runge-Kutta method approximates to the fourth differential coefficient in the Taylor series. The following method shows the process that calculates to the fourth differential coefficient in Eq. Runge-Kutta methods achieve the accuracy of a Taylor series approach without requiring the calculation of higher derivatives. Comparison-Methods
Physics Engines in 3D DCC Tools Comparison-Use
To understand what is really needed and adopted by game industry 2006-2009 Comparison-Use
PhysX SDK is preferred by small teams, is dominating PC market. Currently PhysX SDK is widely adopted by russian (mostly trash games) and korean (mostly specific MMOs) developers. Havok is currently best choice for AAA titles – extensive toolset, orientation on consoles, best-in-class developer support. In spite of the fact that ODE has some good games in its library, 54% of all titles are based on Chrome Engine from Techland – mainly that’s trash shooters from CITY Interactive or Russian UAZ 4×4 and it’s countless add-ons. Comparison-Use
PhysX SDK is dominating on PC market. Standalone console versions of PhysX SDK existed even in 2005 (even certain games from PS3 and Wii start-up line were based on PhysX SDK), but still most of it’s console titles are based on UE3. Havok is dominating on AAA and console market. Only Havok has advanced support for various platforms – not only PC and modern consoles, but Xbox, PS2 and even PSP. ODE was used in several games for Wii, but majority of titles are still Chrome engine based games for PC. Bullet is used in several of today’s hyperrealistic video games and feature film visual effects. Comparison-Use
Criteria: There are six essential factors that determine the overall performance of the physics engine: - Simulator Paradigm, determines which aspects can be accurately simulated. This affects the accuracy in resolving constraints. - The integrator, determines the numerical accuracy of the simulation. - Object representation, contributes to the efficiency and accuracy of collisions in the simulation. - Collision detection and contact determination, also contribute to the efficiency and accuracy of collisions in the simulation. - Material properties, determines which physical models, if any, the simulation can approximate (eg: Coloumb friction). - Constraint implementation, determines which constraints are supported and how accurately they can be simulated. Comparison-Performance
Testing the physics engines with some physical fact in the real world, might give a hint on how correct the engine is. This test has a simple configuration of a pendulum and a free-fall then each engine’s simulation will be compared to the “correct” physical behavior. Basic accuracy
Constraint stability is one of the areas of importance for game designers. If constraints are unstable numerical errors can cause constrained bodies to slowly drift apart. This results in unrealistic looking results. This is also of critical importance for simulation engineers simulating multi-body robotic systems, the traditional application of dynamic simulation systems. Constraint Stability
Constraint Stability Constraint error Constraint error Average time per constraint Constraint timing
Objects that collide and bounce of each other is a common scenario. This test looks at how the different physic engines handle this. Bounce
Bounce Bounce results with different values of restitution Maximum bounce height for varying values of restitution
A common way to demonstrate a physics toolkit is to have a scene with a big pile of boxes which is then destroyed. This scene is not always that common in real applications. Despite this, piling seems to be a way of measuring how good a physics toolkit is, the following test will look into how the different toolkits scale when boxes are piled on top of each other. Scalability of contacts
Scalability of contacts Computational Effort of Stacked objects Time to solve contacts
General Information: http://en.wikipedia.org/wiki/Physics_engine http://www.gamedev.net/topic/475753-list-of-physics-engines-and-reference-material-updated-7-march-2011/ http://elybob.wordpress.com/2011/05/21/physics-engines/ http://www.ibm.com/developerworks/opensource/library/os-physicsengines/index.html http://baike.baidu.com/view/721450.htm http://www.adrianboeing.com/links.html#physics Physics Engine for Simulation. By R. Gaurav Agarwal. From http://www.scribd.com/doc/36296208/Physics-Engine-for-Simulation Sources
Features of different physics engines and their applications : Havok: http://www.havok.com, http://en.wikipedia.org/wiki/Havok_(software) Bullet: http://bulletphysics.com http://en.wikipedia.org/wiki/Bullet_(software) Novodex: http://www.geforce.com http://en.wikipedia.org/wiki/NovodeX ODE: http://www.ode.org http://en.wikipedia.org/wiki/Open_Dynamics_Engine Comparison: http://physxinfo.com/articles/?page_id=154 Sources
Videos: ODE: http://www.youtube.com/channel/HCiSyCR5212Ls Havok: http://www.youtube.com/user/havokchannel?feature=results_main Numerical Integration Methods: Performance Evaluation of Numerical Integration Methods in the Physics Engine. By Jong-Hwa Choi, Dongkyoo Shin, Won Heo and Dongil Shin. From http://www.springerlink.com/content/rpxwqcbccmwhlcb0/fulltext.pdf Interactive Simulation of Rigid Body Dynamics in Computer Graphics. By Jan Bender, Kenny Erleben, Jeff Trinkle and Erwin Coumans. From http://www.cs.rpi.edu/twiki/pub/RoboticsWeb/LabPublications/BETCstar_part1.pdf Sources
Comparison: PhysX vs. Havok: http://en.wikipedia.org/wiki/Physics_processing_unit Bullet vs. Novodex vs. ODE: Evaluation of real-time physics simulation systems. By Adrian Boeing, Thomas Bräunl. From http://www.adrianboeing.com/pal/papers/p281-boeing.pdf Havok vs. Bullet vs. Novodex vs. ODE: COLLADA physics. By Erwin Coumans, Keith Victor. From http://www.bulletphysics.com/ftp/pub/test/physics/Collada%20Physics/collada_physics_shortpaper_web3d_6.pdf Novodex vs. ODE: Evaluation of Physics Engines and Implementation of a Physics Module in a 3d-Authoring Tool. By SEUGLING, A, and ROLIN M. From http://www8.cs.umu.se/education/examina/Rapporter/SeuglingRolin.pdf Evaluating Physics Engines For Games – PAL: http://3dexperiences.blogspot.com/2008/12/evaluating-physics-engines-for-games.html ODE vs. Bullet: http://blog.wolfire.com/2010/03/Comparing-ODE-and-Bullet Sources