docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Sample Element Texture node

    Note

    Use this node only in shaders with Material set to UI for UI Toolkit. Using it elsewhere can lead to unexpected behavior or errors. For information on how to create shaders for UI Toolkit, refer to UI Shader Graph.

    The Sample Element Texture node samples a texture at specific UV coordinates. You can use this node to get multiple samples of the texture assigned to the element, for example to create complex visual effects or manipulate the texture.

    Sampling multiple times with this node is more efficient than using several separate nodes for individual samples. This is because each node introduces overhead by traversing internal branches to select the correct texture slot. By combining multiple samples into a single node, you reduce this overhead and improve performance. Use the Sample Count setting to control how many samples the node takes.

    Limitations

    With its default settings, this node can only connect to a Block node in the Fragment Context of a Shader Graph. To sample a Texture for the Vertex Context of a Shader Graph, set the Mip Sampling Mode to LOD.

    Ports

    The node has a pair of UV input and Color output ports for each sample. The number of pairs matches the Sample Count setting, and the ports are numbered from 0 to Sample Count − 1. By default, the node has four samples (UV 0 to UV 3 and Color 0 to Color 3).

    Name Direction Type Description
    UV n Input Vector2 The UV coordinates for sample n.
    Sampler Input Sampler State The Sampler State to use when sampling. If you leave this port unconnected, the node uses the element texture's own sampler.
    LOD Input Float The mip level to sample. This port only appears when Mip Sampling Mode is LOD.
    Color n Output Color The color sampled at UV n.

    Additional node settings

    The Sample Element Texture node has some additional settings that you can access from the Graph Inspector:

    Name Description
    Sample Count The number of samples the node takes, between 1 and 32. The node displays one UV input port and one Color output port per sample.
    Mip Sampling Mode Controls how the node selects the texture mip level. The options are:
    • Standard: The GPU calculates the mip level from screen-space derivatives. You can only use this mode in the Fragment Context.
    • LOD: You specify the mip level explicitly through the LOD input port. Use this mode to sample the texture in the Vertex Context.

    Additional resources

    • Introduction to UI Shader Graph
    In This Article
    Back to top
    Copyright © 2026 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)