cs599_sp10_havok - University of Southern California

advertisement
CS 599
Physically Based Modeling for Interactive
Simulation and Games
Case Study:
Havok Engine for Game Physics
Jernej Barbic
University of Southern California
1
Physics in games
• Custom, in-house software
• Off-the shelf libraries
• Physics middleware
2
Physics Engines
• Real-time
– Video games
• High precision
– Slow
– Film
– Scientific computing
Half-life 2
3
Real-time physics engines:
open source
• Open Dynamics Engine (ODE)
• Bullet
• SOFA
• and several others
4
Real-time physics engines:
commercial
• Havok (Ireland) (now Intel)
• Physx (formerly NovodeX, now nVidia)
• Vortex (Montreal)
5
Components of physics engine
• Collision detection
• Dynamics
– rigid objects
– cloth
– fluids
QuickTime™ and a
decompressor
are needed to see this picture.
• Fracture
6
Rigid object contact
• Penalty-based
– popular with soft/deformable objects
• Impulse-based
• Constraint-based
– expensive, suitable for continuous contact
7
Real-time simulation
• Speed more important than accuracy
• Objects have two
representations:
– Complex geometry
(rendering)
– Simplified geometry
(collision detection,
dynamics)
8
Characters
• Rag-doll physics
– Rigid objects
• Cloth
• Controller
– Natural motion
• Particles (hair)
9
Physics processing
unit (PPU)
• Dedicated physics
co-processor
• SPARTA and HELLAS
– academic
– Penn State, Univ. of Georgia
• Ageia (Switzerland, 2006)
– later merged into nVidia
– use AGEIA's PhysX SDK
10
GPGPU
• Havok FX
– may have been cancelled
• Multi-GPU technology
– ATI (CrossFire)
– nVidia (SLI)
• Increasingly more suitable for physics
11
Intel Larrabee
• Many-core x86
• Fusion of CPU
and GPU
• Suitable for physics
• Was scheduled for 2010, but delayed
12
Havok
• Real-time commercial physics engine
• Company bought by Intel (2007)
($110 million)
• Used in 150 games
– Halo 3
– Half Life 2
13
Havok Engine
• Animation
– Fast playback
– Real-time blending
– Inverse kinematics
– Retargeting
QuickTime™ and a
decompressor
are needed to see this picture.
• AI
– path-finding
14
Havok Engine
• Behavior
– Character behavior development tool
• Cloth
• Destruction
• Physics
15
Havok Physics
QuickTime™ and a
decompressor
are needed to see this picture.
16
Havok Physics
• Collision detection
• Constraints
QuickTime™ and a
decompressor
are needed to see this picture.
• Rigid bodies
• Cloth
Uncharted 2: Among thieves
• Continuous physics
17
Havok Physics
• Vehicle simulation
QuickTime™ and a
decompressor
are needed to see this picture.
• Human ragdolls
• Character controller
– simulate enemy characters being hit
18
Havok Physics
• Visual debugger
and profiler
• Content creation
tools
QuickTime™ and a
decompressor
are needed to see this picture.
• Integration with
3rd-party renderers
– 3D Studio Max
– Maya
19
Havok Physics
• Extensively optimized
(machine code)
• Microsoft Xbox
• Sony PLAYSTATION
• Nintendo Wii
• PC
20
Havok Physics is not…
• Simple technology
– Must invest time to use it
• Black box
– Must understand the components
and recombine them
• Commercial renderer
21
Havok Physics
• The “Havok World”
(hkpWorld)
• Contains all
physical objects
in the simulation
QuickTime™ and a
decompressor
are needed to see this picture.
• Timesteps the
simulation
forward in time
22
Rigid objects
• The central object in Havok
• hkpRigidObject class
• Add to the “world”
• Set mass, inertia tensor, etc.
23
Constraints
Ball and
socket
Hinge
Translational
24
Constraints
QuickTime™ and a
decompressor
are needed to see this picture.
25
Constraints
QuickTime™ and a
decompressor
are needed to see this picture.
QuickTime™ and a
decompressor
are needed to see this picture.
QuickTime™ and a
decompressor
are needed to see this picture.
26
Collision Detection
• Broad phase and narrow phase
QuickTime™ and a
decompressor
are needed to see this picture.
Broad
phase
27
Collision Detection
•
•
•
•
•
•
Narrow phase
Spheres
AABBs
Cylinders
Capsules
Compound shapes
28
Collision Detection: Queries
• Closest points between two bodies
• Whether two bodies penetrate
• Raycast a point through space
and get colliding objects
29
Continuous Physics
QuickTime™ and a
decompressor
are needed to see this picture.
30
Continuous Physics
• Time of impact:
QuickTime™ and a
decompressor
are needed to see this picture.
31
QuickTime™ and a
decompressor
are needed to see this picture.
32
Download