docs.unity3d.com
  • 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 Tab
      • 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
      • 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
          • Main Light Direction
          • 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
          • Branch On Input Connection
          • 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
          • Fabric
            • Thread​Map​Detail
          • UVCombine
        • Custom Function
        • Keyword
        • Preview
        • Subgraph
        • Subgraph Dropdown node
      • 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
    • Channel
    • Swizzle

    Swizzle Node

    Description

    Creates a new vector from the reordered elements of the input vector. This is called swizzling.

    To specify how input elements should be swizzled, enter a formatting string in the input mask. To invert the order of the input elements, for example, use the string "wzyx" or "abgr".

    The length of the input mask determines the dimensions of the output vector. The error "Invalid Mask" indicates an input mask value which includes one or more channels that do not exist in the input vector.

    To output a vector3 with the x, y and z elements of the input vector, for example, use the input mask “xyz” or “rgb”.

    Ports

    Name Direction Type Binding Description
    In Input Dynamic Vector None Input value
    Out Output Dynamic Vector None Output value

    Controls

    Name Type Options Description
    Mask Inputfield x, y, z, w (depending on input vector dimension) The swizzle mask is a combination of one to four characters that can be x, y, z, w (or r, g, b, a). The size of output value depends on the length of the mask input.

    Generated Code Example

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

    float4 _Swizzle_Out = In.wzyx;
    
    In This Article
    • Description
    • Ports
    • Controls
    • Generated Code Example
    Back to top
    Terms of use
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023