Dev:2.4/Source/Physics/Particles Rewrite - Blender 2.46/Doc

提供: wiki
移動先: 案内検索

Documentation for the new particle features

(development page at: Dev:Source/Blender/2.46/Particles Rewrite)

Introduction

Particles can only be emitted from mesh objects. Each mesh object can have up to 10 separate particle systems and particle settings can be shared among systems, just like materials or textures can be applied to many objects etc.

http://users.utu.fi/jhkarh/media/code/particle_doc/add_new.jpg

To add a new particle system to an object go to the Particle buttons in the Object [F7] menu and click Add New in the Particle System tab, or select an existing particle settings from the dropdown menu.

http://users.utu.fi/jhkarh/media/code/particle_doc/add_more.jpg

To add more particle systems to an object advance the active particle system (1 Part 1) selector to an empty slot by clicking it near its right edge. As with material indices, the number on the left of Part indicates the active particle system, while the number on the right indicates the number or particle systems available for the object.

System settings

By default, the particles system type is Emitter. In such a system, particles are emitted from the selected object from the Sta frame through the End frame. Sta and End are defined in the Basic settings area of the same panel.

  • Datablock selector (PA:): here you can select particle settings (browser button), name them (text field) or delete particle systems (X button)
  • i Part j: selector for the active particle system
  • Enabled: toggle for enabling or disabling the active particle system
  • Protect: forces the actual particle simulation into the cache and locks it
  • Clear: clears any previous particles simulation from the cache
  • Type: menu for selecting the type of particles, among the three types available: Emitter, Reactor and Hair.

Emitter particles system type

http://users.utu.fi/jhkarh/media/code/particle_doc/emitter.jpg

Screenshot not up-to-date

Basic

Defines global settings for the particles system, like number of particles, life duration, and such.

  • Amount: the total amount of particles used in the simulation
    • Resol: when Grid distribution is selected, Amount is replaced by this Resol which sets the resolution of the distribution grid
  • Sta: the start frame of particle emission
  • End: the end frame of particle emission
  • Life: the lifetime (in frames) of the particles
  • Rand: a random (%) variation of the lifetime of a given particle

Emit From

These parameters defines how the particles are emitted, giving precise control over their distribution.

  • Random: the emitter element indices are gone through in a random order instead of linearly
  • Emitter element: Verts, Faces, Volume states that particles are emitted respectively by vertices, faces, enclosed volume of the mesh emitter
  • Even: particle distribution is made even based on surface area of the elements
  • Distribution:
    • Jittered: particles are placed at jittered intervals on the emitter elements
      • Amount: amount of jitter applied to the sampling
      • P/F: number of emissions per face (0 == automatic).
    • Random: particles are placed randomly in the emitter elements
    • Grid: particles are set in a 3d grid and particles near/in the elements are kept
      • Invert: toggles what is considered to be the emitter

Reactor particles system type

http://users.utu.fi/jhkarh/media/code/particle_doc/reactor.jpg

Screenshot not up-to-date

Reactor particles are born when other systems' particles do things. Usually (not with emit from particles) the target particle's size determines it's area of influence.

Warning: The target system must be set before the reactor system (in the same object) so that the targets are always updated first. Targeting systems cyclically (system in object 1 targets a system in object 2 and vice versa) may cause trouble since one target system will always be not yet updated.

Basic

A few settings differ from the standard Emitter particles system type. Here are the differences:

  • Sta/End: particles are only emitted when the chosen event happens (see React on, below). But with this option, you can force all remaining particles to be emitted within the Sta through End frames (the proper settings are displayed when this option is active).
  • React on: which event of the target particles triggers emission: Death (target particle dies), Collision (target particle collides), Near (target particle in the vicinity of the Reactor)
  • Multi React: allow reacting multiple times (alive particles react too and not just unborn particles)
  • Shape: how reaction strength varies with distance from target particle. The closest, the stronger the reaction.

Emit From

These parameters are mostly the same as the Emitter particles system type, to one exception:

  • Emitter element: Particles is another possible option for Reactor particles systems, meaning that particles are emitted by other particles, when reacted on.

Target

These parameters are only useful for Reactor systems, and are meant to define the particle system to which the Reactor system should react.

  • OB: defines the object that has the target particle system, whose particles are evaluated in search for events to react to. If the field is blank, the current object is used.
  • sys: selects which particle system is the target. Should appear red when no valid target is specified. This is always the case when the current particles system is the first particles system of the current object (OB: field empty)

Interesting examples of reactions

  • React on - Death: Particles are emitted when the target particles die. Two example usages:
    • Fireworks: Target particles are emitted upwards with normal gravity. Reactor particles are set to emit from particles with random initial velocity and similar gravity.
    • Minefield: Reactor particles emitted from a large volume with reactor initial velocity. Target particles that die inside the volume cause "explosions" when they die.
  • React on - Collision: Particles are emitted when target particles collide with something. Example usage:
    • Raindrops: Reactor particles are on the ground plane with normal and reactor velocity. Target particles fall from above and collide with the ground plane.
  • React on - Near: Particles are emitted when target particles are near them. Example usages:
    • Trails: Reactor particles set to emit from particles with random initial velocity. Now the reactor particles are always "near" the target particles so they emit constantly leaving a trail for the target particles.
    • Sand dunes: Reactor particles are emitted from the ground mesh with negative reactor velocity. When target particles fly over the ground they make reactor particles rise from the ground.

Hair particles system type

To be documented separately.

Physics

Physics determine the way the particles move and interact with the world around them.

None

http://users.utu.fi/jhkarh/media/code/particle_doc/phys_none.jpg

At first a physics type that makes the particles do nothing could seem a bit strange, but it can be very useful at times. None physics make the particles stick to their emitter their whole life time. The initial velocities here are used for example to give a velocity to particles that are affected by a harmonic effector with this physics type when the effect of the effector ends.

Moreover, it can be very convenient to have particles at disposal (whose both Unborn and Died are visible on render) to groom vegetation and/or ecosystems using Object, Group or Billboard types of visualization.

Newtonian

http://users.utu.fi/jhkarh/media/code/particle_doc/phys_newton.jpg (screenshot not up-to-date)

These are the "normal" particle physics. Particles start their life with the specified initial velocities and angular velocities, and move according to forces. The response to environment and to forces is computed differently, according to any given integrator choosen by the animator.

Integrators

Integrators are a set of mathematical methods available to calculate the movement of particles. The following guidelines will help to choose a proper integrator, according to the behaviour aimed at by the animator.

  • Euler: Also known as Forward Euler. Simplest integrator. Very fast but also very unstable. If no dampening is used, particles get more and more energy over time. For example, bouncing particles will bounce higher and higher each time. Should not be confused with Backward Euler (not implemented) which has the opposite feature, energies decrease over time, even with no dampening. Use this integrator for short simulations or simulations with a lot of dampening where speedy calculations is more important than accuracy.
  • Midpoint: Also known as 2nd order Runge-Kutta. Slower than Euler but much more stable. If the acceleration is constant (no drag for example), it is energy conservative (also known as symplectic). It should be noted that in example of the bouncing particles, the particles might bounce higher than they started once in a while, but this is not a trend. This integrator is a generally good integrator for use in most cases.
  • RK4: Short for 4th order Runge-Kutta. Similar to Midpoint but slower and in most cases more accurate. It is energy conservative even if the acceleration is not constant. Only needed in complex simulations where Midpoint is found not to be accurate enough.

Initial velocity

The initial velocity of particles can be set through different parameters, based on the type of the particle system (see Particle System tab). If the particles system type is Emitter or Hair, then the following parameters give the particle an initial velocity in the direction of...

  • Object: ...the emitter objects movement (Let the object give the particle a starting speed)
  • Normal: ...the emitter's surface normals (Let the surface normal give the particle a starting speed)
  • Random: ...a random vector (Give the starting speed a random variation)
  • Tan & Rot: ...a tangential vector along the surface rotated by "Rot"
    • Tan: Let the tangent speed give the particle a starting speed
    • Rot: Rotates the surface tangent

If the particles system type is Reactor, then the following parameters give the particle an initial velocity in the direction of...

  • Particle: ...the target particles velocity (Let the target particle give the particle a starting speed)
  • Reactor: ...a vector away from the target particles location at the time of the reaction (e.g. Let the vector away from the target particles location give the particle a starting speed)

Rotation

These parameters specify how the individual particles are rotated during their travel.

  • Dynamic: Only initializes particles to the wanted rotation and angular velocity and let's physics handle the rest, otherwise the angular velocity is predetermined at all times (Set rotation to dynamic/constant)
  • Rotation: Sets the initial rotation of the particle by aligning the x-axis in the direction of... (Select particle rotation mode)
    • None: ...the x-axis
    • Normal: ...the emitter's surface normal
    • Velocity: ...the particle's initial velocity
    • Random: ...a random vector
  • Amount: How much to align the x-axis (Rotation amount)
  • Phase: Rotation around the x-axis (Initial rotation phase)
  • Angular v: The magnitude of angular velocity, the dropdown specifies the axis of angular velocity to be...
    • None: ...a zero vector
    • Spin: ...the particles velocity vector
    • Random: ...a random vector

Global effects

These parameters specify how external physical factors can enhance or impede particles velocity. Useful when simulating various phenomenon like gravity, air-drag, friction and such.

  • AccX, AccY and AccZ: An acceleration in the direction of the global axes. Use this to implement gravity by setting AccZ to a negative value, for example.
  • Drag: A force that reduces particle velocity in relation to it's speed and size (useful in order to simulate Air-Drag or Water-Drag).
  • Brown: A random force that changes from frame to frame. Simulates Brownian movement which is an effect seen on small particles where forces from individual molecules are unbalanced over time (most simulations shouldn't use it).
  • Damp: Reduces particle velocity (deceleration, friction, dampening).

Boids

Boids particle systems can be set to follow basic rules and behaviors, something close to artificial intelligence. They are useful for simulating flocks, swarms, herds and schools of various kind of animals, insects and fishes.

Behaviour of Boids

Boids artificial intelligence can only handle a certain amount of information at a single time, so the possible courses of action are easy to display within a single list.

http://users.utu.fi/jhkarh/media/code/particle_doc/phys_boids.jpg

The rules are parsed from top-list to bottom-list (thus giving explicit priorities), and the exact order can be modified using the little arrows in front of each row. The list of rules available are:

  • Collision: Avoid deflector objects
  • Avoid: Avoid predators
  • Crowd: Avoid other boids
  • Center: Get to flock center
  • AvVel: Maintain average velocity
  • Velocity: Match velocity of nearby boids
  • Goal: Seek goal
  • Level: Keep the Z level

Each rule can be individually weighted ; the value should be considered how hard the boid will try to respect a given rule (a value of 1.000 means the Boid will always stick to it, a value of 0.000 means it will never). If the boid meets more than one conflicting condition at the same time, it will try to fulfill all the rules according to the respective weight of each. Any rule could be weighted from -1.000 to +2.000 in order to give it more or less significance (default value: ...).

  • Normal behaviour can be expected with weights between 0.000 to 1.000
  • From 1.000 to 2.000 the boids over react according to the rules
  • From -1.000 to 0.000 the boid reacts contrary to the rules

Please note that a given boid will try as much as it can to comply to each of the rules he is given, but it is more than likely that some rule will take precedence on other in some cases. For example, in order to avoid a prey, a boid could probably "forget" about Collision, Crowd and Center rules, meaning that "while panicked" it could well run into obstacles, for example, even if instructed not to, most of the time.

As a final note, the Collision algorithm is still not perfect and in research progress, so you can expect wrong behaviors at some occasion. It is worked on.

Physics Boids react to

  • MaxVelocity: Maximum velocity
  • AvVelocity: The usual speed percent of max velocity. If MaxVelocity is set to 10.000 and AvVelocity to 0.300, then the average velocity of the boids is 3.000.
  • LatAcc: Lateral acceleration percent of max velocity (turn). Defines how fast a boid is able to change direction.
  • TanAcc: Tangential acceleration percent of max velocity (forward). Defines how much the boid can suddenly accelerate in order to fulfill a rule.
  • Banking: Banking of boids on turns (1.0 == natural banking)
  • MaxBank: How much a boid can bank at a single step
  • N: How many neighbours to consider for each boid
  • 2D: Constrains boid to a surface: either to the surface of a given object (if specified in the OB field) or to a certain Z value (GroundZ). Useful to simulate herds on a ground, for example.
    • When activated, Level, Banking and MaxBank become irrelevant
    • GroundZ: Default Z value
    • OB: Object's surface the boid is constrained to
    • If boids trajectory leads them out of the surface of an object, the GroundZ value is then used

Boids, deflectors and effectors

Very much like Newtonian particles, Boids will react to the surrounding deflectors and fields, according to the needs of the animator:

  • Deflection: Boids will try to avoid deflector objects according to the Collision rule's weight. It works best for convex surfaces (some work needed for concave surfaces).

For boid physics, Spherical fields define the way the objects having the field are seen by others. So a negative Spherical field (on an object or a particle system) will be a predator to all other boids particles systems, and a positive field will be a goal to all other boid particles systems.

When you select an object with a particles system set on, you have in the Fields tab a little menu stating if the field should apply to the emitter object or to the particles system. You have to select the particles system name if you want prey particles to flew away from predator particles.

  • Spherical fields: these effectors could be predators (negative Strength) that boids try to avoid or targets (positive Strength) that boids try to reach according to the (resp.) Avoid and Goal rules' weights. Spherical's effective Strength is multiplied by the actual relevant weight (e.g. if either Strength or Goal is null, then a flock of boids won't track a positive Spherical field).

You can also activate Die on hit (Extras panel) so that a prey particle simply disappears when "attacked" by a predator particle which reaches it.

Currently, this system doesn't allow for complex relationships (i.e. prey for one system while predator for others) but this will be made possible when particles will be properly pythonised.

Video example of Boids in action

Please refer to the following video as an example of flock behaviour that boids can help to achieve:

Video Example

Tutorial showing how to set a prey-predator relationship using Boids

As stressed before, using boids, it is easy to set animations with some prey/predator-like behaviour to some extend. In these cases, using Spherical Fieds emitters with negative Strength (repulsive, predators) or positive Strength (attractive, preys) will be quite easy and effective. Moreover, using the Die on Hit option (in the Extras panel) would prove useful also, when a predator successfully reaches a particle.

Setting a prey-predator relationship using Boids particles

Interesting reads

These papers have been contributed by Craig Reynolds, the Boids' pioneer:

Keyed

http://users.utu.fi/jhkarh/media/code/particle_doc/phys_keyed.jpg

Visualization

With the items of this panel, you can set the way the particles will be rendered or depicted in the viewports in various ways (not less than ten!).

http://users.utu.fi/jhkarh/media/code/particle_doc/viz_point.jpg

  • dropdown menu: set how particles are visualized (None, Point, Circle, Cross, Axis, Line, Path, Object, Group, Billboard)

The options below the menu apply to almost all visualization types:

Draw

Defines various display options for the particles in the viewports of Blender.

  • Vel: Draw the velocity of the particles
  • Size: Draw the size of the particles
  • Num: Draw the id-numbers of the particles
  • Draw size: Specifies how large (in pixels) the particles are drawn in the viewport
  • Disp: Specifies the percentage of all particles to show in the viewport (all particles are still rendered)

Render

Defines various options for the particles mostly at render time.

  • Material: Which object's material index to use for the particles
  • Col: Draw particles in the material's diffuse color (Col in the Material tab of the Material buttons). Please note the active particles system is always drawn in white in the viewports.
  • Emitter: Render the emitter object and not just its particles
  • Parents: Render also parent particles if child particles are used
  • Unborn: Render particles even before they are born
  • Died: Render particles even after they have died

Drawmode options

The new particles systems provides various modes of display for the particles. Some modes are quite generic and could satisfy any kind of particle systems, while other are specialized and are meant for very specific uses.

None

This visualization mode is useful if you don't want to show the particles, but just want to use them to affect other things, like acting as effectors for other particles, targets for a keyed system or to explode the emitter.

Viewport only: Point, Circle, Cross and Axis

Particles visualized like Point, Circle, Cross and Axis are all still rendered as halos, but displayed as needed on the viewports. These modes of visualization don't have any special option, but can be very useful when you have multiple particle systems at play, if you don't want to confuse particles of one system from another (especially in simulations using Boids physics).

Line

http://users.utu.fi/jhkarh/media/code/particle_doc/viz_line.jpg

The Line visualization mode creates thin polygon lines with the strand renderer in the direction of particles' velocities.

  • Speed: Multiply the line length by particles' speed
  • Back: Set the length of the particle's tail
  • Front: Set the length of the particle's head

Path

http://users.utu.fi/jhkarh/media/code/particle_doc/viz_path.jpg

Screenshot not up-to-date

The Path visualization mode uses the strand renderer and is used for hair, fur, etc. Cached or Keyed particles are needed and a warning will be issued by Blender if it is not the case.

  • Steps: Set the number of subdivision of the drawn paths (the value is a power of 2)
  • Render: Set the number of subdivision of the rendered paths (the value is a power of 2)
  • Abs Length: Use an absolute length for particles path visualization mode
    • Max Length: Set the value of the absolute maximum length (in blender units).
  • RLength: Randomize path lengths
  • B-Spline: Interpolate hair using B-Splines
  • Strand Renderer: Use the strand primitive for rendering
    • Angle: How many degrees path has to curve to produce another render segment
  • Adaptive render: Tries to remove unnecessary geometry from the paths before rendering particle strands in order to make the render faster and easier on memory
    • Angle: How many degrees path has to curve to produce another render segment (straight parts of paths need fewer segments)
    • Pixel: How many pixels path has to cover to produce another render segment (very short hair or long hair viewed from far away need fewer parts)

Object & Group

http://users.utu.fi/jhkarh/media/code/particle_doc/viz_object.jpg http://users.utu.fi/jhkarh/media/code/particle_doc/viz_group.jpg

Screenshots not up-to-date

These visualization modes allow you to use a duplicate an object or objects in place of particles. This option is very interesting both for ecosystems simulations or for flocks of specific objects.

In the Object visualization mode, the specified object (OB: field) is duplicated in place of each particle.

In the Group visualization mode, the objects that belong to the group(GR: field) are duplicated sequentially in the place of the particles.

  • Pick Random: The objects in the group are selected in a random order, and only one object is displayed in place of a particle
  • DupliGroup: Use the whole group at once, instead of one of its elements, the group being displayed in place of each particle

Please note that this mechanism fully replaces old Blender particles system using parentage and DupliVerts to replace particles with actual geometry. This method is fully deprecated and doesn't work anymore.

Billboards

http://users.utu.fi/jhkarh/media/code/particle_doc/viz_bb.jpg

Screenshot not up-to-date

Billboards are aligned square planes. How they are aligned, and what are they aligned to can be influenced in many ways. Texturing billboards is done by using uv coordinates that are generated automatically for them.

The main thing to understand is that if the object doesn't have any UV Layers, you need to create at least one in the object Edit buttons for any of these to work. Moreover, material should be set to UV coordinates in the Map Input panel.

  • Lock: Lock the align axis
  • Align to: Dropdowmenu indicating the axis that billboards are prealigned to before turning them to the target. It could be X, Y, Z or Velocity. If View is used, then no prealignment takes place.
  • Tilt: Rotation angle of the billboards planes.
  • Rand: Random variation for the rotation angle.
  • UV Split: The amount of rows/columns in the texture to be used.
  • Animate: Dropdown menu, indicating how the split UVs could be animated (changing from particle to particle with time):
    • None: No animation occurs.
    • Time: The sections of the texture are gone through sequentially in particles' lifetimes.
    • Angle: Change the section based on the angle of rotation around the "align to" axis, if view is used the change is based on the amount of tilt.
  • Offset: Specifies how to choose the first part (of all the parts in the n*n grid in the texture defined by the "uv split" number) for all particles.
    • None: All particles start from the first part.
    • Linear: First particle will start from the first part and the last particle will start from the last part, the particles in between will get a part assigned linearly from the first to the last part.
    • Random: Give a random starting part for every particle.
  • OffsetX: Offset the billboard horizontally in relation to the particle center.
  • OffsetY: Offset the billboard vertically in relation to the particle center.
  • OB: The target object that the billboards are facing. By default the active camera is used.
  • UV Channel: Billboards are just square polygons. To texture them in different ways we have to have a way to set what textures we want for the billboards and how we want them to be mapped to the squares. The only useful way currently is to create "fake uv channels" for the emitter. These can then be set in the texture mapping buttons to set wanted textures for different coordinates.
    • Normal: Coordinates are the same for every billboard, and just place the image straight on the square. These are very usefull to create billboards with soft boundaries like halos for example with a sphere/halo blend texture.
    • Time-Index (X-Y): Coordinates actually define single points in the texture plane with the x-axis as time and y-axis as the particle index. For example using a horizontal blend texture mapped to color from white to black will give us particles that start off as white and gradually change to black during their lifetime. On the other hand a vertical blend texture mapped to color from white to black will make the first particle to be white and the last particle to be black with the particles in between a shade of gray.
    • Split: Coordinates are a single part of the "uv split" grid, which is a n*n grid over the whole texture. What the part is used for each particle and at what time is determined by the "offset" and "animate" controls. These can be used to make each billboard unique or to use an "animated" texture for them by having each frame of the animation in a grid in a big image.
  • UV: Set the name of the UV layer to use with billboards, default is active UV layer (check Mesh panel in the Editing [F9] menu)

Extras

http://users.utu.fi/jhkarh/media/code/particle_doc/extras.jpg

Effectors

  • GR: limit effectors that affect the particles to a group
  • Size Deflect: use particle's size when it deflects from a surface
  • Die on hit: particles die when they hit a surface
  • Sticky: particles stick to the object they hit

Time

  • Global: Particles are calculated in global time vs. the object's time (time ipo).
  • Absolute: All ipos that effect particles are calculated in absolute(normal) time vs. relative (particle life) time.
  • Loop & Instantly: Particles are reborn once they die. Instantly makes them reborn immediately if they die prematurely (collisions). Note: baking looping particles is not yet supported and may cause trouble!
  • Tweak: A multiplier to the dynamics calculation timestep length, with "1.0" one frame corresponds to 1/25 seconds

Vertex group

  • Attribute: The attribute of the particles that is affected by the vertex group
  • Neg: Negate the effect of the vertex group
  • Vertex group: select the vertex group that is used

Other

  • Seed: An offset in the random table that is used for random things in the particles.
  • Size & Rand: The size of the particles and its random variation. Size may seem a bit strange setting since particles are nearly by definition point-like, but the size may be thought of as the particles' area of influence (reactor targets etc.) and the size is also used to scale different visualizations like objects, groups and billboards.
  • Mass from size: Multiply particle mass with its size.
  • Mass: Mass is used in the physics calculations.

Children

http://users.utu.fi/jhkarh/media/code/particle_doc/child_part.jpg

http://users.utu.fi/jhkarh/media/code/particle_doc/child_faces.jpg

http://users.utu.fi/jhkarh/media/code/particle_doc/child_kinkbranch.jpg

Particle mode

This is new mode in Blender. It's available only when selected object had added Particle System.

Clicking N in 3D View enables panel: Particle Edit Properties. In this panel user can select Brush type (None, Comb, Cut, Grow, Shrink, Add, Weight, Smooth) for manual, (parallel intuitive like in SculptMode) shaping particles.

Hair Softbody

Effectors

Harmonic effector

Example video: http://lecocqguillaume.chez-alice.fr/Tuts/Harmonics/harmonic.avi

Modifiers

Particle

Explode

Example video showing explosion with collision detection: http://lecocqguillaume.chez-alice.fr/Tuts/0001_0100.avi

Instance

Ipos

Constraints


Jhk 13:42, 30 June 2007 (CEST)