havok. ©copyright 2006 havok.com (or its licensors). all rights reserved. havokfx next gen physics...

34
Havok. ©Copyright 2006 Havok.com (or its licensors). All Rights Reserved. HavokFX Next Gen Physics on ATI GPUs Andrew Bowell – Senior Engineer Peter Kipfer – Senior Engineer

Upload: calvin-small

Post on 28-Dec-2015

216 views

Category:

Documents


0 download

TRANSCRIPT

Havok. ©Copyright 2006 Havok.com (or its licensors). All Rights Reserved.

HavokFXNext Gen Physics on ATI GPUs

Andrew Bowell – Senior Engineer

Peter Kipfer – Senior Engineer

Havok. ©Copyright 2006 Havok.com (or its licensors). All Rights Reserved.

Why use physics in games?

A brief history of the Havok SDK Havok 1

Large feature set; rigid bodies, cloth, rope, soft bodies, water, particles

Havok 2 Rigid body physics for the PS2 generation

Havok 3 Ultra realistic physics

Havok 4 Next-gen physics

Havok. ©Copyright 2006 Havok.com (or its licensors). All Rights Reserved.

What is “next gen” physics?

Gameplay physics

Fx physics

Performance

Performance

Performance

Performance

Performance

Quality

Customization

Controllability

Havok. ©Copyright 2006 Havok.com (or its licensors). All Rights Reserved.

What is FX physics?

Physics based effects on a massive scale 1,000s to 10,000s of objects– Rigid bodies– Particles– Fluids– Cloth– and more to come

Running on PC and consoles (Xbox 360, PS3)

Havok. ©Copyright 2006 Havok.com (or its licensors). All Rights Reserved.

Why use the GPU?

The GPU is a next-gen platform– Can be thought of as a 1000

multiprocessor machine

It is unbelievably fast when given the right task– Rendering, for example

Huge existing install base of graphics cards capable of running GPU physics

Havok. ©Copyright 2006 Havok.com (or its licensors). All Rights Reserved.

Havok and ATI

Strong partnership Working specifically on HavokFX in the run up to its showcase on ATI at Computex 2006

Best Innovation – Computex 2006 [Hexus]

Havok. ©Copyright 2006 Havok.com (or its licensors). All Rights Reserved.

How does the GPU work?

GPUs are very powerful data parallel processors– 1000 simultaneous threads– Very high memory bandwidth– 1 cycle latency per instruction– Can execute up to 4 instructions per cycle

ATI X1900 XTX– 48 pixel processors– Over 350 GFLOPS

Issues– Normally only up to 16 float outputs in SM3.0– Limited inputs too

Havok. ©Copyright 2006 Havok.com (or its licensors). All Rights Reserved.

Demo Set 1

Havok. ©Copyright 2006 Havok.com (or its licensors). All Rights Reserved.

Solve Collision

sIntegrate Collide

Ballistic physics refresher course

Havok. ©Copyright 2006 Havok.com (or its licensors). All Rights Reserved.

Find overlapping pairsIntegrate

Havok. ©Copyright 2006 Havok.com (or its licensors). All Rights Reserved.

Narrow phase collide

Havok. ©Copyright 2006 Havok.com (or its licensors). All Rights Reserved.

Solve collisions

Havok. ©Copyright 2006 Havok.com (or its licensors). All Rights Reserved.

Solve Collision

sIntegrate Collide

Is physics a data parallel task?

Anatomy of a clock tick

Havok. ©Copyright 2006 Havok.com (or its licensors). All Rights Reserved.

Is physics a data parallel task?

Step Body 1

Step Body 2

Step Body 1000

Integrate

New Positions

Position&

Velocity

Havok. ©Copyright 2006 Havok.com (or its licensors). All Rights Reserved.

Solve Collision

s

Integrate

Collide

Anatomy of a clock tick

Is physics a data parallel task?

Havok. ©Copyright 2006 Havok.com (or its licensors). All Rights Reserved.

Is physics a data parallel task?

Find pairs

Collide Pair 1

Collide Pair 2

Collide Pair 4000

Collide

ContactsNewPositions

Havok. ©Copyright 2006 Havok.com (or its licensors). All Rights Reserved.

Solve Collision

sIntegrate Collide

Anatomy of a clock tick

Is physics a data parallel task?

Havok. ©Copyright 2006 Havok.com (or its licensors). All Rights Reserved.

Is physics a data parallel task?

Solve Collisions

NewVelocities

Contacts&

Velocities

Body 1

Body 2

Body 5

Body 7

Body 6

Body 3 Body 8

Body 4

1

23

4

5

6

7

8 910

11

12

Havok. ©Copyright 2006 Havok.com (or its licensors). All Rights Reserved.

Is physics a data parallel task?

Solve Collisions

NewVelocities

Contacts&

Velocities

Body 1

Body 2

Body 5

Body 7

Body 6

Body 3 Body 8

Body 4

Havok. ©Copyright 2006 Havok.com (or its licensors). All Rights Reserved.

Is physics a data parallel task?

Solve Collisions

NewVelocities

Contacts

Solve link 1

Solve link 2

Solve link

1200

Solve link 1

Solve link 2

Solve link 1000

Solve link 1

Solve link 2

Solve link 800

Batch 1 Batch 2 Batch 3

Havok. ©Copyright 2006 Havok.com (or its licensors). All Rights Reserved.

Solve Collision

sIntegrate Collide

Physics is a data parallel task

100% data parallel

80% data parallel

95% data parallel

Havok. ©Copyright 2006 Havok.com (or its licensors). All Rights Reserved.

Havok Fx Features Overview

FX Rigid Bodies– Convex collision bodies– Simple stable stacking

FX Particles– Inelastic particle-particle collisions– Fluid effects– Cloth

Lightweight framework

Fully integrated with Havok 4.0– Everything collides with everything else

Havok. ©Copyright 2006 Havok.com (or its licensors). All Rights Reserved.

FX Particles

Particles are like simple rigid bodies

Much faster to simulate and render– One vertex per particle (point sprites)

Havok FX particle framework gives you– Particle-particle collisions– Particle-rigid body collisions– User-defined behaviours and emitters

Havok. ©Copyright 2006 Havok.com (or its licensors). All Rights Reserved.

FX Behaviors and Emitters

Executed on GPU Uses SM3.0, e.g. HLSL

Alter velocities and positions– Wind, gravity

Per object user data – for custom properties

Havok. ©Copyright 2006 Havok.com (or its licensors). All Rights Reserved.

Integrated Toolchain

Leverages Havok physics exporters and tools pipeline

Havok. ©Copyright 2006 Havok.com (or its licensors). All Rights Reserved.

Preview and Pipeline

Havok. ©Copyright 2006 Havok.com (or its licensors). All Rights Reserved.

Simple behaviors

GPU Memory

Positions

Velocities

CPU Memor

y

Readback from GPUWrite back to GPUModify on CPU

Havok. ©Copyright 2006 Havok.com (or its licensors). All Rights Reserved.

GPU Memory

Positions Textures

Game play physics interaction

CPU Memory

Rigid Bodies

Collision shapes

Velocities Textures

Collision Shapes Textures

Game play physics FX physics

Once perSimulation

Once perFrame

Havok. ©Copyright 2006 Havok.com (or its licensors). All Rights Reserved.

Demo Set 2

Havok. ©Copyright 2006 Havok.com (or its licensors). All Rights Reserved.

Rendering and CrossFire

Rendering needs careful consideration!– Most renderers will not render 20K objects well– Must use custom / vendor techniques

Havok FX returns handle to vertex buffers– Current rigid body transforms– Current particle positions– Optionally other particle / body state useful for

rendering

The future is multiple GPUs

Havok. ©Copyright 2006 Havok.com (or its licensors). All Rights Reserved.

Dual and Triple GPU Physics

Second (or third) GPU can be used for graphics or physics simulation, or share the primary card

Havok. ©Copyright 2006 Havok.com (or its licensors). All Rights Reserved.

FX Rigid Bodies again

We said the GPU was fast…

Havok. ©Copyright 2006 Havok.com (or its licensors). All Rights Reserved.

Future of Havok FX

Distributing physics across multiple GPUs– e.g. 2 GPUs for physics, 2 for rendering

Brittle fractureAdvanced smoke/cloud rendering– Volumetric shadowing

Advanced fluids– Smoothed particle hydrodynamics– Isosurface extraction using DirectX 10

Geometry Shader

Havok. ©Copyright 2006 Havok.com (or its licensors). All Rights Reserved.

Last Slide