Image Atlas sampler

Atlas sampler

Sampling functions

Return type

Description

float4

SamplerName.sample(int textureId)
Samples the atlas and outputs the properties of the sub-UV rect at index SubRectID packed in a float4.
The float4 contains the atlas rect size in the xy components, and the top-left (min) atlas corner coordinates in the zw components.

float2

SamplerName.sampleTrim(int vertexId)
Samples the trimming data if available, outputs the float2 coordinates of the specified vertex.

float2

SamplerName.subUVToGlobalUV(int textureId, float2 uv)
Converts an UV inside an atlas tile to a global UV in the entire texture.

Properties

Return type

Description

int

SamplerName.atlasRectCount()
Returns the number of sub-rectangles in the texture atlas. Returns zero if there’s no atlas

int

SamplerName.trimmedVertexCount()
Returns the number of trimmed vertices per atlas tile

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.