Particle Systems - PowerPoint PPT Presentation

1 / 51
About This Presentation
Title:

Particle Systems

Description:

Fireworks, explosions. Fluid flow. Physical simulations ... One area where the forward Euler method fails is when one has very tight springs ... – PowerPoint PPT presentation

Number of Views:61
Avg rating:3.0/5.0
Slides: 52
Provided by: abdennour8
Category:

less

Transcript and Presenter's Notes

Title: Particle Systems


1
Particle Systems
Lecture 8
  • Abdennour El Rhalibi

2
Particle Systems
  • Particle systems have been used extensively in
    computer animation and special effects since
    their introduction to the industry in the early
    1980s
  • The rules governing the behavior of an individual
    particle can be relatively simple, and the
    complexity comes from having lots of particles
  • Usually, particles will follow some combination
    of physical and non-physical rules, depending on
    the exact situation

3
Whats a Particle System?
  • A collection of many small particles that
    together represent a fuzzy object
  • Use points to define shapes rather than polygons

Star Trek II The Wrath of Khan
4
Some fuzzy objects
  • Grass, Smoke, fire, clouds, water
  • Fireworks, explosions
  • Fluid flow
  • Physical simulations
  • Flocking - Bird migration, schools of fish, riots

5
20,000 particles in a galaxy-forming gravitation
simulation
6
Physics
7
Kinematics of Particles
  • We will define an individual particles 3D
    position over time as r(t)
  • By definition, the velocity is the first
    derivative of position, and acceleration is the
    second
  • To render a particle, we need to know its
    position r.

8
Uniform Acceleration
  • How does a particle move when subjected to a
    constant acceleration?

9
Uniform Acceleration
  • This shows us that the particles motion will
    follow a parabola
  • Keep in mind, that this is a 3D vector equation,
    and that there is potentially a parabolic
    equation in each dimension. Together, they form a
    2D parabola oriented in 3D space
  • We also see that we need two additional vectors
    r0 and v0 in order to fully specify the equation.
    These represent the initial position and velocity
    at time t0

10
Mass and Momentum
  • We can associate a mass m with each particle. We
    will assume that the mass is constant
  • We will also define a vector quantity called
    momentum (p), which is the product of mass and
    velocity

11
Newtons First Law
  • Newtons First Law states that a body in motion
    will remain in motion and a body at rest will
    remain at rest- unless acted upon by some force
  • This implies that a free particle moving out in
    space will just travel in a straight line

12
Force
  • Force is defined as the rate of change of
    momentum
  • We can expand this out

13
Newtons Second Law
  • Newtons Second Law says
  • This relates the kinematic quantity of
    acceleration to the physical quantity of force

14
Newtons Third Law
  • Newtons Third Law says that any force that body
    A applies to body B will be met by an equal and
    opposite force from B to A
  • Put another way every action has an equal and
    opposite reaction
  • This is very important when combined with the
    second law, as the two together imply the
    conservation of momentum

15
Conservation of Momentum
  • Any gain of momentum by a particle must be met by
    an equal and opposite loss of momentum by another
    particle. Therefore, the total momentum in a
    closed system will remain constant
  • We will not always explicitly obey this law, but
    we will implicitly obey it
  • In other words, we may occasionally apply forces
    without strictly applying an equal and opposite
    force to anything.

16
Energy
  • The quantity of energy is very important
    throughout physics, and the motion of particle
    can also be formulated in terms of energy
  • Energy is another important quantity that is
    conserved in real physical interactions
  • However, we will mostly use the simple Newtonian
    formulations using momentum

17
Forces on a Particle
  • Usually, a particle will be subjected to several
    simultaneous vector forces from different sources
  • All of these forces simply add up to a single
    total force acting on the particle

18
Particle Simulation
  • Basic kinematics allows us to relate a particles
    acceleration to its resulting motion
  • Newtons laws allow us to relate acceleration to
    force, which is important because force is
    conserved in a system and makes a useful quantity
    for describing interactions
  • This gives us a general scheme for simulating
    particles (and more complex things)

19
Particle Simulation
  • 1. Compute all forces acting within the system
    (making sure to obey Newtons third law)
  • 2. Compute the resulting acceleration for each
    particle (af/m) and integrate to get positions
  • - Repeat
  • This describes the standard Newtonian approach
    to simulation. It can be extended to rigid
    bodies, deformable bodies, fluids, vehicles, and
    more

20
Particle Example
  • class Particle
  • float Mass // Constant
  • Vector3 Position // Evolves frame to frame
  • Vector3 Velocity // Evolves frame to frame
  • Vector3 Force // Reset and re-computed each
    frame
  • public
  • void Update()
  • void Draw()
  • void ApplyForce(Vector3 f) Force.Add(f)

21
Particle Example
  • class ParticleSystem
  • int NumParticles
  • Particle P
  • public
  • void Update()
  • void Draw()

22
Particle Example
  • ParticleSystemUpdate(float time)
  • // Compute forces
  • Vector3 gravity(0,-9.8,0)
  • for(i0iltNumParticlesi)
  • Vector3 forcegravityParticlei.Mass // fmg
  • Particlei.ApplyForce(force)
  • // Integrate
  • for(i0iltNumParticlesi)
  • Particlei.Update(time)

23
Particle Example
  • ParticleUpdate(float time)
  • // Compute acceleration (Newtons second law)
  • Vector3 Accel(1.0/Mass) Force
  • // Compute new position velocity
  • VelocityAcceltime
  • PositionVelocitytime
  • // Zero out Force vector
  • Force.Zero()

24
Particle Example
  • With this particle system, each particle keeps
    track of the total force being applied to it
  • This value can accumulate from various sources,
    both internal and external to the particle system
  • The example just used a simple gravity force, but
    it could easily be extended to have all kinds of
    other possible forces
  • The integration scheme used is called forward
    Euler integration and is about the simplest
    method possible

25
Integration
26
Integration
  • Computing positions and velocities from
    accelerations is just integration
  • If the accelerations are defined by very simple
    equations (like the uniform acceleration), then
    we can compute an analytical integral and
    evaluate the exact position at any value of t
  • In practice, the forces will be complex and
    impossible to integrate analytically, which is
    why we automatically resort to a numerical scheme
    in practice
  • The ParticleUpdate() function described earlier
    computes one iteration of the numerical
    integration. In particular, it uses the forward
    Euler scheme

27
Forward Euler Integration
  • Forward Euler integration is about the simplest
    possible way to do numerical integration
  • It works by treating the linear slope of the
    derivative at a particular value as an
    approximation to the function at some nearby
    value
  • The algorithm we discussed for the roller-coaster
    used Euler integration

28
Forward Euler Integration
  • For particles, we are actually integrating twice
    to get the position
  • which expands to

29
Forward Euler Integration
  • Note that this
  • is very similar to the result we would get if we
    just assumed that the particle is under a uniform
    acceleration for the duration of one frame

30
Forward Euler Integration
  • Actually, it will work either way
  • Both methods make assumptions about what happens
    in the finite time step between two instants, and
    both are just numerical approximations to reality
  • As ?t approaches 0, the two methods become
    equivalent
  • At finite ?t, however, they may have significant
    differences in their behavior, particularly in
    terms of accuracy over time and energy
    conservation
  • As a rule, the forward Euler method works better
  • In fact, there are lots of other ways we could
    approximate the integration to improve accuracy,
    stability, and efficiency

31
Forward Euler Integration
  • The forward Euler method is very simple to
    implement and if it provides adequate results,
    then it can be very useful
  • It will be good enough for lots of particle
    systems used in computer animation, but its
    accuracy is not really good enough for
    engineering applications
  • It may also behave very poorly in situations
    where forces change rapidly, as the linear
    approximation to the acceleration is no longer
    valid in those circumstances

32
Forward Euler Integration
  • One area where the forward Euler method fails is
    when one has very tight springs
  • A small motion will result in a large force
  • Attempting to integrate this using large time
    steps may result in the system diverging (or
    blowing up)
  • Therefore, we must use lots of smaller time steps
    in order for our linear approximation to be
    accurate enough
  • This resorting to many small time steps is where
    the computationally simple Euler integration can
    actually be slower than a more complex
    integration scheme that costs more per iteration
    but requires fewer iterations
  • We will look at more sophisticated integration
    schemes in future lectures

33
Modeling and Animation
  • Lecture 8

34
Physics Based Animation in 3DS Max
  • Simulation User specifies objects, forces and
    processes to govern object and/or particle
    motion.
  • Dynamic Space Warp Mechanism for specifying
    forces or constraints on motion of objects and/or
    particles.
  • Path Follow, (PUS)dynaflect, (PUS)omniflect,
    (SU)deflector.
  • Gravity, Wind, Push, Motor, Field, Pbomb, etc.
  • Particle System Process that generates a
    collection of particles, with specified,
    randomized motion, over a region of space and a
    period of time
  • (Super) Spray, Snow, Blizzard, PCloud, PArray.

35
Example Max Files
  • Dynamics
  • A sphere falls under the influence of gravity and
    bounces off the floor bouncing-sphere.max
  • One block falls and bounces while dangling from a
    damped spring attached to another block
    boxes-and-spring.max
  • Particle Systems
  • A stream of particles is emitted at a point and
    follows a spline path smoke-stack.max
  • A stream of particles is emitted at a point, is
    blown by the wind, bounces off a wall and falls
    under the influence of gravity fountain.max

36
Bouncing Sphere
  • Create a small sphere in the ground plane.
  • Go into Front View and pan vertically so you have
    room to watch the object fall downward.
  • On the Command Panel, use Create, Space Warps,
    Particles and Dynamics to create a Gravity space
    warp in Top View.
  • Check Front View to see that the arrow indicates
    a downward direction for gravity.

37
(No Transcript)
38
Creating the Simulation
  • Got to the Utilities tab on the Command Panel and
    click on Dynamics.
  • Press New to create a new simulation, called
    Dynamics00.
  • Press Edit Object List, select Sphere01 and use
    the gt button to include it in the simulation.
    Press OK to confirm.
  • Press Edit Object and Assign Object Effects
    and use the gt button to include Gravity01 as an
    effect acting on Sphere01.

39
Solve the Simulation
  • Go to the Dynamics rollout on the Command Panel.
  • Check the Update Display w/ Solve box.
  • Press the Solve button The sphere accelerates
    downward, falling off the bottom of the window.
  • Open Track View and look a the spheres Position
    track function curves.
  • Notice that the curve is a parabola, described by
    lots of keys.
  • Press Edit Time use the mouse to select the time
    range 0,100 and press Reduce Keys to reduce
    the number of keys.
  • You may now edit this track as you wish.

40
(No Transcript)
41
Adding Collisions
  • Create a Box of size (W,L,H)(100,100,1) and
    location (x,y,z)(0,0,-100).
  • Use Edit Object List on the Dynamics rollout on
    the Command Panel, to include Box01 in the
    Dynamics00 simulation.
  • Press Edit Object, select Sphere01, press Assign
    Object Collisions and add Box01 to the
    collisions set for the sphere.
  • Press Edit Object, select Box01 and check the box
    marked This object is unyielding under Dynamic
    Controls to make sure the box wont move.
  • Press the Solve button and observe that the ball
    bounces.
  • Go to track view to observe the function curves
    and reduce the number of keys, as before.

42
(No Transcript)
43
Specification of Particle Systems
  • Region of space over which particles are emitted.
  • Period of time over which particles are emitted.
  • Initial linear and rotational velocities of
    particles.
  • Forces and/or process governing particles
    motion.
  • Shape and material properties of particles.
  • Lifetimes of particles.
  • Probability distributions to specify randomness
    in any or all of the above.

44
Fountain
  • Use Create, Particle-Systems to create a Super
    Spray particle emitter in Perspective View at the
    center of the ground plane.
  • Pull the Time Slide and see the particles that
    are emitted. Notice that no particles are emitted
    after the 30th frame.
  • Use the Particle Generation rollout to arrange
    that particles are generated at a rage of 100 per
    second, over 100 frames and have a lifetime of
    100 frames.
  • Increase the two Spread parameters in the Basic
    Parameters rollout to 45 degrees and 180.
  • Pull the Time Slider again and observe the
    particle stream.

45
(No Transcript)
46
Adding Wind
  • Use Create, Space Warps, and Particles Dynamics
    on the Command Menu to create a Wind space warp
    in Left View.
  • Use Bind Space Warp on the Main Toolbar to bind
    the Wind space warp to SuperSpray01.
  • Notice that the particles are blown by the wind.

47
(No Transcript)
48
Adding Gravity
  • Use Create, Space Warps, and Particles Dynamics
    on the Command Menu to create a Gravity space
    warp in Left View.
  • Set the Strength parameter of Gravity to 0.5
    units.
  • Use Bind Space Warp on the Main Toolbar to bind
    the Gravity space warp to SuperSpray01.
  • Notice that the particles are drawn downward by
    the Gravity.

49
(No Transcript)
50
Adding a Deflector
  • Use Create, Space Warps, and Particles Only on
    the Command Menu to create a POmniFlect space
    warp in Left View.
  • Use Bind Space Warp on the Main Toolbar to bind
    the POmniFlect space warp to SuperSpray01.
  • Rotate the POmniFlect space warp around the Y
    axis to deflect the particles upward.

51
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com