Game Physics - PowerPoint PPT Presentation

About This Presentation
Title:

Game Physics

Description:

Game Physics * Traditional game physics Particle system Rigid body dynamics Flexible body dynamics Some state-of-art topics Car physics Fluid dynamics Rag-doll ... – PowerPoint PPT presentation

Number of Views:536
Avg rating:3.0/5.0
Slides: 33
Provided by: edut1358
Category:

less

Transcript and Presenter's Notes

Title: Game Physics


1
Game Physics
2
Introduction to Game Physics
  • Traditional game physics
  • Particle system
  • Rigid body dynamics
  • Flexible body dynamics
  • Some state-of-art topics
  • Car physics
  • Fluid dynamics
  • Rag-doll physics
  • Physics
  • Rigid body kinematics
  • Newtons Laws
  • Forces
  • Momenta
  • Energy

3
Basic Concepts from Physics (1/2)
  • Newtons Laws
  • 1st Law
  • ????,?????????
  • 2nd Law
  • F ma mdv/dt
  • 3rd Law
  • ????????
  • Forces
  • Gravity / Spring forces / Friction / Viscosity
  • Torque
  • ? r X F
  • Equilibrium

4
Basic Concepts from Physics (2/2)
  • Momenta
  • Linear momentum
  • Angular momentum
  • Moment of inertia

5
Particle Dynamics
  • Particles are objects with
  • Mass
  • Position
  • Velocity
  • Respond to forces
  • But no spatial extent (no size!)
  • Point mass
  • Based on Newton Laws
  • f ma
  • x f / m
  • v f / m, x v

..
.
.
6
Basic Particle System
typedef struct float m / mass /
float x / position / float v /
velocity / float f / force accumulator
/ Particle typedef struct Particle p
/ array of pointers to particles / int n
/ number of particles / float t /
simulation clock / ParticleSystem
states
Particle n time

7
/ gather states from the particles / void
ParticleGetState(ParticleSystem p, float dst)
int i for (i 0 i lt p-gtn i)
(dst) p-gtpI-gtx0 (dst)
p-gtpI-gtx1 (dst) p-gtpI-gtx2
(dst) p-gtpI-gtv0 (dst)
p-gtpI-gtv1 (dst) p-gtpI-gtv2

8
/ scatter states into the particles / void
ParticleSetState(ParticleSystem p, float src)
int i for (i 0 i lt p-gtn i)
p-gtpi-gtx0 (src) p-gtpi-gtx1
(src) p-gtpi-gtx2 (src)
p-gtpi-gtv0 (src) p-gtpi-gtv1
(src) p-gtpi-gtv2 (src)
9
/ calculate derivative, place in dst / void
ParticleDerivative(ParticleSystem p, float
dst) int i ClearForce(p)
ComputeForce(p) for (i 0 i lt p-gtn i)
(dst) p-gtpi-gtv0 (dst)
p-gtpi-gtv1 (dst) p-gtpi-gtv2
(dst) p-gtpi-gtf0/p-gtpi-gtm
(dst) p-gtpi-gtf1/p-gtpi-gtm
(dst) p-gtpi-gtf2/p-gtpi-gtm
10
/ Euler Solver / void EulerStep(ParticleSystem
p, float DeltaT) ParticleDeriv(p, temp1)
ScaleVector(temp1, DeltaT) ParticleGetState(p,
temp2) AddVector(temp1, temp2, temp2)
ParticleSetState(p, temp2) p-gtt DeltaT
11
Rigid Body Dynamics
  • Mass of a Body
  • Mass center
  • Force
  • Linear momentum
  • P(t) M v(t)
  • Velocity (v)
  • Torque
  • Angular momentum
  • L(t) I w(t)
  • Local rotation (w)
  • Inertia Tensor
  • Reference
  • www-2.cs.cmu.edu/afs/cs/user/baraff/www/pbm

12
Flexible Body Dynamics (1/2)
  • Spring-mass model
  • F k x
  • Not a stress-strain model
  • Lack of Elasticity, Plasticity,
    Viscous-Elasticity
  • Can be unstable

13
Flexible Body Dynamics (2/2)
  • Finite element method
  • (?????)
  • Solver for ODE/PDE
  • Boundary conditions
  • Energy equation
  • Stress-strain model
  • Very complicated computing process
  • Conservation of energy

14
Advanced Topics in Game Physics
  • Fracture Mechanics (??????)
  • Fluid Dynamics (????)
  • Car Dynamics (?????)
  • Rag-doll Physics (??????)

15
Game FX
16
Introduction to Game FX
  • Improve the Visual Sound Game Effects
  • Includes
  • Combat FX
  • Environment FX
  • Character FX
  • Scene FX
  • Sound FX
  • FX Editor Needed
  • General 3D animation tools can not do it
  • Key-frame system is not working
  • FX animation is always
  • Procedurally
  • Related to the previous frame
  • Small Work But Large Effect

17
FX Editing Tool
18
Game Particle Effects
Conquer Online
19
Combat FX
  • During the Combat
  • Weapon motion blur
  • Weapon effect
  • Skill effect
  • After the Combat
  • Damage effect
  • FX Editor

20
Combat FX Example
20
21
Motion Blur Image Solution
  • Computer Animation
  • Image solution
  • Blending rendered image sequence
  • Render too many frames
  • Divide the frames
  • Average
  • Done!

22
Motion Blur Geometry Solution
  • In Games, Use Transparent Objects to Simulate the
    Motion Blur
  • False Motion Blur
  • Tracking the motion path of the object
  • Connecting them as a triangular mesh
  • Use time-dependent semi-transparency to simulate
    the blur
  • The path can be smoothed using Catmull-Rom spline
  • Local stability of the curve

23
FX Uses Texture Animation
  • Almost All Game FXs Use this Trick
  • Geometry Object on which the Texture Animation
    Playing
  • Billboard
  • 3D Plate
  • Cylinder
  • Sphere
  • Revolving a cross section curve
  • Texture Sequence with Color-key
  • Semi-transparent Textures
  • Alpha blending
  • Source color added to background
  • Demo!!!!

24
Particle System for FXs in Combat
  • The FXs
  • Fire / exposure / smoke / dust
  • Initial Value Time dependency
  • Combined with Billboard FX
  • Billboard to play the texture animation
  • Particle system to calculate the motion path
  • Gravity is the major force used
  • Emitter pattern
  • Single emitter
  • Area emitter
  • Emitter on vertices
  • Demo !!!

25
Environment FX
  • Weather
  • Use particle system
  • Rain
  • Snow
  • Wind
  • Fog
  • Traditional fog
  • From near to far
  • Hardware standard feature
  • Volume fog
  • Layered fog
  • Use vertex shader
  • Day Night

26
Character FX
  • Fatality
  • Case by case and need creative solutions
  • Rendering Effects on Skins
  • Environment mapping
  • Bump map
  • Normal map
  • Multiple texture map
  • Flexible body
  • Flexible body dynamics
  • Fur
  • Real-time fur rendering

27
Scene FX Sky Box
  • Use a very large box or dome-like model to
    surround the whole game scene
  • Use textures on the box or dome as the backdrop
  • Use multiple textures and texture coordinates
    animation to simulate the moving of the clouds

28
Scene FX Lens Flare
  • Runtime calculate the position and orientation of
    the camera with the sun
  • Put textures to simulate the lens flare

29
Scene FX Light Scattering
  • Atmospheric light scattering
  • Caused by dust, molecules, or water vapor
  • These can cause light to be
  • Scattered into the line of sight (in-scattering)
  • Scattered out of the line of sight
    (out-scattering)
  • Absorbed altogether (absorption)
  • Skylight and sun light
  • Can be Implemented by vertex shader

30
Scene FX Light Scattering Examples
With scattering
Without scattering
31
OGRE Particle System
OGRE Particle System Attributes http//www.ogre3d.
org/docs/manual/manual_32.html OGRE Particle
Editor http//www.game-cat.com/ogre/pe/ParticleEdi
tor_Beta.zip OGRE Particle Editor
Tutorial http//www.game-cat.com/ogre/pe/docs/PETu
torial.htm
32
Particle System Definition Attributes (Partial)
Attribute Name Value Format Description
quota ltmax_particlesgt Maximum number of particles at one time in the system (default 10).
material ltnamegt Name of material used by all particles in the system (default none).
particle_width ltwidthgt Width of particles in world coordinates (default 100).
particle_height ltheightgt Height of particles in world coordinates (default 100).
cull_each lttruegt ltfalsegt Cull particles individually (default false).
sorted lttruegt ltfalsegt Sort particles by depth from camera (default false).
billboard_type ltpointgt ltoriented_commongt ltoriented_selfgt Billboard-renderer-specific attribute (default point).
Write a Comment
User Comments (0)
About PowerShow.com