Lets Get Physical: Inside The PhysX Physics Processor

Part 1 : Game Physics

3D acceleration is a long established standard part of today’s systems yet it started life as an exotic, expensive add on.  Last year Ageia announced a new kind of add on, their PhysX chip is a new technology specifically designed for accelerating physics processing in games.  Why should a physics chip interest gamers? What does it do? How does it work?

As games become ever more realistic it’s becoming apparent that some things are not as realistic as they could be.  Objects just don’t behave the way they would in real life.

If you fire a rocket at a wall it might leave a scar but the actual wall is likely to remain unchanged otherwise.  Even if you manage to blow it up it’s not going to look like a wall that’s been blown up in real life.

If you blow up a building it too may blow up in a decidedly non-realistic manner.

Physics acceleration will change all this.

A Load Of Balls

Why is this?

To explain I’ll give an example:

Lets say you’re on a football (soccer) field and you have three balls:

A beach ball.

A football.

A solid iron ball.

Lets say you give each a healthy kick.

If you kick the beach ball it’ll fly off but then slow down rapidly, it doesn’t even get near the goal posts and the goalie laughs at you.

If you kick the football it’ll fly off but continue for a greater distance, the goalie dives to save it.

In reality you’d probably break your foot kicking a solid iron ball but lets say for arguments sake, you happen to be superman.  You kick the iron ball and it flies off and keeps going for a long, long way.  The goalie dives out of the way - to save himself.

In a game, unless it has been specifically programmed something else will happen:

You kick the beach ball, it flies off.

You kick the football, it flies off.

You kick the iron ball, it flies off.

In real life the three balls are made of different materials which have different properties.  This means they act in very different ways.  In the game the ball has no properties so just acts according to the program controlling it, if the program does not explicitly make the different balls behave differently they all act the same.

If you want to create a game which not only looks realistic but also acts realistically, you need to give objects and the environment itself real properties.  You have to figure out what happens when the objects interact. Real physical properties and real physical actions - this is what game physics is all about.

Lets Get Physical

Physics in games is all about movement and things bashing into one another.  You don’t need to worry about objects sitting on their own doing nothing since they’re not interacting with anything else.

To get the balls to move correctly you need to model not only the weight mass of the ball but also gravity, spin and wind resistance.  When you kick the ball you are transferring energy from your foot to the ball and the ball then flies off.  The ball will at first resist movement, this is know as inertia and depends on the mass of the ball.  By overcoming the inertia you set the ball in motion, in doing so you have given the ball momentum.

When the ball is flying it is subject to wind resistance and gravity, these both fight the momentum and will bring the ball to a stop.  Spin will have an impact of the direction of the ball and its direction after it hits something.

The beach ball will have very little momentum since it has low mass and will be subject to higher wind resistance since they are generally large.  The football has a higher mass and is smaller than the beach ball, this means it will take more energy to stop it, it will be subject to less wind resistance and it will thus go further than the beach ball.

A solid Iron ball will take a lot of energy to get moving in the first place since it’ll be heavy but once moving it will take a lot of energy to stop it.  This means the iron ball will fly for a long way and cause a lot of damage when it hits something.  This is why you use heavy things for bombarding the enemy if you are fighting a war. Bombarding someone with beach balls would prove somewhat ineffective, unless you just wanted to annoy them to death.  It’s also the reason bullets are made out of lead, a heavy metal does more damage.

There’s more to it than just slowing things down though.  Flying objects slow down in a certain way and this changes their path as they fly through the air.  If you model air resistance or gravity incorrectly the object’s path through the air will be wrong and you’ll see this.  You probably wont be consciously looking at details like this but in the background your brain will, when things are wrong you’ll notice.  In order to create a game which acts as it would in real life you need to create a convincing physical simulation.

There is a lot more to it than this of course, but these are just a few of the things which need to be considered if you wish to create such a simulation.

How Does This Affect Games?

Making objects behave “properly” is all very good but you’d be correct to ask why gamers should care.

The answer can be summed up in one word: BOOM!

When things blow up the explosion and the bits thrown out by it are all subject to the same laws I’ve talked about above.  The bits will also bash into one another and interact with the surfaces they impact on, all these interactions will also be governed by physical laws.

Physics will directly impact the look of a game as explosions will now look real, pre-scripted explosions will stand out and look tame and unrealistic by comparison.

Once you’ve seen physics done properly in a game, other games will seem restrictive and inaccurate.  

The difference will not be as obvious as the difference between say, different types of graphics rendering, screen shots can show that.  No, you will need to see the actual game running to see the difference extensive physics support will make.

Isn’t All This Realism Going To Make Games All The Same?

Movies are usually made with real people doing real things in the real world, this is true even if they are pretending to be in an unreal world.  While there is a much greater emphasis on CGI (Computer Generated Imagery) these days a lot of the action shots are still done with real items or at least real models (Lord of the Rings trilogy, The Matrix trilogy and War of the Worlds all did this to one degree or another). Even in fantasy or SciFi movies you are seeing very real physics in action.  This physical realism does not hurt the movies, if anything it does the opposite.  I don’t expect it to be any different in games.

Physical simulation does however have the advantage that it can be programmed so that it simulates something other than this planet.  If you create a game which is set on the moon you can create a simulation of the moon complete with the lower gravity.  Moon Olympics anyone?

But that’s not all you can do, there’s nothing to stop you using the simulation to create physics which are decidedly unreal.  You could for instance give your baddies extreme properties, opponents which are made out of gas, water, metal, liquid metal (think terminator 2), fire, and who knows what else.  This could make for some interesting, challenging games.  How exactly do you kill a ghost if they look and act if they act like a gas?  Bullets wont exactly do much damage.  So, now you can write Moon Olympics with ghosts.

There’s nothing to stop you going completely mad and having composite properties which would not or could not exist in the real world.  A baddie made out of neutron star material would pose something of a difficulty to defeat, but then this could be part of a game set in the metallic hydrogen core of Jupiter where you may just be able swim around and find an appropriate weapon.  Hmm, sounds like there’s a Dr Who game in there somewhere...

So, even if everything acting “real” doesn’t mean game will all be the same, quite the contrary in fact.  Physical simulation opens doors to all sorts of new game possibilities.

How It Works: The Physics Simulation Software

The PhysX [PhysX] chip itself is pretty useless without software to run, that’s the job of the physics simulation software.

The simulation is broadly divided into four parts:

  1.  Host Interface

  1.  Collision Detection

  1.  Force Computation

  1.  Dynamics Simulation

Host Interface

This part communicates with the game engine.  If you happen to drive a tank through a wall the physics simulation can figure out what happens to the wall.  But, in order for this to happen the simulation has to be told where you are moving the tank.

The interface goes well beyond just moving objects around though, the game engine can change the properties of the simulation in real time.  If you have action on a space station and gravity gets switched off the engine will tell the simulation about this and the simulation will change accordingly.

The host interface also works the other way around as often the simulation will trigger an event and need to tell the game engine about this.  An example would be when an object hits your player, the simulation tells the game engine and it deducts a few life points.

Collision Detection

When your tank drives into the wall it collides with the bricks its made from.  In this case the force of the tank colliding with the wall will cause the bricks to move, collision detection works out which bricks are affected.

This is a very complex process as all manner of calculations are involved and you have to compare every object against every other object.  In reality though this requires far to much computation so various techniques are used to reduce the overhead.  One method breaks the scene up into different zones and only compares parts within them.  Another method is to use less accurate “coarse” collision detection to see if there is a collision then use more compute intensive “fine” detection to work out the exactly what is hitting what, where.

Force Computation

When the tank hits the wall some bricks will be pushed out of the way.  Collision detection tells you which ones are affected but now you need to work out the exact details of each collision.  You need to calculate the forces acting on each brick, these will differ as they depend on how each brick is being hit and where.  These forces will include the force of the tank hitting it, gravity and the force of bricks above it pushing downwards.  Other bricks may not be hit directly but will nevertheless be affected.  Bricks above the ones being hit will now have nothing to hold them up so they will fall.

Dynamics Simulation

When something moving collides with something else its speed and path will change from what it was doing before.  How fast they move and what direction they go in is calculated by working out how the forces on the object interact.  Even if objects do not collide there will still be changes due to wind resistance and gravity.  Dynamics simulation handles all this.

Working Together

All these parts need to work together to give a correctly simulation.

If a brick happens to hit your player while driving through the wall you need to calculate what the brick and your player does as a result.  Since your player was involved the game engine will need to be notified so some health points can be deducted.  In such a case all the parts of the simulation are involved.


A real simulation is much more complex that the system I’ve described as many different factors need to be considered in order to be realistic.  All of these require lots of mathematical operations, to ensure the movement is smooth these calculations will often be done at twice the frame rate of the game.


In some ways adding a complex physics simulation simplifies things in other areas.

For example, the simulation can include gravity and wind resistance but they can also be ignored for game set in space.  Since gravity is a force which acts on everything everything will be affected and act accordingly.  If you blow up something on the ground the parts will go flying everywhere but will slow down due to wind resistance and fall back to earth due to gravity.  If you blow up something in space where neither of these forces are present the parts are going to go everywhere and not stop.

Having both these environments in a game could involve a lot of different code for each environment, the physics simulation on the other hand can simulate both by including (or not) a pair of “force objects”.

The simulation can also be changed on the fly to allow all sorts of interesting effects.  A racing game may accurately model a car when racing but when a crash occurs the parameters could be changed on the fly to make a crash look more spectacular [Car] .

Visible objects have physical properties but it’s also quite possible to have invisible objects with properties, this allows things like invisible force fields to be added to a game.

The simulation can also be used to perform non-physically related tasks, you could place an invisible object which has no properties in a game and use it as a trigger.  When the collision detection indicates the object has been touched the game engine can trigger an action such as having new baddies appear.  You could use this sort of arrangement at a corner in a game to simulate a guard watching out for you.

Physical Hardware - Why?

Physical simulation already exists in games but you need a lot horsepower to do it properly.  It requires massive floating point capabilities and collision detection in particular requires potentially massive memory bandwidth.  General purpose CPUs have neither of these and are consequently not very good at these simulations.  It is for physics and other similar tasks that the processors in next generation games consoles such as the XBox 360 and PS3 have high bandwidth and huge floating point capabilities.

For the PC Ageia have created a custom processor dedicated to handling physics for much the same reason.  According to Ageia, current dual core processors can handle around 1,000 “ridged bodies” whereas the PhysX Physics Processor unit (PPU) can handle up to 32,000.

For a convincing physical simulation a game could have thousands of objects on screen at any one time.  Right now there is simply no way of doing this without dedicated hardware.


Lets Get Physical: Inside The PhysX Physics Processor

Part 1 - Game Physics

Part 2 - Physical Hardware

Part 3 - The Alternative And Others

Other Articles

© Nicholas Blachford 2006