Physics in Games David Overview of Physics in

  • Slides: 46
Download presentation
Physics in Games • David: Overview of Physics in Games • Steven: Character Animation

Physics in Games • David: Overview of Physics in Games • Steven: Character Animation • Ryan: Effects • Dan: Development Applications • Lowell: How physics engines work, future of physics

Tennis for Two (1958) First video game to incorporate physics Used ballistic missile calculations

Tennis for Two (1958) First video game to incorporate physics Used ballistic missile calculations to simulate a tennis ball

Spacewar! (1962) Used velocity calculations for ship movement First use of gravity simulation in

Spacewar! (1962) Used velocity calculations for ship movement First use of gravity simulation in a gravity well

Pong (1972) First commercially successful video game Used basic calculations for deflection and collision

Pong (1972) First commercially successful video game Used basic calculations for deflection and collision

Super Mario Bros. (1985) Incorporated acceleration, friction, and momentum into player movement

Super Mario Bros. (1985) Incorporated acceleration, friction, and momentum into player movement

Jurassic Park: Trespasser (1998) First game world completely controlled by classical mechanics First game

Jurassic Park: Trespasser (1998) First game world completely controlled by classical mechanics First game to use ragdoll physics

Havok Physics (2000) Commercial physics engine Collision detection Rigid bodies Multibody systems Ragdoll physics

Havok Physics (2000) Commercial physics engine Collision detection Rigid bodies Multibody systems Ragdoll physics Animation Inverse kinematics

Phys. X (2004) Developed by Ageia Acquired by Nvidia in 2009 Collison detection Joints

Phys. X (2004) Developed by Ageia Acquired by Nvidia in 2009 Collison detection Joints Materials Ragdoll Volumetric fluid Cloth

Most Popular Physics Engines of 2009

Most Popular Physics Engines of 2009

Red Faction (2001) Features Geo Mod engine Allowed for destructible environments

Red Faction (2001) Features Geo Mod engine Allowed for destructible environments

Half Life 2 (2004) Uses Havok Physics Made use of gravity gun

Half Life 2 (2004) Uses Havok Physics Made use of gravity gun

Assassin’s Creed (2007) Features heavy use of inverse kinematics Allows for Parkour / Freerunning

Assassin’s Creed (2007) Features heavy use of inverse kinematics Allows for Parkour / Freerunning

Arkham Asylum (2009) Hardware-accelerated Phys. X support Dynamic fog and steam Cloth physics Spark

Arkham Asylum (2009) Hardware-accelerated Phys. X support Dynamic fog and steam Cloth physics Spark effects

From Dust (2011) Use of fluid dynamics to model sand, dust, lava, and water

From Dust (2011) Use of fluid dynamics to model sand, dust, lava, and water

Crysis 3 (2013) Soft particle system Parametric skeletal animation Multi-threaded physics engine Soft body

Crysis 3 (2013) Soft particle system Parametric skeletal animation Multi-threaded physics engine Soft body physics Destructible environments Rope physics

Character Animation • • • Forward Kinematics Inverse Kinematics Ragdoll Physics

Character Animation • • • Forward Kinematics Inverse Kinematics Ragdoll Physics

Forward Kinematics An Example • • • Rotation of base: Rb o Apply M

Forward Kinematics An Example • • • Rotation of base: Rb o Apply M = Rb to base Translate lower arm relative to base: Tla Rotate lower arm around joint: Rla o Apply M = Rb Tla Rla to lower arm Translate upper arm relative to upper arm: Tua Rotate upper arm around joint: Rua o Apply M = Rb Tla Rla Tua Rua to upper arm

Forward Kinematics The Problem • Moving something high in hierarchy moves its children

Forward Kinematics The Problem • Moving something high in hierarchy moves its children

Inverse Kinematics • • Bottom-up approach More fluid and realistic motion More intuitive Higher

Inverse Kinematics • • Bottom-up approach More fluid and realistic motion More intuitive Higher computation cost

Inverse Kinematics Implementations • Jacobian Solutions Jacobian Transpose, Jacobian Pseudoinverse, Damped Least Square o

Inverse Kinematics Implementations • Jacobian Solutions Jacobian Transpose, Jacobian Pseudoinverse, Damped Least Square o Rely on Jacobian Matrix o Sometimes unstable and fail to converge o • Cyclic-Coordinate Descent Optimization Solution o Simpler to understand easy to process o Loop joints from tip to root trying to get them as close to target as possible o

Ragdoll Physics Problem: Canned death animations repetitive, boring, and unrealistic • Solution: Ragdoll Physics

Ragdoll Physics Problem: Canned death animations repetitive, boring, and unrealistic • Solution: Ragdoll Physics •

Ragdoll Physics Implementations • Verlet Integration o • • • Series of bones connected

Ragdoll Physics Implementations • Verlet Integration o • • • Series of bones connected at points with simple constraints Inverse Kinematics Post-Processing o Play an animation; use IK thereafter Blended Ragdoll o Play an animation, but constrain during playback Procedural Animation o Agents make decisions that translate to unique movements in real time

Ragdoll Physics

Ragdoll Physics

Particle Systems • • A technique that uses many small sprites or objects to

Particle Systems • • A technique that uses many small sprites or objects to simulate "fuzzy" phenomena, such as fire, smoke, moving water, etc. Two main types of particle systems Animated Particle Systems o Static Particle Systems o

Animated Particle Systems • • • Specific points in each particle's life cycle are

Animated Particle Systems • • • Specific points in each particle's life cycle are rendered each frame. Particles may have a fade out time or limited life span. This type of particle system is used to animate effects like fire and precipitation.

Static Particle Systems • • • The entire life cycle of each particle is

Static Particle Systems • • • The entire life cycle of each particle is rendered simultaneously in each frame. Rather that point particles, we have the particle's overall trajectory. This type of particle system is used to animate effects like hair and grass.

How Particle Systems Work • • • A particle system is usually controlled by

How Particle Systems Work • • • A particle system is usually controlled by an emitter. The emitter acts as the source of the particles, i. e. where the particles are generated and where they go. Each emitter has a set of parameters that can be adjusted to change the behaviour and rendering of the particles. Particle life span o Particle color / texture o Forces acting upon the particles o

How Particle Systems Work (cont. ) • Animation is done in two stages: Simulation

How Particle Systems Work (cont. ) • Animation is done in two stages: Simulation Stage § Here, new particles that need to be created are calculated based on spawn rates, time intervals, etc. § Existing particles have their positions updated or are removed if the end of their life span has been reached. o Rendering Stage § Here, each particle is rendered according to the calculations done in the previous stage. o

Particle Systems Next Time • • Look at some algorithms used in particle systems

Particle Systems Next Time • • Look at some algorithms used in particle systems Show a few demos

Physics in Development Applications -Dan

Physics in Development Applications -Dan

Unity Primarily uses Phys. X, engine developed by Nvidia. Effects include: • Cloth: •

Unity Primarily uses Phys. X, engine developed by Nvidia. Effects include: • Cloth: • Interactive • Skinned

Unity • Soft Bodies Deformable objects, distances between vertices are not fixed. Limited documentation.

Unity • Soft Bodies Deformable objects, distances between vertices are not fixed. Limited documentation. • • Rigid Bodies • Objects can receive force, torque, gravity, etc. • Main way to apply collisions Supports special colliders such as the “Wheel Collider” •

Unity

Unity

Blender

Blender

Blender • Bullet Physics: Directly integrated into Blender. Allows for rigid body simulations. •

Blender • Bullet Physics: Directly integrated into Blender. Allows for rigid body simulations. • Scripts usually controlled through Python • Simulations are typically baked •

Blender • Phymec: • • • Built off of Bullet engine. UI tools for

Blender • Phymec: • • • Built off of Bullet engine. UI tools for Blender still in development. Example of Voronoi Shattering

XNA • Jelly. Physics by Walaber 2 D soft-bodied physics system. • Follows collision

XNA • Jelly. Physics by Walaber 2 D soft-bodied physics system. • Follows collision of vertices, changes between concave and convex forms. • Jello. Car! •

Next Week • How 3 rd party engines such as Farseer Physics can work

Next Week • How 3 rd party engines such as Farseer Physics can work in Unity and XNA • Go through brief demo of KEVA engine in Blender

How Physics Engines Work Simulate Physics Calculations Position, velocity, acceleration, rotation, etc. Real-Time Computed

How Physics Engines Work Simulate Physics Calculations Position, velocity, acceleration, rotation, etc. Real-Time Computed every frame in real time Used in games Low precision, only computes what is necessary High-Precision Not real time Typically used by scientists, animators

Optimizing Physics for Games Rigid Body Dynamics Faster, easier to calculate Brownian Motion Objects

Optimizing Physics for Games Rigid Body Dynamics Faster, easier to calculate Brownian Motion Objects outside of scope or at rest on a surface are put to sleep

Collision Detection/Response System Detect collisions and send trigger to system Volumetric Tessellation Simplify 3

Collision Detection/Response System Detect collisions and send trigger to system Volumetric Tessellation Simplify 3 D meshes by surrounding them with more simple tessellated meshes

Collision Detection Works by detecting the moment two or more bodies collide and then

Collision Detection Works by detecting the moment two or more bodies collide and then applies the correct respective forces

Discrete Collision Detection Predicts the trajectory of the body after the actual collision when

Discrete Collision Detection Predicts the trajectory of the body after the actual collision when meshes are intertwined Causes problems in “fixing step”, bodies may pass through another Continuous Collision Detection Predicts the trajectory of the body before the actual collision

Bounding Box Approximation An enlarged box surrounding current and last position When these boxes

Bounding Box Approximation An enlarged box surrounding current and last position When these boxes collide, the engine will have an approximation for a collision Cheaper than mesh collision

Where are Physics engines headed now? The main limiting factor is the precision and

Where are Physics engines headed now? The main limiting factor is the precision and complexity of calculations Faster computer and graphics processors allow games to push the engines further and do more complex simulations Balance precision of calculations with a “perceptually correct” approximation

New Physics Effects Soft Body Dynamics Complex Particle Effects Realistic Fluid Dynamics Real Time

New Physics Effects Soft Body Dynamics Complex Particle Effects Realistic Fluid Dynamics Real Time Fracturing http: //www. youtube. com/watch? v=h 5 m. RREl. Xy-w