1 cs 599 physically based modeling for interactive simulation and games case study: havok engine for...

32
1 CS 599 Physically Based Modeling for Interactive Simulation and Games Case Study: Havok Engine for Game Physics Jernej Barbic University of Southern California

Post on 20-Dec-2015

215 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 1 CS 599 Physically Based Modeling for Interactive Simulation and Games Case Study: Havok Engine for Game Physics Jernej Barbic University of Southern

1

CS 599Physically Based Modeling for Interactive

Simulation and Games

Case Study:Havok Engine for Game Physics

Jernej BarbicUniversity of Southern California

Page 2: 1 CS 599 Physically Based Modeling for Interactive Simulation and Games Case Study: Havok Engine for Game Physics Jernej Barbic University of Southern

2

Physics in games

• Custom, in-house software

• Off-the shelf libraries

• Physics middleware

Page 3: 1 CS 599 Physically Based Modeling for Interactive Simulation and Games Case Study: Havok Engine for Game Physics Jernej Barbic University of Southern

3

Physics Engines

• Real-time– Video games

• High precision– Slow– Film– Scientific computing

Half-life 2

Page 4: 1 CS 599 Physically Based Modeling for Interactive Simulation and Games Case Study: Havok Engine for Game Physics Jernej Barbic University of Southern

4

Real-time physics engines:open source

• Open Dynamics Engine (ODE)

• Bullet

• SOFA

• and several others

Page 5: 1 CS 599 Physically Based Modeling for Interactive Simulation and Games Case Study: Havok Engine for Game Physics Jernej Barbic University of Southern

5

Real-time physics engines:commercial

• Havok (Ireland) (now Intel)

• Physx (formerly NovodeX, now nVidia)

• Vortex (Montreal)

Page 6: 1 CS 599 Physically Based Modeling for Interactive Simulation and Games Case Study: Havok Engine for Game Physics Jernej Barbic University of Southern

6

Components of physics engine

• Collision detection

• Dynamics– rigid objects– cloth– fluids

• Fracture

QuickTime™ and a decompressor

are needed to see this picture.

Page 7: 1 CS 599 Physically Based Modeling for Interactive Simulation and Games Case Study: Havok Engine for Game Physics Jernej Barbic University of Southern

7

Rigid object contact

• Penalty-based– popular with soft/deformable objects

• Impulse-based

• Constraint-based– expensive, suitable for continuous contact

Page 8: 1 CS 599 Physically Based Modeling for Interactive Simulation and Games Case Study: Havok Engine for Game Physics Jernej Barbic University of Southern

8

Real-time simulation

• Speed more important than accuracy

• Objects have two representations:– Complex geometry

(rendering)– Simplified geometry

(collision detection, dynamics)

Page 9: 1 CS 599 Physically Based Modeling for Interactive Simulation and Games Case Study: Havok Engine for Game Physics Jernej Barbic University of Southern

9

Characters• Rag-doll physics

– Rigid objects

• Cloth

• Controller– Natural motion

• Particles (hair)

Page 10: 1 CS 599 Physically Based Modeling for Interactive Simulation and Games Case Study: Havok Engine for Game Physics Jernej Barbic University of Southern

10

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

Page 11: 1 CS 599 Physically Based Modeling for Interactive Simulation and Games Case Study: Havok Engine for Game Physics Jernej Barbic University of Southern

11

GPGPU

• Havok FX– may have been cancelled

• Multi-GPU technology– ATI (CrossFire)– nVidia (SLI)

• Increasingly more suitable for physics

Page 12: 1 CS 599 Physically Based Modeling for Interactive Simulation and Games Case Study: Havok Engine for Game Physics Jernej Barbic University of Southern

12

Intel Larrabee

• Many-core x86

• Fusion of CPU and GPU

• Suitable for physics

• Was scheduled for 2010, but delayed

Page 13: 1 CS 599 Physically Based Modeling for Interactive Simulation and Games Case Study: Havok Engine for Game Physics Jernej Barbic University of Southern

13

Havok

• Real-time commercial physics engine

• Company bought by Intel (2007) ($110 million)

• Used in 150 games– Halo 3– Half Life 2

Page 14: 1 CS 599 Physically Based Modeling for Interactive Simulation and Games Case Study: Havok Engine for Game Physics Jernej Barbic University of Southern

14

Havok Engine

• Animation– Fast playback– Real-time blending– Inverse kinematics– Retargeting

• AI– path-finding

QuickTime™ and a decompressor

are needed to see this picture.

Page 15: 1 CS 599 Physically Based Modeling for Interactive Simulation and Games Case Study: Havok Engine for Game Physics Jernej Barbic University of Southern

15

Havok Engine

• Behavior– Character behavior development tool

• Cloth

• Destruction

• Physics

Page 16: 1 CS 599 Physically Based Modeling for Interactive Simulation and Games Case Study: Havok Engine for Game Physics Jernej Barbic University of Southern

16

Havok Physics

QuickTime™ and a decompressor

are needed to see this picture.

Page 17: 1 CS 599 Physically Based Modeling for Interactive Simulation and Games Case Study: Havok Engine for Game Physics Jernej Barbic University of Southern

17

Havok Physics

• Collision detection

• Constraints

• Rigid bodies

• Cloth

• Continuous physics

QuickTime™ and a decompressor

are needed to see this picture.

Uncharted 2: Among thieves

Page 18: 1 CS 599 Physically Based Modeling for Interactive Simulation and Games Case Study: Havok Engine for Game Physics Jernej Barbic University of Southern

18

Havok Physics

• Vehicle simulation

• Human ragdolls

• Character controller– simulate enemy characters being hit

QuickTime™ and a decompressor

are needed to see this picture.

Page 19: 1 CS 599 Physically Based Modeling for Interactive Simulation and Games Case Study: Havok Engine for Game Physics Jernej Barbic University of Southern

19

Havok Physics

• Visual debugger and profiler

• Content creation tools

• Integration with 3rd-party renderers– 3D Studio Max– Maya

QuickTime™ and a decompressor

are needed to see this picture.

Page 20: 1 CS 599 Physically Based Modeling for Interactive Simulation and Games Case Study: Havok Engine for Game Physics Jernej Barbic University of Southern

20

Havok Physics

• Extensively optimized (machine code)

• Microsoft Xbox

• Sony PLAYSTATION

• Nintendo Wii

• PC

Page 21: 1 CS 599 Physically Based Modeling for Interactive Simulation and Games Case Study: Havok Engine for Game Physics Jernej Barbic University of Southern

21

Havok Physics is not…

• Simple technology– Must invest time to use it

• Black box– Must understand the components

and recombine them

• Commercial renderer

Page 22: 1 CS 599 Physically Based Modeling for Interactive Simulation and Games Case Study: Havok Engine for Game Physics Jernej Barbic University of Southern

22

Havok Physics

• The “Havok World” (hkpWorld)

• Contains all physical objectsin the simulation

• Timesteps the simulationforward in time

QuickTime™ and a decompressor

are needed to see this picture.

Page 23: 1 CS 599 Physically Based Modeling for Interactive Simulation and Games Case Study: Havok Engine for Game Physics Jernej Barbic University of Southern

23

Rigid objects

• The central object in Havok

• hkpRigidObject class

• Add to the “world”

• Set mass, inertia tensor, etc.

Page 24: 1 CS 599 Physically Based Modeling for Interactive Simulation and Games Case Study: Havok Engine for Game Physics Jernej Barbic University of Southern

24

Constraints

Ball andsocket

Hinge Translational

Page 25: 1 CS 599 Physically Based Modeling for Interactive Simulation and Games Case Study: Havok Engine for Game Physics Jernej Barbic University of Southern

25

Constraints

QuickTime™ and a decompressor

are needed to see this picture.

Page 26: 1 CS 599 Physically Based Modeling for Interactive Simulation and Games Case Study: Havok Engine for Game Physics Jernej Barbic University of Southern

26

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.

Page 27: 1 CS 599 Physically Based Modeling for Interactive Simulation and Games Case Study: Havok Engine for Game Physics Jernej Barbic University of Southern

27

Collision Detection

• Broad phase and narrow phase

QuickTime™ and a decompressor

are needed to see this picture.

Broadphase

Page 28: 1 CS 599 Physically Based Modeling for Interactive Simulation and Games Case Study: Havok Engine for Game Physics Jernej Barbic University of Southern

28

Collision Detection

• Narrow phase

• Spheres

• AABBs

• Cylinders

• Capsules

• Compound shapes

Page 29: 1 CS 599 Physically Based Modeling for Interactive Simulation and Games Case Study: Havok Engine for Game Physics Jernej Barbic University of Southern

29

Collision Detection: Queries

• Closest points between two bodies

• Whether two bodies penetrate

• Raycast a point through spaceand get colliding objects

Page 30: 1 CS 599 Physically Based Modeling for Interactive Simulation and Games Case Study: Havok Engine for Game Physics Jernej Barbic University of Southern

30

Continuous Physics

QuickTime™ and a decompressor

are needed to see this picture.

Page 31: 1 CS 599 Physically Based Modeling for Interactive Simulation and Games Case Study: Havok Engine for Game Physics Jernej Barbic University of Southern

31

Continuous Physics

• Time of impact:

QuickTime™ and a decompressor

are needed to see this picture.

Page 32: 1 CS 599 Physically Based Modeling for Interactive Simulation and Games Case Study: Havok Engine for Game Physics Jernej Barbic University of Southern

32

QuickTime™ and a decompressor

are needed to see this picture.