Lecture 011

Physics Application

Character Controller

Kinematic Actor: usually player

Capsule Collider

Capsule Collider

Different from other physics, we want the player to slide along the wall as it walks at an angle towards the wall.

Sliding along the wall

Sliding along the wall

We also want the players to be able to move up stairs:

  1. every frame when player walk, tries to increase player y (maybe decrease player height to prevent player cannot walk into a door because the player is too tall)
  2. do physics simulation

Walking on stairs

Walking on stairs

We also want the player to move up slopes, but slide down for steep slopes.

When walking on slopes, a real human's walking behavior is drastically different from normal walking. The animation system should take care of that.

Character Volume Update

Character Volume Update

Sometimes we need to resize character capsule. We need to do a overlap test before update to avoid insertion inside objects.

For moving platform, we can't use physics engine. We need to do a ray cast to detect which platform the character is standing on.

Not just for character, potentially every moving objects. Objects in elevator will look shaky because there is always a 1-frame difference for object to fall down and push up by elevators.

Ragdoll

Ragdoll: use physics simulation at the end of animation. (usually when character dies)

Joints for Ragdoll

Joints for Ragdoll

A character might have more joints than we need for physics simulation. We only pick about 10 joints for ragdoll. Since physics simulation is done on about 10 joints, we need to calculate the rest of joint positions for animation to play. (Animation Re-targeting)

Animation Re-targeting in Ragdoll

Animation Re-targeting in Ragdoll

Active Joints: position provided by physics simulation.

Leaf Joints: endpoint, controlled solely by animation

Intermediate Joints: calculate and interpolated by animation re-targeting.

Lifetime of Ragdoll

Lifetime of Ragdoll

Ragdoll need to satisfy joint's constraints (since human joints do not have al degrees of freedom) in order to provide satisfying animation.

Joint's constraints vs no constraints

Joint's constraints vs no constraints

Ragdoll can interleave with animation, providing more realistic looking transitions. (e.g. when a conscious human hang on a dynamic object)

Blending in Ragdoll

Blending in Ragdoll

Cloth Simulation

Old Methods

Traditional: animated bone

Rigid Body-based Cloth Simulation: bones of cloth are bounded with rigid bodies and constraints solved by physics engine

Mesh-Based

Mesh-based Approach

Mesh-based Approach

We separate render mesh with physical mesh for reducing computation complexity.

Render Mesh vs. Physical Mesh

Render Mesh vs. Physical Mesh

We set different amount of constaints for each vertex: to prevent penetration to attached body (human characters)

Different weights on constraints

Different weights on constraints

To simulate cloth, we use spring force and dampling on vertices

Springs in a Cloth

Springs in a Cloth

\vec{F}_{\text{net}}^{vertex}(t) = M\vec{g}_{\text{gravity}} + \vec{F}_{\text{wind}} + \vec{F}_{\text{air resistance}}(t) + \sum_{\text{springs } \in v} \left( k_{\text{spring}} \Delta\vec{x}(t) - k_{\text{dampling}}\vec{v}(t) \right) = M\vec{a}(t)

In cloth simulation, Verlet integration provides more stability and better computational complexity than Euler's Semi-implicit.

Verlet Integration

Verlet Integration

Position-based Dynamics

Position-based Dynamics

Position-based Dynamics

Position-based Dynamics is now commonly used.

Self Collision

Self-collision: when cloth collide with itself or other cloths

Self-collision Methods (1)

Self-collision Methods (1)

Self-collision Methods (2)

Self-collision Methods (2)

Destruction

Creating Hierarchy Tree

Creating Hierarchy Tree

Creating Connectivity Graph

Creating Connectivity Graph

When a projectile hit a surface

  1. we create chunk hierarchy assigned by the artist (or automatically generated during compilation by Voronoi Diagram)
  2. we use the assigned "hardness" between connectivity graph
  3. if damage (calculated below) is higher than a threshold, break the connection
  4. generate new triangle mesh by Delaunay Triangulation with new texture and texture coordinate
  5. generate new rigid body for collision

For texture coordinate, we can:

Usually the new rigid body does not collide with other rigid bodies other than the children of original body. This is because for consistency issue, physics simulation might diverge. (e.g. you can't shoot down a wall to hit a player)

\text{Damage } = \frac{\text{Impulse by Collision}}{\text{Material Hardness}}

Damage Distribution

Damage Distribution

The current solution is not at all physics based

Common Breaking Patterns:

Uniform Random Pattern

Uniform Random Pattern

Clustered Pattern

Clustered Pattern

Radial Pattern

Radial Pattern

The entire pipeline

The entire pipeline

Besides the pipeline, we need to add many callback function for realistic side effects

Destruction can consume 10x to 100x computational power than we currently have.

Popular Destruction Implementation

Blast

Blast

Vehicle Physics

// TODO

Table of Content