image/svg+xml
docs.unity.cn
  • Manual
  • Scripting API
  • Changelog
  • License
    Show / Hide Table of Contents
    • About Shader Graph
    • Getting started with Shader Graph
      • Creating a new Shader Graph Asset
      • My first Shader Graph
      • Shader Graph Window
        • Blackboard
        • Main Preview
        • Graph Inspector
      • Create Node Menu
      • Graph Settings Menu
      • Master Stack
      • Sticky Notes
      • Sub Graph
      • Color Modes
      • Precision Modes
      • Preview Mode Control
      • Custom Function Node
      • Shader Graph Preferences
      • Samples
    • Upgrade Guides
      • Upgrade to Shader Graph 10.​0.​x
    • Inside Shader Graph
      • Shader Graph Asset
      • Graph Target
      • Sub Graph Asset
        • Speed​Tree 8 Sub Graph Assets
      • Node
        • Port
        • Custom Port Menu
        • Edge
      • Property Types
      • Keywords
      • Data Types
      • Port Bindings
      • Shader Stage
      • Surface options
      • Custom Interpolators
    • Node Library
      • Artistic
        • Adjustment
          • Channel Mixer
          • Contrast
          • Hue
          • Invert Colors
          • Replace Color
          • Saturation
          • White Balance
        • Blend
          • Blend
        • Filter
          • Dither
        • Mask
          • Channel Mask
          • Color Mask
        • Normal
          • Normal Blend
          • Normal From Height
          • Normal From Texture
          • Normal Reconstruct Z
          • Normal Strength
          • Normal Unpack
        • Utility
          • Colorspace Conversion
          • Sub Graph Dropdown
      • Channel
        • Combine
        • Flip
        • Split
        • Swizzle
        • Branch On Input Connection
      • Input
        • Basic
          • Boolean
          • Color
          • Constant
          • Integer
          • Slider
          • Time
          • Float
          • Vector 2
          • Vector 3
          • Vector 4
        • Geometry
          • Bitangent Vector
          • Instance ID
          • Normal Vector
          • Position
          • Screen Position
          • Tangent Vector
          • UV
          • Vertex Color
          • Vertex ID
          • View Direction
          • View Vector
        • Gradient
          • Blackbody
          • Gradient
          • Sample Gradient
        • High Definition Render Pipeline
          • Diffusion Profile
          • Exposure
          • HD Scene Color
        • Lighting
          • Ambient
          • Baked GI
          • Reflection Probe
        • Matrix
          • Matrix 2x2
          • Matrix 3x3
          • Matrix 4x4
          • Transformation Matrix
        • Mesh Deformation
          • Compute Deformation
          • Linear Blend Skinning
        • PBR
          • Dielectric Specular
          • Metal Reflectance
        • Scene
          • Camera
          • Eye Index
          • Fog
          • Object
          • Scene Color
          • Scene Depth
          • Screen
        • Texture
          • Calculate Level Of Detail Texture 2D Node
          • Cubemap Asset
          • Gather Texture 2D Node
          • Sample Cubemap
          • Sample Reflected Cubemap
          • Sample Texture 2D
          • Sample Texture 2D Array
          • Sample Texture 2D LOD
          • Sample Texture 3D
          • Sample Virtual Texture
          • Sampler State
          • Split Texture Transform
          • Texel Size
          • Texture 2D Array Asset
          • Texture 2D Asset
          • Texture 3D Asset
      • Math
        • Advanced
          • Absolute
          • Exponential
          • Length
          • Log
          • Modulo
          • Negate
          • Normalize
          • Posterize
          • Reciprocal
          • Reciprocal Square Root
        • Basic
          • Add
          • Divide
          • Multiply
          • Power
          • Square Root
          • Subtract
        • Derivative
          • DDX
          • DDXY
          • DDY
        • Interpolation
          • Inverse Lerp
          • Lerp
          • Smoothstep
        • Matrix
          • Matrix Construction
          • Matrix Determinant
          • Matrix Split
          • Matrix Transpose
        • Range
          • Clamp
          • Fraction
          • Maximum
          • Minimum
          • One Minus
          • Random Range
          • Remap
          • Saturate
        • Round
          • Ceiling
          • Floor
          • Round
          • Sign
          • Step
          • Truncate
        • Trigonometry
          • Arccosine
          • Arcsine
          • Arctangent
          • Arctangent2
          • Cosine
          • Degrees To Radians
          • Hyperbolic Cosine
          • Hyperbolic Sine
          • Hyperbolic Tangent
          • Radians To Degrees
          • Sine
          • Tangent
        • Vector
          • Cross Product
          • Distance
          • Dot Product
          • Fresnel Effect
          • Projection
          • Reflection
          • Rejection
          • Rotate About Axis
          • Sphere Mask
          • Transform
        • Wave
          • Noise Sine Wave
          • Sawtooth Wave
          • Square Wave
          • Triangle Wave
      • Procedural
        • Noise
          • Gradient Noise
          • Simple Noise
          • Voronoi
        • Shapes
          • Ellipse
          • Polygon
          • Rectangle
          • Rounded Polygon
          • Rounded Rectangle
        • Checkerboard
      • Utility
        • Logic
          • All
          • And
          • Any
          • Branch
          • Comparison
          • Is Front Face
          • Is Infinite
          • Is Na​N
          • Nand
          • Not
          • Or
        • High Definition Render Pipeline
          • Emission
          • Eye
            • Circle​Pupil​Animation
            • Cornea​Refraction
            • Eye​Surface​Type​Debug
            • Iris​Limbal​Ring
            • Iris​Offset
            • Iris​Out​Of​Bound​Color​Clamp
            • Iris​UVLocation
            • Sclera​Iris​Blend
            • Sclera​Limbal​Ring
            • Sclera​UVLocation
        • Custom Function
        • Keyword
        • Preview
        • Sub Graph
      • UV
        • Flipbook
        • Polar Coordinates
        • Radial Shear
        • Rotate
        • Spherize
        • Tiling And Offset
        • Triplanar
        • Twirl
        • Parallax Mapping
        • Parallax Occlusion Mapping
      • Block Nodes
        • Built In Blocks
    • Manual
    • Node Library
    • Input
    • Texture
    • Sample Texture 2D Array

    Sample Texture 2D Array Node

    Description

    Samples a Texture 2D Array and returns a Vector 4 color value for use in the shader. You can override the UV coordinates using the UV input and define a custom Sampler State using the Sampler input. Use the Index input to specify which index of the array to sample.

    If you experience texture sampling errors while using this node in a graph which includes Custom Function Nodes or Sub Graphs, you can resolve them by upgrading to version 10.3 or later.

    NOTE: This Node can only be used in the Fragment shader stage.

    Ports

    Name Direction Type Binding Description
    Texture Array Input Texture 2D Array None Texture 2D Array to sample
    Index Input Float None Index of array to sample
    UV Input Vector 2 UV UV coordinates
    Sampler Input Sampler State Default sampler state Sampler for the texture
    RGBA Output Vector 4 None Output value as RGBA
    R Output Float None red (x) component of RGBA output
    G Output Float None green (y) component of RGBA output
    B Output Float None blue (z) component of RGBA output
    A Output Float None alpha (w) component of RGBA output

    Controls

    Name Type Options Description
    Enable Global Mip Bias Toggle On, Off Enables the global mipmap bias that Unity automatically imposes at runtime. Unity sets this bias during certain dynamic resolution scaling algorithms to improve detail reconstruction.

    Generated Code Example

    The following example code represents one possible outcome of this node.

    float4 _SampleTexture2DArray_RGBA = SAMPLE_TEXTURE2D_ARRAY(Texture, Sampler, UV, Index);
    float _SampleTexture2DArray_R = _SampleTexture2DArray_RGBA.r;
    float _SampleTexture2DArray_G = _SampleTexture2DArray_RGBA.g;
    float _SampleTexture2DArray_B = _SampleTexture2DArray_RGBA.b;
    float _SampleTexture2DArray_A = _SampleTexture2DArray_RGBA.a;
    

    对文档有任何疑问,请移步至开发者社区提问,我们将尽快为您解答
    In This Article
    • Description
    • Ports
    • Controls
    • Generated Code Example
    Back to top Copyright © 2020 Unity Technologies
    Generated by DocFX
    on 08 September 2021