Grid attribute samplers

Available properties

The plugin allows you to modify the following properties of your grid sampler:

UE GridProperties

  • Use an existing asset grid asset to write to and read from. The asset grid must be an UE render target
    The target will only be readable/writable when using GPU simulated particles.
    It can still be used with CPU simulated particles to use the render target’s dimensions for the grid’s setup.

  • Grid order: one, two or three dimensional. You can only edit this on external samplers

  • The size of every axis: X, Y and Z, according to the grid order

  • The data type used by the grid. You can only edit this on external samplers.
    Unreal only allows us to use the following data types for the given grid orders:

1D and 2D 3D
  • float1

  • float2

  • float4

  • float1

  • float2

  • float4

  • int1

  • int2

  • int4

Asset grid mode

When using the Asset grid mode, you can specify the following properties:

  • sRGB: if true, render target has its sRGB flag force enabled (or disabled if false).
    Enable this if writes into the grid in the source effect(s) are not linear.

  • Render target asset: a 2D or volume (= 3D) render target.

UE GridRenderTarget

Available Blueprint functions

  • ReadGridValues: Reads the grid CPU sim data and outputs it in an array of the corresponding type.

    In Grid

    The grid attribute sampler to read from

    Data Type

    Data type of the grid. It determines the type of the output array

    Out values

    Array of the given data type containing the CPU data read from the grid

    Return value

    true if the read was successful, false otherwise

  • WriteGridValues: Writes an input array into the grid CPU sim data. The data type must match what the grid uses.

    In Grid

    The grid attribute sampler to write into

    Data Type

    Data type of the grid. It determines the type of the input array

    In values

    Array of the given data to write into the grid

    Return value

    true if the write was successful, false otherwise

    When starting/restarting an effect, PopcornFX spawn nodes (both read and write) are evaluated during the current frame. You need to wait for the next one to see their result in your grid. To wait for the next frame, you can use a Delay node with a duration of 0.0.
  • SetRenderTarget: Sets the render target asset. Only useful if the sampler uses the GPU sim

    Target

    The grid to set the render target to

    In render target

    The render target to set

  • SetAsMaterialTextureParamter: Sets the grid GPU data as a texture parameter for a Material. Only possible for float1, float2 and float4 data types

    Target

    The grid to get the GPU data from

    Material

    A Material Instance Dynamic to set the parameter to

    Parameter name

    The name of the parameter to set in the material

  • GetCellCount: Returns the number of cells in the grid: size X * size Y * size Z (unused dimensions have a size of 1)

  • GetDimensions: Returns the dimensions of the grid (size X, size Y and size Z) as a struct of 3 integers (unused dimensions have a size of 1)