PopcornFX v2.10

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
  1. Home
  2. Docs
  3. PopcornFX v2.10
  4. Concepts
  5. Effect interface

Effect interface

Note: Going back and forth between attribute nodes and the effect interface before v2.3.1 was pretty painful. Make sure you upgrade to 2.3.1 or later.

Overview

Each effect has an associated effect interface which describes its public properties, visible to the game engine:

Effect interface

The “Torch.pkfx” effect exposes some simple parameters

 

The effect interface can contain attributes, attribute samplers or events.

 

Attributes

Attributes are vector values that can be accessed in nodegraphs anywhere in the effect. Those values can be set at runtime by the game engine at minimal cost, and are useful to drive dynamic particle effects behaviors, or create variations across various instances of the same effect in a level:

Effect interface
Attributes are retrieved like any
constant nodes via the “input” node.

 

Attributes can be created from the effect interface panel, or declared from a nodegraph (template or particle graph). Placing an input node of type “attribute” automatically registers that attribute in the effect interface, once it has been properly named and typed.

 

Supported attribute types are:

  • float, float2, float3, float4
  • int, int2, int3, int4
  • bool, bool2, bool3, bool4
  • orientation

 

Like any other property, they can have a default value, description, min/max value and semantic.

The target game engine can then retreive and expose all those informations:

Effect interface

Creating an attribute node in a node graph will insert that attribute in the effect interface if no matching attributes is found. If an existing attribute matches the one created (same name), they will be merged into a single reference:

Effect interface
The effect interface panel displays the various attribute references

 

Note: By default, attributes are evaluated once (see particle graph). The simulation state can be changed from Auto/Spawn to Evolve to make sure attribute values are retrieved each frame:

Effect interface

  1. Attribute values will be retrieved at particle spawn
  2. Attribute values will be retrieved every frame

 

Attribute samplers

Attribute samplers are samplers that can be accessed in node graphs or scripts anywhere in the effect. Those values can be set at runtime by the game engine at minimal cost, and are useful to drive dynamic particle effects behaviors, or create variations across various instances of the same effect in a level:

Effect interface
Shape
attribute sampler

 

Supported attribute sampler types are:

  • dataGeometry (shape sampler)
  • dataImage (image sampler)
  • dataCurve (curve sampler)
  • dataAudio (audio sampler)
  • dataVectorField (turbulence sampler)
  • dataText (text sampler)
  • dataAnimPath (animtrack sampler)

 

An attribute sampler must have a default value plugged in to work properly, as it is not guaranteed it will be set by the game engine.

Note: Even though the game engine can override any attribute sampler type, the editor can only currently bind shape attribute samplers to an animated mesh for preview, using the “Bind to backdrop” checkbox.

 

Events

Events differ from attributes and attribute samplers as they cannot be set at runtime. They are designed to be exported to the game engine. They can be used to hook gameplay logic to effect events (see exporting events).

Was this article helpful to you? Yes No

How can we help?