particles paul taylor 2009. polygons are not so hot! good for representing objects like a cup a...

30
Particles Paul Taylor 2009

Upload: janel-phelps

Post on 13-Dec-2015

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Particles Paul Taylor 2009. Polygons are not so hot! Good for representing objects like A Cup A Robot A Pyramid Not so hot for creating Hair Snowflakes

Particles

Paul Taylor 2009

Page 2: Particles Paul Taylor 2009. Polygons are not so hot! Good for representing objects like A Cup A Robot A Pyramid Not so hot for creating Hair Snowflakes

Polygons are not so hot!Good for representing objects like

A CupA RobotA Pyramid

Not so hot for creatingHairSnowflakesRainSparksCloudsLightningSteam

Page 3: Particles Paul Taylor 2009. Polygons are not so hot! Good for representing objects like A Cup A Robot A Pyramid Not so hot for creating Hair Snowflakes

Procedural Methods

• This is a big Umbrella for creating objects based on procedures (algorithms)

• With these models Polygons are rendered only as necessary– Necessary is defined as:• The Polygon will be visible to the screen &• The polygon will be more than 1 pixel in size

Page 4: Particles Paul Taylor 2009. Polygons are not so hot! Good for representing objects like A Cup A Robot A Pyramid Not so hot for creating Hair Snowflakes

Why Use Procedural Methods

• Limitations on Polygon Rendering are not the only reason– Speed (sometimes)– Realism (a lot of the time)– Special Effects– Physics Systems

Page 5: Particles Paul Taylor 2009. Polygons are not so hot! Good for representing objects like A Cup A Robot A Pyramid Not so hot for creating Hair Snowflakes

4 Procedural Methods

• Particle Systems• Language Based Models• Fractal Geometry• Procedural Noise

Page 6: Particles Paul Taylor 2009. Polygons are not so hot! Good for representing objects like A Cup A Robot A Pyramid Not so hot for creating Hair Snowflakes

Particle Systems

• http://2ld.de/gh2004/images/PSCollisions.jpg• http://ccl.northwestern.edu/netlogo/models/models/Sample%20Models/Computer

%20Science/Particle%20Systems/Particle%20System%20Basic.png

Page 7: Particles Paul Taylor 2009. Polygons are not so hot! Good for representing objects like A Cup A Robot A Pyramid Not so hot for creating Hair Snowflakes

Language Based Models

Page 8: Particles Paul Taylor 2009. Polygons are not so hot! Good for representing objects like A Cup A Robot A Pyramid Not so hot for creating Hair Snowflakes

Fractal Geometry

• http://neatorama.cachefly.net/images/2008-01/fractal-art-alfred-laing-spiral-fantasy.jpg

Page 9: Particles Paul Taylor 2009. Polygons are not so hot! Good for representing objects like A Cup A Robot A Pyramid Not so hot for creating Hair Snowflakes

Particle Systems In Detail

• http://www.cinema.com/image_lib/4319_heading.jpg

Page 10: Particles Paul Taylor 2009. Polygons are not so hot! Good for representing objects like A Cup A Robot A Pyramid Not so hot for creating Hair Snowflakes

Particle Systems

• Particles can be used to represent many objects that are difficult or near impossible to create utilising polygons

Page 11: Particles Paul Taylor 2009. Polygons are not so hot! Good for representing objects like A Cup A Robot A Pyramid Not so hot for creating Hair Snowflakes

This is particle #1

• Particles are generally considered to be a point mass– All the mass of particle #1 is located at its infinite

centre.

Page 12: Particles Paul Taylor 2009. Polygons are not so hot! Good for representing objects like A Cup A Robot A Pyramid Not so hot for creating Hair Snowflakes

Visually a Particle can be anything

• A Particle can be just about anything– A Vertex in a Mesh– A Texture– A Billboarded Texture– A Polygon– An Entire Mesh

Page 13: Particles Paul Taylor 2009. Polygons are not so hot! Good for representing objects like A Cup A Robot A Pyramid Not so hot for creating Hair Snowflakes

Independent Particles

• Independent Particles are the simplest form– Each particle receives input only from the ‘world’

Great for:• Clouds• Wind• Sparks• Water Spray

Page 15: Particles Paul Taylor 2009. Polygons are not so hot! Good for representing objects like A Cup A Robot A Pyramid Not so hot for creating Hair Snowflakes

Newtonian Particles

– These guys are not anything really specialised– The only requirement is that they respect Newtons

laws of physics1) Velocity will remain constant when there is no net

force2) The net force is equal to the objects mass multiplied

by its acceleration3) The force A exerts on B is equal and opposite to the

force B exerts on A*For Independent Particles we can Ignore the 3rd rule

Page 16: Particles Paul Taylor 2009. Polygons are not so hot! Good for representing objects like A Cup A Robot A Pyramid Not so hot for creating Hair Snowflakes

F = m * a

• Force = mass x acceleration

Page 17: Particles Paul Taylor 2009. Polygons are not so hot! Good for representing objects like A Cup A Robot A Pyramid Not so hot for creating Hair Snowflakes

Position, Velocity and Acceleration

• The Derivative (Gradient) of Position is Velocity

• The Derivative (Gradient) of Velocity is Acceleration

All three components can be defined using just position, time and current velocity

* You could do away with velocity and use just Position and Time but then we would need to store previous position and previous timestep to calculate the new position.

Page 18: Particles Paul Taylor 2009. Polygons are not so hot! Good for representing objects like A Cup A Robot A Pyramid Not so hot for creating Hair Snowflakes

Given a Point Mass

• We only need Position, and Velocity to define a Newtonian Particle

Position {x, y, z}Velocity {Vx, Vy, Vz}• To calculate the motion of the Particle we

need one more value, Time• deltaTime (Change in time)

Page 19: Particles Paul Taylor 2009. Polygons are not so hot! Good for representing objects like A Cup A Robot A Pyramid Not so hot for creating Hair Snowflakes

Calculating Movement

• On an Independent Particle System of Q Particles– For each of Q Particles• Compute the Forces Applied to the Particle• Given mass doesn’t change generate the new velocity

vector using currentPosition, currentVelocity, and force• Display the particle

• This gives an algorithmic complexity of 1(Q)

Page 20: Particles Paul Taylor 2009. Polygons are not so hot! Good for representing objects like A Cup A Robot A Pyramid Not so hot for creating Hair Snowflakes

In Practice

• Particle at Pos 0,0,0 with velocity 1,0,0• We shall use a force vector of gravity (0,-

9.8m/s/s,0)• V = Vi + acceleration(deltaTime)• V = {0,0,0} + {0,-9.8,0} (deltaTime)• So for a 1 second timestep

V = {1,0,0} + {0,-9.8,0} (1)1st step: V = {1,-9.8,0}2nd step: V = {1,-19.6, 0}

Page 21: Particles Paul Taylor 2009. Polygons are not so hot! Good for representing objects like A Cup A Robot A Pyramid Not so hot for creating Hair Snowflakes

Adding Frictional Forces

• Adding a term that is proportional to velocity will simulate friction on the particles (such as air and water)

Page 23: Particles Paul Taylor 2009. Polygons are not so hot! Good for representing objects like A Cup A Robot A Pyramid Not so hot for creating Hair Snowflakes

Particle Emitters

• Typically of high importance in video games• Used to efficiently generate many of the

effects• Generate Newtonian Particles with an applied

randomness

Page 24: Particles Paul Taylor 2009. Polygons are not so hot! Good for representing objects like A Cup A Robot A Pyramid Not so hot for creating Hair Snowflakes

Dependant Particles

• Dependent Particles are connected together by a mesh, as strings or a even a theoretical meshGreat for:- Water- Fluids- Deformable Objects- Reactive Surfaces- Hair- Fur

Page 25: Particles Paul Taylor 2009. Polygons are not so hot! Good for representing objects like A Cup A Robot A Pyramid Not so hot for creating Hair Snowflakes

Particle Meshes

• In the most complex form each particle may receive input from every other particle in the mesh (A complexity of N2)

• More typically we will only allow input from each of the adjacent particles in the mesh, requiring only 4N calculations.

Page 26: Particles Paul Taylor 2009. Polygons are not so hot! Good for representing objects like A Cup A Robot A Pyramid Not so hot for creating Hair Snowflakes

Forces on Particle Meshes

• There are many ways to calculate the forces between particles in a Mesh or String

• One of the most common is utilising Spring Forces

• When created a spring has a lenght, springConstant, and a dampeningTerm (drag)

Page 27: Particles Paul Taylor 2009. Polygons are not so hot! Good for representing objects like A Cup A Robot A Pyramid Not so hot for creating Hair Snowflakes

Spring Equations

• The Basic Spring from a to bF = -springConstant * distanceStretched

• With DampeningF = -springConstant * distanceStretched * dampeningTerm

Page 28: Particles Paul Taylor 2009. Polygons are not so hot! Good for representing objects like A Cup A Robot A Pyramid Not so hot for creating Hair Snowflakes

Attractive and Repulsive Particles

• Spring Forces are used to keep particles together

• Repulsive and Attractive Forces can be used to make Objects interact– Functions such as gravity, and inverse-square-law

are typical• Computational Complexity again goes out to

N2

Page 29: Particles Paul Taylor 2009. Polygons are not so hot! Good for representing objects like A Cup A Robot A Pyramid Not so hot for creating Hair Snowflakes

Force Fields

• These can be used to replace many point-to-point force calculations

• An example is using the gravity field of Earth– Without this force field, we would need to do the

calculations between each particle and the centre of the earth

Page 30: Particles Paul Taylor 2009. Polygons are not so hot! Good for representing objects like A Cup A Robot A Pyramid Not so hot for creating Hair Snowflakes

The End