UE4/Class PopcornFXAttributeSampler

From PopcornFX
Jump to navigation Jump to search
! IMPORTANT ! This is a PopcornFX v1 page. PopcornFX v2 UE4 plugin documentation can be found here

(last edit version: v1.7.0)

Class PopcornFXAttributeSampler

An attribute sampler is a particle sampler exposed in the attribute list. It can used in SpawnerScripts and can be overridden in Unreal Engine 4.

In PopcornFX Editor

To expose a Particle Sampler as an Attribute, create your Particle Sampler in the Attribute Samplers folder.


Attribute Sampler Types



  • 1: Spawn a new PopcornFX Attribute Sampler Actor in the level
  • 2: Attach it (dragndrop) to your effect emitter
  • 3: Setup the Attribute Sampler
  • 4: Set PopcornFXEmitter's attribute sampler to your Attribute Sampler Actor

Note: You need to restart the emitter after changing attribute sampler properties.

About "Use Relative Transforms"

if enabled, the transforms of the attribute sampler will be relative to the parent Actor, so it can be used in the SpawnerScript's Eval() function.

if disabled, the world transforms will be used, it is meant to be used in the SpawnerScript's PostEval() function.

Static Meshes


Static mesh needs to build a cache, see Static Mesh Codec.

Skinned Mesh

The skinned mesh attribute sampler allow you to sample Skinned meshes (USkeletalMeshComponent, UDestructibleComponent).


Each frame, this attribute sampler will start to skin vertex positions, normals, tangents (if requested) on the CPU asynchronously as soon as possible (right after each component's update their bones) so that the skinning itself doesn't consume GameThread time.

Different streams can be accessed from an effect, such as:

  • Positions
  • Normals
  • Tangents
  • Colors
  • UVs
  • Surface velocities (!= Bone velocity)

By default, skinned mesh attribute samplers are setup to only skin vertex positions. This is done so by default they don't consume much CPU time and memory.


Simulated cloth positions and normals will automatically be available if you enable bBuildClothData (available since UE4 plugin v1.8.0).

Tangents sampling isn't supported for cloth sections.

Legacy APEX files (< UE4.16) are not compatible, please use UE4's new [Clothing tool].

Cloth isn't free, use with caution.


  • Don't enable all streams by default, try to only enable those that your effects would need to avoid consuming too much CPU time / memory.
  • Hiding/Unhiding bones is not costless, we need to rebuild acceleration structures each time you do so, to keep correct distribution over the mesh. Try to batch "HideBoneByName" together in the same frame.
  • If you hide/unhide bones of the skinned mesh (or you sample a DestructibleComponent), make sure you have at least bSkinPositions checked, so that the attribute sampler can refresh its "sampling distribution table".


The curve attribute sampler allow you to sample Unreal Engine Curves (FCurveFloat, FCurveVector, FCurveLinearColor).


  • Create your curve asset (Create -> Miscellaneous -> Curve)
  • Drag & drop a PopcornFXAttributeSamplerActor in your level and assign it to your effect as shown above
  • Set the Sampler Component Type value to Curve
  • Set the Curve Dimension value (Warning : this field must match the default attribute's curve dimension)
  • Check Is Double Curve if necessary
  • Assign your asset(s), depending on Is Double Curve


The curves will be automatically converted to PopcornFX's own curve type internally, though, here's some advices:

  • Curves values will be clamped to a 0-1 range
  • Curves supports independant key times for each axis, but you should be aware that other axis will interpolate the missing key times
  • 2 Dimension curves are not supported, as there is no FCurveVector2D type.


Please refer to Texture sampling in order to properly setup your sampled texture.


  • Drag & drop a PopcornFXAttributeSamplerActor in your level and assign it to your effect as shown above
  • Set the Sampler Component Type to Image
  • Assign your texture asset



  • Drag & drop a PopcornFXAttributeSamplerActor in your level and assign it to your effect as shown above
  • Set the Sampler Component Type to Text
  • Setup the Text field