Overview of NVidia PhysX

Overview of NVidia PhysX
Bob Schade
Former Developer Support Engineer for
Ageia Technologies (which was bought by
NVidia)
August 14-15 2006
Types of PhysX Objects
Basically 3 Types of Objects you can
Build with the PhysX SDK
I. Physical Objects in Different States of
Matter
II. Query Objects
III. Player / AI Objects (Special Gameplay
Objects)
August 14-15 2006
I. Physical Objects (in
Different States of Matter)
Objects that represent physical objects in the
scene.
Things you think of as regular, everyday
objects.
1. Solids
2. Liquids
3. Gases
August 14-15 2006
I-1. Solids
Objects in Solid State of Matter
A.
B.
C.
D.
E.
F.
Static Objects
Kinematic Objects
Rigid Bodies (Non-Deformable Solids)
Rigid Bodies connected by Joints
Debris (Special Effects Rigid Bodies)
Soft Bodies (Deformable Solids)
August 14-15 2006
I-1A. Static Objects
Stationary objects that are unaffected by forces. Pretty
much anything generated by BSP or static geometry (see
Unreal 3 Editor).
Collision objects / geometry. Defines the boundaries of
the player’s movement.
Physical Manifestation
Triangle mesh
Polygon mesh
Examples
Floor
Walls
Stairs
Frequency: Very common
August 14-15 2006
I-1B. Kinematic Objects
Essentially static objects until they start moving, at
which point they push all dynamic objects out of the
way. Usually move according to a preset animation.
Physical Manifestation
Box
Sphere
Capsule
Convex mesh
Examples
Moving platforms
Elevators
Giant doors that block entry to another area until the player
finds a way to open them
Frequency: Common
August 14-15 2006
I-1C. Rigid Bodies (NonDeformable Solids)
Dynamic objects that fall under gravity and can be
pushed around. Sometimes can be picked up and moved
around or thrown.
Physical Manifestation
Box
Sphere
Capsule
Convex mesh
Examples
Boxes
Crates
Frequency: Common
August 14-15 2006
I-1D. Joints
Rigid Bodies connected by Joints
Physical Manifestation
Rigid body objects jointed together at a point
Examples
Swinging doors
Jointed ropes
Ragdolls
Frequency: Somewhat common
August 14-15 2006
I-1D. Joints (cont.)
Special Note: “Physically-Driven Animation”
Physically-Driven Animation
Joints can apply forces or torques to rigid bodies they connect
together, allowing for physically-driven animation (See Example
#3: “Natural Motion”)
Found in
“Grand Theft Auto IV”
“Backbreaker”
Frequency: Rare
August 14-15 2006
I-1E. Debris / Special Effects
Rigid Bodies
Dynamic objects that fall under gravity and can be
pushed around. Normal rigid bodies are unaffected by
them, they always push them out of the way.
Physical Manifestation
Particles (point sprites)
Boxes, spheres, capsules
Convex meshes
Examples
Sparks
Clutter
Debris from an explosion
Shattered glass
Frequency: Somewhat common
August 14-15 2006
I-1F. Soft Bodies (Deformable
Solids)
Bendable, foldable objects built using meshes of point
masses connected by springs.
Physical Manifestation
Triangle mesh
Polygon mesh
Examples
Cloth
Flags
Tarps
Bendable, squishy objects
Frequency: Somewhat common
August 14-15 2006
I-2. Liquids
Objects in Liquid State of Matter
A. Fluids
August 14-15 2006
I-2A. Fluids
Collections of particles that cohere to each other and
fall under gravity. They will expand to fill the bottom of
their container.
Physical Manifestation
Particles (point sprites)
Fluids surfaces (triangle mesh)
Examples
Blood
Oil
Pools of water
Frequency: Rare
August 14-15 2006
I-3. Gases
Objects in Gaseous State of Matter
A. Fluids can be used to simulate Gases if they
are weightless and only slightly cohesive.
August 14-15 2006
I-3A. Fluids to Simulate Gases
Collections of weightless particles that cohere to each
other slightly. They will expand to fill their container.
Often implemented just using simple particle systems.
Physical Manifestation
Particles (point sprites)
Fluids surfaces (triangle mesh)
Examples
Smoke
Fog
Fire
Frequency: Somewhat common
August 14-15 2006
II. Query Objects
Non-Physical Objects used to make queries to
the scene.
1. Raycasts
2. Volume Intersection Tests
3. Contacts
August 14-15 2006
II-1. Raycasts
Used to determine line of sight.
Answers the question: “Is Point B visible from Point A?”
Also: “What is the first object hit by the line segment
AB and where is it hit?”
Physical Manifestation
Line segment (AB)
Examples
Line of sight test
Light ray
Frequency: Very common
August 14-15 2006
II-2. Volume Intersection
Tests
Used to determine what objects are in a
particular region of space.
Answers the question: “What objects intersect
this geometric region?”
A. Geometric queries
B. Triggers
C. Forcefields
August 14-15 2006
II-2A. Geometric Queries
Used to scan for objects in a particular geometric
region, e.g., in front of or near the player or AI (See
Example #5: “Obstacle Avoidance for AI”).
Physical Manifestation
Box, sphere, capsule
Convex mesh
Examples
AI obstacle detection box
Frequency: Very common
August 14-15 2006
II-2B. Triggers
Used to determine when the player has entered a
particular location, setting off an event like a trap or
spawning enemies or starting a cutscene animation.
Used to signal the player has reached a checkpoint in
the level or the end of the level.
Physical Manifestation
Box, sphere, capsule
Convex mesh
Examples
Trigger to spawn enemies
Frequency: Very common
August 14-15 2006
II-2C. Forcefields
Geometric volume where you apply a force to objects
intersecting the volume.
Used to simulate buoyancy, wind, currents, magnetic
fields.
Physical Manifestation
Box, sphere, capsule
Convex mesh
Examples
Wind tunnel
Tornado
Water currents
Force from explosion
Frequency: Somewhat common
August 14-15 2006
II-3. Contacts
Used to determine at what point one object is touching
another object and with what force.
Answers the question: “At what point(s) is one object in
contact with another object?”
Physical Manifestation
Point of contact
Contact normal
Examples
Sparks flying on contact
Splashes from rocks hitting pond
Objects denting each other
Sound created from impact
Frequency: Common
August 14-15 2006
III. Player / AI Objects
Objects that represent the Player or AI moving
through the scene (a.k.a., avatar objects,
special contact/force objects, special gameplay
objects).
Used when you want lots of precise, specific
control over the interaction of the object with
the scene, physical environment. Used when
the Player or AI provides precise, specific input
to control the object, move the object around.
1. Character Controllers
2. Vehicles
August 14-15 2006
III-1. Character Controllers
Physical object used to represent the player or AI as a
character.
Special Physical Properties
Capsule glides effortlessly along floor and walls, capsule hops up objects
under a certain height (climbs stairs), capsule glides up inclines until
incline reaches certain angle, capsule glides down certain inclines until
angle is too steep and it slides uncontrollable, capsule can jump to a
certain height. Special example is “Mirror’s Edge” where the capsule is
rigged with logic to do parkour moves. (See Example #1: “Mirror’s Edge”)
Physical Manifestation
Capsule
Cylinder
Rectangular solid
Examples
Most player characters are
implemented this way
Frequency: Very common
August 14-15 2006
III-1. “Better Know your AI”
Make your Player / AI character controllers
interchangeable, i.e., playable by either the Player or
the AI.
This means that at any point in the game you can take over an AI character
and start playing the game as an AI.
Really good example: “Left 4 Dead 2”. Demonstrates player / AI
interchangeability. I like this game because the AI character is capable of
doing the same thing the player character is capable of. The player and
the AI can operate the same character controller. The character controller
is controlled by the player or the AI. The character controller is the same
for both. The only difference is who is providing inputs to the character
controller, the player or the AI.
As an AI programmer I love this because it allows you to see the game
through the eyes of the AI. When you can do this, you start to see all kinds
of behaviours you might want to implement for your AI, because they’re
behaviours you can actually try out yourself as a player. I highly
recommend implementing your character controller this way: have a
character controller that either the player or AI can take control of.
August 14-15 2006
III-2. Vehicles
Physical object used to represent the
player or AI as a vehicle.
A.
B.
C.
D.
E.
Cars
Motorcycles
Planes
Helicopters
Boats
August 14-15 2006
III-2A. Cars
Car Objects
Special Physical Properties
Wheel contacts are special force contacts designed to exert
different forces on the road depending on brakes, acceleration,
road surface, downforce on the tire, etc.
Physical Manifestation
Car chassis (convex mesh)
4 wheel contacts
Found in
Racing games
“Grand Theft Auto III”
“Burnout”
Frequency: Very common
August 14-15 2006
III-2B. Motorcycles
Motorcycle Objects
Special Physical Properties
Wheel contacts are special force contacts designed to exert
different forces on the road depending on brakes, acceleration,
road surface, downforce on the tire, etc.
Physical Manifestation
Motorcycle body (convex mesh)
2 wheel contacts
Found in
“Grand Theft Auto III: Vice City”
Frequency: Somewhat common
August 14-15 2006
III-2C. Planes
Plane Objects
Special Physical Properties
The propeller or jet engine provides thrust (force) to accelerate the
plane horizontally. Airfoil surfaces provide lift as the plane picks
up horizontal speed and also steer the plane (rudder).
Physical Manifestation
Plane body (convex mesh)
2 wheel contacts
Airfoil surfaces (elevators, rudder)
Propeller (jet engine)
Found in
Flight simulators
Frequency: Common
August 14-15 2006
III-2D. Helicopters
Helicopter Objects
Special Physical Properties
The main rotor provides lift for the helicopter and also forward
acceleration as the helicopter angles forward. The tail rotor
provides force left or right to turn the helicopter around the main
rotor axis.
Physical Manifestation
Helicopter body (convex mesh)
2 skid objects
Main rotor
Tail rotor (stabilizer)
Found in
“Battlefield 2”
Frequency: Somewhat common
August 14-15 2006
III-2E. Boats
Boat Objects
Special Physical Properties
Boat displaces a certain amount of water and is buoyed up to a
certain point on the water line depending on overall weight and
displacement. The rudder steers the boat. The propeller provides
force to move the boat forward.
Physical Manifestation
Boat hull (convex mesh)
Rudder
Propeller (screws)
Found in
“Far Cry 2”
“Grand Theft Auto III: Vice City”
Frequency: Somewhat common
August 14-15 2006
Further Information
For further technical information, download
the NVidia PhysX SDK (see Example #11:
“NVidia PhysX SDK Download”)
Install the SDK and look at:
C:\Program Files\NVIDIA Corporation\NVIDIA
PhysX SDK\v2.8.3\TrainingPrograms
…for tutorials on how to use the SDK.
August 14-15 2006
1. “Mirror’s Edge”
http://www.youtube.com/watch?v=tvhw_v3q4L8
2. Unreal Engine 3
http://udn.epicgames.com/Three/DevelopmentKitProgramming.html
3. Natural Motion (physically driven animation SDK and editor)
http://www.naturalmotion.com/
4. NVidia PhysX Particle Fluid Demo (last demo in the power
pack)
http://www.nvidia.com/content/graphicsplus/us/download.asp
5. Obstacle Avoidance for AI
http://www.red3d.com/cwr/steer/Obstacle.html
© 2006 Microsoft Corporation. All rights reserved.
This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
August 14-15 2006
6. Simul-X (vehicle SDK)
http://www.simul-x.com/
7. CarX-Tech (vehicle SDK)
http://www.carx-tech.com/
8. PhysX Destruction Demo
http://www.youtube.com/watch?v=N1FOnpzUzZY
9. NVidia PhysX Homepage
http://www.nvidia.com/object/physx_new.html
10. NVidia PhysX Developer Page
http://developer.nvidia.com/object/physx.html
11. NVidia PhysX SDK Download
http://developer.nvidia.com/object/physx_downloads.html
© 2006 Microsoft Corporation. All rights reserved.
This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
August 14-15 2006
PowerPoint Guidelines
Font, size, and color for text have
been formatted for you in the
Slide Master
Use the color palette shown below
See next slide for additional guidelines
Sample fill
color
Sample fill
color
Sample fill
color
August 14-15 2006
DirectX Developer Center
http://msdn.microsoft.com/directx
Game Development MSDN Forums
http://forums.microsoft.com/msdn
Xbox 360 Central
http://xds.xbox.com/
Game Developer Support
gameds@microsoft.com
XNA Website
http://www.microsoft.com/xna
© 2006 Microsoft Corporation. All rights reserved.
This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
August 14-15 2006
Name
Title
Company
August 14-15 2006
Name
Title
Company
August 14-15 2006
Name
Title
Company
August 14-15 2006
August 14-15 2006