Particle System Overview

From Valve Developer Community
Jump to: navigation, search
简体中文

Particle systems are collections of small objects that create pseudo-3D visual effects such as clouds, beams, and full-screen post-processing effects.

A particle system often includes a number of nested child effects, each of which are made up of plug-in components that control the behavior of the system. This allows for each particle effect to be as simple or as complex as needed.

Anatomy

Base Properties

In its base state, a particle system has no components and just a few basic properties. These are the generic properties that every system has. They include things which affect a whole system, which don't vary on a per-particle basis and don't fit into the other sockets which make up a system. A few define low-level engine settings that are best left to their default values.


The base properties you may find useful to modify are:
initial particles
bounding box min and bounding box max
fallback replacement definition
screen space effect
maximum draw distance
max particles


Additionally, some properties are here to provide a simple mechanism for defining system property defaults which can then be overridden by operators when necessary. These include:
normal
color
radius
rotation
rotation speed
lifetime
sequence number
sequence number 1


Some of these properties may be hidden by default in the particle editor tool, in which case you will have to enable the "Show Hidden Attributes" option to see them.


Enabling "Show Hidden Attributes" near the top of the properties panel allows you to see additional properties that are normally hidden.


For more information, see Source 2 Particle System Properties. Since Source 2's Particle Editor Tool has a variety of differences in visuals and formatting, as well as in terms of functionality and features from Source 1, it has been put into its own separate page.

Functions

Beyond the base properties, a particle system is made up of component pieces which are socketed in. In the general case, you can have as many of these elements in each category as you wish, even socketing in multiple copies of the same component when it makes sense to do so. These act upon the fields that each particle has in order to set up or modify it.

Renderers

Renders define how your particles get drawn. These include sprites, ropes, streaks, and so forth. Each particle can be drawn multiple times in multiple ways if you wish to do so. Note that in the latest revision of the particle engine, most renderers reference vtex files for their sprites. The exceptions are projected and cable particles, which reference vmat files. (Vmat files are created in the Workshop Tools's Material Editor).

Emitters

Emitters define how many particles are created over what period of time. Again a system can have multiple emitters which define different types of emission which come together to form the overall pattern to the particle emission.

Initializers

Initializers set up the starting state for each particle that is created, initializing the fields within each particle. For example, a particle's initial location in space, its color, size, or alpha. Initializers only set up starting properties of each particle as it is created, after which they have no effect on each particle.

Operators

Once the initial state of a particle has been set up by Initializers, operators take over and carry out a function upon each particle for every frame that it exists.

Forces

Forces are a variation on operators that affect motion of the particle.

Constraints

Constraints define movement limits on a particle, such as collision or maximum distance from a control point.

Children

Children are simply other particle systems which are linked to this system. Some data, such as control points, can be passed down to children, and they can be nested multiple levels deep.

Control Points

Control Points (CPs) are the basic external input mechanism for a particle system, and each system can have up to 64. Control points have a position, orientation, and an entity they can reference. By default control point 0 is the particle system's origin and orientation.
If a CP is associated with an entity it can be parented to the entity or an attachment point. In this same way, each additional control point in a system can be assigned a position in space, an orientation, and an entity. This allows systems such as the TF Medic's heal beam to travel between the weapon and the player it is healing.
This can also allow a single system to emit across multiple point or model sources if necessary, to provide an effect such as a growing fire, for example.
As the various elements of a particle system can access CP data, this can allow multiple dynamic elements to influence a system. While control points act as a position in space by default, other data can be stored in each point if needed, which allows external code or entities to pass generic data into a system that can then be remapped to properties of the system.

See also