PopcornFX v2.19

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
  1. Home
  2. Docs
  3. PopcornFX v2.19
  4. Scripting reference
  5. Samplers
  6. Grid sampler

Grid sampler

Sampling functions

Return typeDescription
int4SamplerName.dimensions()
Returns an int4 containing the grid dimensions.
Grids with less than 4 dimensions have a dimension of 1 in the unused axes.
For example, a 128×128 2D grid will have a dimension of int4(128, 128, 1, 1)
intSamplerName.type()
Returns the data type of the grid as a compile-time constant.

  • 0: Grid contains float values
  • 1: Grid contains float2 values
  • 2: Grid contains float3 values
  • 3: Grid contains float4 values
  • 4: Grid contains int values
  • 5: Grid contains int2 values
  • 6: Grid contains int3 values
  • 7: Grid contains int4 values
int#
float#
SamplerName.read(int cellIndex)
Reads the value from a cell of the grid.
cellIndex is the flat index of the cell to read, in the `[0, dimensions.x * dimensions.y * dimensions.z * dimensions.w]` range.
The return type matches the data type of the grid.
voidSamplerName.write(int cellIndex, int# value[, bool enabled = true]);
SamplerName.write(int cellIndex, float# value[, bool enabled = true]);
Writes a value to a cell of the grid.
cellIndex is the flat index of the cell to write, in the `[0, dimensions.x * dimensions.y * dimensions.z * dimensions.w]` range.
The input value type should match the data type of the grid.
voidSamplerName.atomicAdd(int cellIndex, int value[, bool enabled = true])
Performs an integer atomic add on the grid.
Only supports grids of type int, does not support float or vector grids.
voidSamplerName.atomicMin(int cellIndex, int value[, bool enabled = true])
Performs an integer atomic min on the grid.
Only supports grids of type int, does not support float or vector grids.
voidSamplerName.atomicMax(int cellIndex, int value[, bool enabled = true])
Performs an integer atomic max on the grid.
Only supports grids of type int, does not support float or vector grids.

 

Note: These are describing the reference implementation. When using attribute samplers, the behavior of these functions can vary depending on the implementation in the game-engine where the effect is loaded.

Was this article helpful to you? Yes No

How can we help?