physics artifacts

59

Upload: pedram-mazloom

Post on 26-May-2015

153 views

Category:

Technology


1 download

DESCRIPTION

Game physics artifacts described in GDC 11

TRANSCRIPT

Page 1: Physics artifacts
Page 2: Physics artifacts

Game Physics Artifacts

Erwin Coumans, AMD

Page 3: Physics artifacts

Intro

• Collision shape and contact artifacts

• Dynamics and constraint solving artifacts

Page 4: Physics artifacts

SCE Physics Effects and Bullet

• http://bullet.googlecode.com

Page 5: Physics artifacts

Forward Dynamics Collision Detection

Detect

pairs

Forward Dynamics

Setup

constraints

Solve

constraints

Integrate

position

Apply

gravity

Collision Data Dynamics Data

Compute

AABBs

Predict

transforms

Collision

shapes

Object

AABBs

Overlapping

pairs

World

transforms

velocities

Mass

Inertia

Constraints

(contacts,

joints)

Compute

contact

points

Contact

points

Time Step Start End

Page 6: Physics artifacts

bounding volume artifacts

• axis aligned bounding boxes (AABB) • if bounds are too small, you might get

shootouts

Page 7: Physics artifacts

Single contact point artifacts

Page 8: Physics artifacts

Single contact point

Page 9: Physics artifacts

Single contact point

Page 10: Physics artifacts

Single contact point

Page 11: Physics artifacts

Multiple contact points

• Feature clipping

• Persistent contact cache

• Perturbation to fill the contact cache

Page 12: Physics artifacts

Feature clipping

n

incident

reference

Page 13: Physics artifacts

Feature clipping

n

clipping planes

Page 14: Physics artifacts

Shapes without features?

Page 15: Physics artifacts

Persistent Contact Cache

• Add a single point at a time to a cache

• Refresh cache, update or remove points

Page 16: Physics artifacts

Updating local contact points

Shape

A

Shape

B

a

n

b

d a n

b d‘

Page 17: Physics artifacts

Removing points

a n

b d‘

Page 18: Physics artifacts

Contact reduction

• Keep up to 4 contact points

• keep point with deepest penetration

• maximize area of the points

Page 19: Physics artifacts

Stable stacking

Page 20: Physics artifacts

contact caching artifacts

Sliding clears cache

Page 21: Physics artifacts

Perturbation

Page 22: Physics artifacts

Perturbation in 3D

Page 23: Physics artifacts

Hybrid method

• Single shot manifold to build a full cache

• Only add a single point to a full cache

• Google for btPersistentManifold

Page 24: Physics artifacts

Perturbation artifact

• Curved objects start rolling

• Use damping to prevent it

Page 25: Physics artifacts

internal edge artifacts

Page 26: Physics artifacts

triangle A triangle B internal edge

3D view

2D view

Page 27: Physics artifacts

triangle A triangle B

internal edge

2D view

Page 28: Physics artifacts

triangle A triangle normal B

internal edge

2D view

corrected

contact normal

Page 29: Physics artifacts

triangle A

triangle normal B internal edge

2D view

corrected

contact normal

Page 30: Physics artifacts

triangle A

triangle normal B

internal edge

2D view

triangle normal A edge voronoi region

triangle B

Page 31: Physics artifacts

triangle A

triangle normal B

internal edge

2D view

triangle normal A edge voronoi region

triangle B

Page 32: Physics artifacts

Internal edges

• Need to solve some more corner cases

Page 33: Physics artifacts

tunneling artifacts

Page 34: Physics artifacts

collision shape artifacts

• Avoid concave triangle meshes

• Use visual debugging tools

Page 35: Physics artifacts

shape scale artifacts

• large scale appears as slow motion • avoid scaling, skew, shear in rigid transforms • Use local scaling instead of global scaling

Page 36: Physics artifacts

Convex decomposition

Page 37: Physics artifacts

Convex Decomposition

Page 38: Physics artifacts

Subdividing the time step

Page 39: Physics artifacts

Even smaller time steps

Page 40: Physics artifacts

Conservative Advancement

Page 41: Physics artifacts

Predictive contact constraints

• Add contact constraints using closest distance/points computation

Page 42: Physics artifacts

Predictive contact constraints

• The constraint solver will allow the object to move up to the given distance

Page 43: Physics artifacts

Fix your time step

• fixed time step versus variable timestep • clamping causes slow-motion

Page 44: Physics artifacts

Well of despair

Slower frame rate

More sub steps Slower simulation

Page 45: Physics artifacts

mass ratio artifacts

• pgs constraint solver doesn't handle it well • heavy of top of light

Page 46: Physics artifacts

mass ratio artifacts

• Keep masses all very similar • Promising research in NNCG method (quadratic convergence) See http://iphys.wordpress.com/ and http://jinngine.googlecode.com

Page 47: Physics artifacts

Non-smooth Non-linear Conjugate

Gradient Method

Page 48: Physics artifacts

Jinngine NNCG java applet

Page 49: Physics artifacts

warm starting artifacts

• applied impulses are similar each frame, cache them • full warm starting can add energy so scale it down • assume that the configuration hardly change • this assumption doesn’t always hold, joint limits etc.

Page 50: Physics artifacts

constraint solving order artifacts

• complex interaction between various constraints • randomizing can help convergence

Page 51: Physics artifacts

friction artifacts

• coupled versus decoupled friction • friction pyramid approximation • clamping of friction directions • friction and warm starting

Page 52: Physics artifacts

friction artifacts

Page 53: Physics artifacts

Friction clamping artifact

• Use velocity direction as clamping axis

Page 54: Physics artifacts

center of mass artifacts

Page 55: Physics artifacts

Animated (kinematic) objects

• also known as kinematic objects • use infinite mass and inertia • update the linear and angular velocity

Page 56: Physics artifacts

Animated (kinematic) objects

Page 57: Physics artifacts

inertia tensor artifacts

• objects don't rotate

Page 58: Physics artifacts

inertia tensor artifacts

• angular motion causing instability and jitter • Shaking ragdoll limbs • Increase inertia tensor • Or aggressive deactivation

Page 59: Physics artifacts

References

• Game Physics Pearls, book by AK Peters (2010) • http://bulletphysics.org • http://iphys.wordpress.com/