Image

Overview

image
The texture sampler allows you to sample a 2D texture (luminance or RGBA), it is useful to encode particle properties (for example, for particles spawned on a mesh shape).
The sampler is stable/consistent, meaning that if you author a texture with some channels at full intensity or at full zero, even if the texture is in a compressed format, you’ll get exactly 1.0 or 0.0 when sampling them back, and not unprecise values like 1.0001, or 0.0001.
It can be used either through the image sampler script functions, or using the template core-library nodes, such as texture.sample.

Property

Type

Description

TextureResource

String

Path of the texture to be used, relative to the root of the project.

AtlasSource

enum

Specifies where the sampler fetches the atlas/sub-UV data

  • Procedural: atlas is defined by an u*v tile count

  • External: sampler will load an external atlas definition file (.pkat)

AtlasSubdiv

uint2

Number of sub-rectangles in the atlas, along each UV dimension.

AtlasDefinition

String

Optional path to a texture atlas file (see how to create atlas files), relative to the root of the project.
If a path is specified, will allow to sample sub-frames of the image independently, like in billboard renderers.

OutputType

enum

Determines if the sampler will sample the texture as an rgba or grayscale texture.

  • float: will sample as grayscale, the sample script function will return a float

  • float4: will sample as RGBA, the sample script function will return a float4

SampleRawValues

bool

If enabled, tells the image sampler to not perform any runtime conversions and to sample the raw texel data from the source texture.
Enable this if you want minimal runtime memory and performance overhead when loading the effect.
If enabled, and OutputType is float, will map the 'red' channel of the texture.

SourceGamma

enum

Gamma-space of the source texture.
Some texture formats explicitly encode the gamma-space, some others don’t.

  • Auto: tells the runtime to do its best and use the texture format specified in the texture, if any.

  • Linear

  • sRGB

OutputGamma

enum

Gamma-space you want the sampled values to be in.
If you plan on assigning the texels to color values, and your lighting-pipeline is gamma-correct / in linear space, use Linear.
Otherwise, use sRGB to get the values in sRGB space.

  • Linear

  • sRGB

DensityPower

float

Densities will be exponentiated with this value. It allows to quickly change the perceived "contrast" of the density map.

DensitySrc

enum

The density map will be built from the selected channel.

  • Red

  • Green

  • Blue

  • Alpha

  • RGBA_Average

DensityRGBAWeights

float4

if DensitySrc is set to RGBA_Average, these are the weights used for averaging.
They will be renormalized to 1 automatically.

Output pins

Data

dataImage

Image resource

+ all sampler properties