Unity Products:Amplify Shader Editor/Sampler State

From Amplify Creations Wiki
Jump to navigation Jump to search

Back to Node List

Sampler State Node

The Sampler State node enables the user to create and use sampling states separately from texture samplers. This is of great importance since graphic APIs only allow 16 different samplers on a shader but up to 128 textures.
When using textures and sampling states coupled together, the user is inherently is setting a max texture count of 16.
Sampler states can be created inline over the shader by specifying a Wrap and Filter modes or can be retrieved from a Texture Object or Texture Sampler placed over the canvas either via the Reference dropdown or the Tex Input port.

NOTE: This feature is only available on Unity 2018.1 or higher and the Use Sampling Macros flag must be turned on over the Master Node properties.
More info can be found over Unity's official documentation page


Nodes used: Sampler State, Texture Sample

Node Parameter Description Default Value
Reference Specify if to create an inline sampler state or use an existing one
  • None: Creates an inline sampler with the options set on both Wrap Mode and Filter Mode
  • (Others): Selects a sampler state from an existing texture object.
None
Wrap Mode Selects a wrap mode to be used on an inline sampler state.
  • Repeat: Tiles the texture, creating a repeating pattern.
  • Clamp: Clamps the texture to the last pixel at the edge.
  • Mirror:(Only available on Unity 2018.3 or newer) Tiles the texture, creating a repeating pattern by mirroring it at every integer boundary.
  • Mirror Once:(Only available on Unity 2018.3 or newer) Mirrors the texture once, then clamps to edge pixels.
  • Per Axis:(Only available on Unity 2018.3 or newer) Allows defining separate wrap modes per axis
Repeat
U Axis Selects a wrap mode specific for the U Axis. Only visible when Per Axis option is set over Wrap Mode
  • Repeat Tiles the texture, creating a repeating pattern.
  • Clamp: Clamps the texture to the last pixel at the edge.
  • Mirror:(Only available on Unity 2018.3 or newer) Tiles the texture, creating a repeating pattern by mirroring it at every integer boundary.
  • Mirror Once:(Only available on Unity 2018.3 or newer) Mirrors the texture once, then clamps to edge pixels.
Repeat
V Axis Selects a wrap mode specific for the V Axis. Only visible when Per Axis option is set over Wrap Mode
  • Repeat Tiles the texture, creating a repeating pattern.
  • Clamp: Clamps the texture to the last pixel at the edge.
  • Mirror:(Only available on Unity 2018.3 or newer) Tiles the texture, creating a repeating pattern by mirroring it at every integer boundary.
  • Mirror Once:(Only available on Unity 2018.3 or newer) Mirrors the texture once, then clamps to edge pixels.
Repeat
Filter Mode Select a filter mode to be used on an inline sampler state
  • Point: Texture pixels become blocky up close.
  • Bilinear: Texture samples are averaged.
  • Triliniar: Texture samples are averaged and also blended between mipmap levels.
Bilinear
Aniso. Filtering Select an anisotropic filtering mode to be used on an inline sampler state. Only available on Unity 2021.2 and above.
  • None
  • X2
  • X4
  • X8
  • X16
None


NOTE: Mirror Once texture wrapping mode is not supported on most mobile GPUs/APIs, and will fallback to Mirror mode when support is not present.

Back to Node List