|! IMPORTANT ! This is a PopcornFX v1 page. PopcornFX v2 documentation can be found here|
Particles can have various properties: Position, Velocity, Color, Life-duration, Rotation, Sub-Texture index, etc...
All these properties are called "particle fields".
The particle fields panel shows detailed information about the particle fields, and allows you to add, remove, or modify the particle fields. The more fields a particle has, the more space it will take in memory.
All the particles of the same layer have the same field-set, and each particle has its own version of each field.
For example, in a particle layer that has "Position", "Rotation", and "Color" fields, each particle will have its own "Position", "Rotation" and "Color", but won't have any Velocity or Sub-texture index, or rotation speed.
To access the particle fields panel, unroll the layer you want to see, and select its 'Fields' node.
The fields will appear inside the node properties panel:
|1. Total size of a particle, in bytes|
|2. 'Preset' buttons, click here to quick-add one of the few often-used preset fields|
|3. New field name box. Enter the name of the custom field you want to add in here.|
|4. 'Add' button, click here to add the new field|
|5. Delete field|
|6. Field type|
|7. Field footprint in bytes|
|8. Stream mode|
9. Transform mode
|10. Field name|
|11. Manually created or overridden fields.|
|13. Private fields|
|14. Virtual parent fields section|
To add a new field, Setup the fild as you want by typing its name in the input-box (UI item #3, see previous section), selecting its type, and transform flags, then hit the '+' button (UI item #4)
Alternatively, you can click on one of the two presets buttons (UI item #2), and choose which preset you wish to use. The editor will then auto-fill the field name, type, and transform flags based on this preset. You can then create the field by clicking on the '+' add button.
Note that sometimes a field may appear on a red background with a warning sign:
This happens when the field is unused by the effect.
The field is considered unused if:
- The field is not used internally by the system
- The field is not read from by any evolvers in any of the states
- The field is not read from by any renderers
- The field is not read from by any spawners
Fields used internally by the system are the 'LifeRatio' and 'InvLife' fields.
There are two fields always generated by the particle engine:
- InvLife : The inverse of the total particle life in seconds (1.0 / Life). For example, if the particle has a life of 16 seconds, its InvLife field will be equal to 0.0625
- LifeRatio : The Age of the particle, as a fraction of its total life. For example, if the particle lives 15 seconds, and has been spawned 6 seconds ago, its life ratio will be equal to 6/15 = 0.4
Most evolvers/Renderers/Spawners will generate auto-fields, like the Position, Size, or Velocity fields.
Some auto-fields won't be accessible within scripts, for safety/encapsulation/abstraction reasons, some others will be hidden through an abstract field that makes it easier to modify the original field. for example, the 'InvLife' field isn't directly accessible in-script. However, there is a virtual 'Life' field, that allows you to read and write the particle's life in seconds. Behind the scenes however, the 'Life' field maps to the inverse of the 'InvLife' field.
So when you write within a script
Life = 5.0;
the particle system converts that to
InvLife = 1.0 / 5.0;
The life is stored as the invLife only for performance reasons. and exposed to the user as the life only for usability reasons.
See the individual node's description in the Particle node reference for detailed information on their auto-fields, if any.
Auto-fields cannot be modified or removed through the Fields panel.
Sometimes, you might want to still change some properties. You still can do it by manually re-adding the field. the new definition overrides the automatic one, and lets you change some parameters. If you delete the overridden field, the default-one reappears.
For example, by default, positions and velocities are auto-fields, and have their transform mode set to 'full' and 'rotate', respectively. This is what works for most particle systems.
However, in some rare occasions, you might want to spawn in worldspace directly, without the particles being transformed by the spawner's local to world matrix. In that case, you need to override these fields and set their transform mode to 'none'. Just type in 'Velocity' or 'Position', as if you were adding a new field, set the type to float3, transform mode to none, and click the add button:
Note that in most cases, you shouldn't change the field type of overridden auto-fields.