PopcornFX v2.16

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

Texture sampler

Texture sampler

Sampling functions

Return typeDescription
inttextureFilter enumeration

  1. textureFilter.point: No interpolation (nearest sample)
  2. textureFilter.linear: Linear interpolation between the 4 nearest texels
inttextureAddr enumeration

  1. textureAddr.clamp: Clamps UV coordinates to the [0, 1] range
  2. textureAddr.wrap: Wraps UV coordinates that are outside the [0, 1] range back into [0, 1] (“Repeat” mode)
float4SamplerName.sample(float2 uv [, int filterMode [, int wrapMode]])
Samples a texel on the texture at the specified UV coordinates in parameter uv.
float4SamplerName.sample(float subRectId, float2 uv [, int filterMode [, int wrapMode]])
Samples a texel on the texture atlas at the specified UV coordinates in parameter uv and atlas tile subRectId.
subRectId is in the [0, atlasRectCount-1] range
float2SamplerName.remapDensity(float2 uv [, int filterMode [, int wrapMode]])
Builds a new UV from the input uv so that the final UV distribution matches the density of the texture.
float2SamplerName.remapDensity(float subRectId, float2 uv [, int filterMode [, int wrapMode]])
Builds a new UV from the input uv so that the final UV distribution matches the density of the texture atlas tile subRectId.
subRectId is in the [0, atlasRectCount-1] range
float2SamplerName.sampleDensity([int filterMode [, int wrapMode]])
Builds a random UV coordinate so that the final UV distribution matches the density of the texture.
float2SamplerName.sampleDensity(float subRectId [, int filterMode [, int wrapMode]])
Returns a float2 containing the texture texel dimensions.
(can be just an abstract aspect ratio if the sampler is an attribute sampler overriden by the game engine and is a procedural ‘infinite’ texture rather than a physical texture).

 

Properties

Return typeDescription
float2SamplerName.dimensions()
Returns a float2 containing the texture texel dimensions.
intSamplerName.atlasRectCount()
Returns the number of sub-rectangles in the texture atlas. Returns zero if there’s no atlas.

 

Disclaimer: 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?