multimedia programming 21: particle animation departments of digital contents sang il park

21
Multimedia Programming 21: Particle Animation Departments of Digital Contents Sang Il Park

Upload: preston-ward

Post on 18-Jan-2016

222 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Multimedia Programming 21: Particle Animation Departments of Digital Contents Sang Il Park

Multimedia Programming 21:Particle Animation

Departments of Digital Contents

Sang Il Park

Page 2: Multimedia Programming 21: Particle Animation Departments of Digital Contents Sang Il Park

Outline• Review: Playing with Video• Particle Systems

Page 3: Multimedia Programming 21: Particle Animation Departments of Digital Contents Sang Il Park

OpenCV Video I/O• OpenCV 의 Video Reading Functions– CvCapture– cvCaptureFromFile– cvCaptureFromCAM– cvReleaseCapture– cvQueryFrame– cvGetCaptureProperty– cvSetCaptureProperty

Page 4: Multimedia Programming 21: Particle Animation Departments of Digital Contents Sang Il Park

OpenCV Video I/O• OpenCV 의 Video Writing Functions– cvCreateVideoWriter– cvReleaseVideoWriter– cvWriteFrame

Page 5: Multimedia Programming 21: Particle Animation Departments of Digital Contents Sang Il Park

Particle Animation

Reference:Reeves W.: "Particle Systems -- A Technique for Modelling a Class of Fuzzy Objets", Computer Graphics, 17(3), pp. 359-376, 1983

Page 6: Multimedia Programming 21: Particle Animation Departments of Digital Contents Sang Il Park

Particle Systems

Particle systems offer a solution to modeling amorphous, dynamic and fluid objects like clouds, smoke, water, explosions and fire.

Page 7: Multimedia Programming 21: Particle Animation Departments of Digital Contents Sang Il Park

Representing Objects with Particles

• An object is represented as clouds of primitive particles that define its volume rather than by polygons or patches that define its boundary.

• A particle system is dynamic, particles changing form and moving with the passage of time.

• Object is not deterministic, its shape and form are not completely specified. Instead

Page 8: Multimedia Programming 21: Particle Animation Departments of Digital Contents Sang Il Park

Particle Systems• A particle is a point mass– Mass– Position– Velocity– Acceleration– Color– Lifetime

• Use lots of particles to model complex phenomena– Keep array of particles

Page 9: Multimedia Programming 21: Particle Animation Departments of Digital Contents Sang Il Park

Particle Systems• For each frame:– Create new particles and assign attributes– Delete any expired particles– Update and move particles based on attributes

and physics– Render particles

Page 10: Multimedia Programming 21: Particle Animation Departments of Digital Contents Sang Il Park

Particle Generation

Particles are generated using processes with an element of randomness.

One way to control the number of particles created is by the particles generated per frame:

Npartsf = MeanPartsf + Rand() X VariancePartsf

Another method generates a certain number of particles per screen area:

Npartsf = (MeanPartsSAf + Rand() X VariancePartsSAf) X ScreenArea

With this method the number of new particles depends on the screen size of the object.

Page 11: Multimedia Programming 21: Particle Animation Departments of Digital Contents Sang Il Park

Particle Attributes

• Initial position• Initial velocity• Initial size

– InitialSize = MeanSize + Rand() X VarSize

• Initial color• Initial transparency• Shape• Lifetime

Alias|Wavefront’s Maya

Page 12: Multimedia Programming 21: Particle Animation Departments of Digital Contents Sang Il Park

Creating/Deleting Particles• Where to create particles?– Around some center– Along some path– Surface of shape– Where particle density is low

• When to delete particles?– Where particle density is high– Life span– Random

Page 13: Multimedia Programming 21: Particle Animation Departments of Digital Contents Sang Il Park

Example: Wrath of Khan

Page 14: Multimedia Programming 21: Particle Animation Departments of Digital Contents Sang Il Park

Example: Wrath of Khan

Page 15: Multimedia Programming 21: Particle Animation Departments of Digital Contents Sang Il Park

Example: Wrath of Khan

Page 16: Multimedia Programming 21: Particle Animation Departments of Digital Contents Sang Il Park

Particle Systems• For each frame:– Create new particles and assign attributes– Delete any expired particles– Update and move particles based on attributes

and physics– Render particles

Page 17: Multimedia Programming 21: Particle Animation Departments of Digital Contents Sang Il Park

Equations of Motion• Newton’s Law for a point mass– f = ma

• Update every particle for each time step– a(t+Δt) = g (=gravity=-9.8m/sec2)– v(t+Δt) = v(t) + a(t)*Δt– p(t+Δt) = p(t) + v(t)*Δt + a(t)2*Δt/2

Page 18: Multimedia Programming 21: Particle Animation Departments of Digital Contents Sang Il Park

Particle DynamicsOther attributes can vary over time as well, such as color, transparency and size. These rates of change can be global or they can be stochastic for each particle.

Page 19: Multimedia Programming 21: Particle Animation Departments of Digital Contents Sang Il Park

Particle Extinction

• When generated, given a lifetime in frames.

• Lifetime decremented each frame, particle is killed when it reaches zero.

• Kill particles that no longer contribute to image (transparency below a certain threshold, etc.).

Page 20: Multimedia Programming 21: Particle Animation Departments of Digital Contents Sang Il Park

Particle Rendering• For Star Trek II, Reeves made two

assumptions which made things easier for him:– assumed particles wouldn’t intersect other

geometry (handled occlusion by compositing) Particles can obscure other objects behind them, can be transparent, and can cast shadows on other objects. The objects may be polygons, curved surfaces, or other particles.

– treated particles as point light sources, each particle contributing a bit to the brightness of a pixel (avoiding hidden surface detection and shadows). However, the particles did not actually cast light on the geometry in the scene; lights had to be added.

Page 21: Multimedia Programming 21: Particle Animation Departments of Digital Contents Sang Il Park

Star Trek II: The Wrath of Khan