Particle System Tutorial: 2016 Edition

Discussion in 'Models, Animations, and Particle Effects' started by WinstonShnozwick, Sep 15, 2016.

Remove all ads!
  1. Gaear

    Gaear Bastard Maestro Administrator

    Joined:
    Apr 27, 2004
    Messages:
    11,029
    Likes Received:
    42
    Good work. Stickied!
     
  2. WinstonShnozwick

    WinstonShnozwick Established Member

    Joined:
    Mar 2, 2011
    Messages:
    628
    Likes Received:
    23
  3. dolio

    dolio Established Member Supporter

    Joined:
    May 30, 2005
    Messages:
    338
    Likes Received:
    81
    Yo.

    So, I was playing with particle effects, and decided to finally try to figure out what some of the fields really mean, because the descriptions of a lot of them didn't make a lot of sense to me. Here's a writeup of what I figured out, if only so that I don't have to figure it all out again later. Some of this information only applies to "sprite" systems, but a lot of it is general, I think.

    Column 7 "Emitter Space" and column 12 "particle coordinate system" are obviously similar. In both cases, they specify how to determine the origin and axes of their respective coordinate systems. For example:
    • "World" in column 7 means the origin is the location you started the particles at, the X axis points down-left, the Y axis points up, and the Z axis points down-right.
    • "Object Pos" means the current location of the object you applied the particles to (instead of their location when the particles started), with the same axis directions.
    12 is similar, but relative to the "emitter" (below) instead of the original particle location. "World" is as above but using the emitter's location. "Same as Emitter" is like "Object Pos". And "Emitter YPR" somehow changes the plane the sprite is rendered in. In the first two, it seems to be drawn parallel to the screen, but with the last it looked drawn parallel to the ground in my examples.

    There are two steps to generating particles. First you situate an "emitter" in the first coordinate space. The emitter has a lifetime, position, velocity and acceleration relative to the origin. During the lifetime of the emitter, it produces particles at the specified rate. The particles have their own lifetimes, and position, velocity and acceleration in a coordinate system that is somehow relative to the emitter.

    For example, I was trying to make an effect that looked like a tornado. I selected "Object Pos" for #7 so that the tornado would follow a character. If for #12 I select, "Same as Emitter," then the entire tornado moves with them, because the particles' coordinate systems all shift to follow. If instead I select "World" then most of the tornado lags the character's movement (which looks kind of cool), because the coordinates are fixed when emitted.

    Now, the thing that confused me for a long time was that there are multiple columns described as "emitter velocity," and it wasn't clear what the difference is. So, here's what I'm pretty sure the answer is:
    1. 22-30, "Emitter ... X/Y/Z" determine how the emitter moves during its lifetime.
    2. 37-42, "Emitter ... X/Y/Z" determine how particles spawn/move, but as a function of emitter lifetime
    3. 47-55, "Particle ... X/Y/Z" determine how particles spawn/move as a function of particle lifetime
    4. #2 and #3 can use different sorts of coordinates (Cartesian vs. spherical)
    5. I think 47-49 might actually be part of group #2, but I'm not certain
    6. 31 and 59 (emitter/particle yaw) control the sprite's rotation as a function of emitter/particle lifetime. I've never seen the other two do anything.
    So, when a particle spawns, you get its position by adding up values from 37-42 and 47-55, and similar for velocity. At first it might not make a lot of sense to have #2 and #3, but they let you do things like:
    • Using cartesian Y coordinate in one group, and spherical X (rotation) and Z (radius) coordinate in the other, you can do cyllindrical coordinates, which aren't otherwise available*
    • Using M,N in group 2, and I?J in group 3, you can have an emitter that starts spawning slow-moving particles, but over time the spawned particles have higher initial velocities. But at all times, the velocities are randomized a bit (you can't otherwise do both randomization and a change over time, as far as I know)
    • Using I?J in group 2, and M,N in group 3, you can have particles that move linearly between two positions over their lifetime, but relative to a random location, which can be a lot easier than doing the same via specifying a velocity
    If you have a permanent emitter, then ranges in #2 start at the initial value and settle into the final value after a second or two, I think. That isn't universally true for all columns, though. Sometimes it repeats the range after a similar amount of time. Similarly, randomization will periodically pick a new value for a permanent emitter for some columns (but maybe not all).

    [*] Turns out the cyllindrical thing only works properly in V2Brute. In game, it seemed like the Y axis stuff just didn't get incorporated. Maybe the game doesn't like mixing coordinate systems.
     
    Last edited: Feb 3, 2024
    _doug_, Shiningted and Buffed Rabbit like this.
  4. dolio

    dolio Established Member Supporter

    Joined:
    May 30, 2005
    Messages:
    338
    Likes Received:
    81
    BTW, if anyone watching is not running temple+, I'd be interested to know if the cyllindrical stuff works in the base game. I think some particle stuff has been swapped out, so maybe it's an oversight in that.

    I can provide a .tab line and instructions on how to test it if necessary.
     
    Buffed Rabbit likes this.
Our Host!