Particle updaters

    After a particle spawns, it can change over time before it disappears. Updaters act on all living particles over time, changing attributes such as position, velocity, color, and so on. For example, a gravity force updates the particle's velocity at a constant rate, accelerating it toward the ground.

    Xenko features several built-in updaters. The sample demonstrates how you can add updaters to the engine.

    Several properties are common across many updaters.

    Collider

    media/particles-reference-updaters-5.gif

    A collider is an updater that changes the particle position and velocity when it collides with a predefined shape.

    media/particles-reference-updaters-6.gif

    The force field is defined by a bounding shape and several force vectors that operate on the particles based on their relative position to the bounding shape.

    The falloff is the change in the forces' strength based on the distance of the particle from the shape's center. The falloff is a function of the relative distance, where distance of is the center, 1 is the shape's boundaries, and more than 1 means the particle is outside the shape.

    Particles closer than the falloff start are always affected with the coefficient Strength Inside. Particles farther than falloff end are always affected with the coefficient Strength Outside.

    Coefficient for particles in between changes linearly:

    media/particles-reference-updaters-2.png

    Bounding shapes

    Sphere

    Image license: CC-BY-SA 4.0, sphere image from the by Geek3 under

    When the bounding shape is a sphere, the falloff distance is based on the radial distance of the particle from the sphere's center. If the sphere is scaled to an ellipsoid, this distance is also scaled. The distance is relative to the radius, with 1.0 being the sphere's surface.

    The directed force vector is parallel to the sphere's local Y axis. The repulsive force vector points from the center to the particle. The vortex force vector goes around the sphere's Y axis at the particle's position (using the right-hand rule for rotation).

    Box

    media/particles-reference-updaters-8.png

    When the bounding shape is a box, the falloff distance is the longest of the three distances on the X, Y and Z axes. The distance is relative to the box's sizes, with 1.0 being the box's surface.

    The directed force vector is parallel to the box's local Y axis. The repulsive force vector points from the center to the particle. The vortex force vector goes around the box's Y axis at the particle's position (using the right-hand rule for rotation).

    Cylinder

    When the bounding shape is a cylinder, the falloff distance is based on the radial distance of the particle from the cylinder's local Y axis. The particle height (position on the Y axis) is ignored unless the particle is outside the cylinder, in which case the distance is always 1.

    The directed force vector is parallel to the cylinder's local Y axis. The repulsive force vector points from the cylinder's local Y axis to the particle, so the repulsive force is always horizontal. The vortex force vector goes around the cylinder's Y axis at the particle position (using the right-hand rule for rotation).

    Torus

    media/particles-reference-updaters-10.png

    Image license: GFDL, , torus image from the "A simple Torus" work by Yassine Mrabet under GFDL,

    When the bounding shape is a torus, the field's nature changes completely. The falloff distance is based on the radial distance of the particle from the torus's inner circle (axis of revolution, shown in red), choosing a point on the circle closest to the particle.

    The directed force vector is tangent to the axis of revolution at the point closest to the particle. The repulsive force vector points from the axis to the particle. The vortex force vector goes around the directed force vector using the particle's position relative to the axis (using the right-hand rule for rotation).

    Gravity

    The gravity updater is a simplified force which affects all particles regardless of their position, with a constant force vector which doesn't scale or rotate. It's editable, so you can use it in projects with different scales and behavior.

    The gravity force ignores most properties such as offset and inheritance, and only uses the following attributes:

    Direction from speed is a post-updater, meaning it resolves after updaters which are not post-updaters, even if they appear later in the list.

    It has no properties and simply updates the particle's direction to match its speed. It uses the difference between the positions of the particle from the last frame and isn't directly dependent on velocity. This means even if the particle's own velocity is 0 and it's only moved by external forces, direction from speed resolves correctly.

    Direction isn't a normalized vector and changes its magnitude to match the delta distance. It overwrites any previous direction parameters, such as from an initializer.

    Color animation

    Color animation is a post-updater, meaning it resolves after updaters which aren't post-updaters, even if they appear later in the list.

    Color animation updates the particle Color field by sampling a curve over the particle's normalized lifetime (0 to 1). You can set a secondary curve in which case the particles will have slightly varied colors. Color animation overwrites any previous Color parameters, such as Initial Color.

    The curve values are given as Vector4, corresponding to RGBA with standard values between 0 and 1. Values above 1 are valid for RGB only (not Alpha) and can be used for HDR rendering.

    Rotation animation is a post-updater, meaning it resolves after updaters which are not post-updaters, even if they appear later in the list. It's strictly a single axis rotation, used for billboarded particles.

    Rotation animation updates the particle's Rotation field by sampling a curve over the particle's normalized lifetime (0 to 1). You can set a secondary curve in which case the particles will have slightly varied rotations.

    Rotation animation overwrites any previous Rotation parameters, such as Initial Rotation. If you need additive kind of animation check if the Shape Builder supports it (found in the Shape Builder's properties). Additive animations are not preserved in particle fields and do not persist, but can be applied in addition to any fields the particles already have.

    Size animation

    Size animation is a post-updater, meaning it resolves after updaters which aren't post-updaters, even if they appear later in the list.

    This is strictly a uniform size. Size animation updates the particle's Size field by sampling a curve over the particle's normalized lifetime (0 to 1). You can set a secondary curve, in which case the particles have slightly varied sizes.