docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Data Types

    Description

    There are a number of Data Types in Shader Graph. Each Port on a Node has an associated Data Type that defines what edges can be connected to it. The Data Types have colors for usability, these colors are applied to ports and edges of that Data Type.

    Some Data Types have associated Property Types for exposing these values to the Inspector for Materials that use the shader.

    Data Types

    Name Color Description
    Float Light Blue A Float or scalar value
    Vector 2 Green A Vector 2 value
    Vector 3 Yellow A Vector 3 value
    Vector 4 Pink A Vector 4 value
    Dynamic Vector Light Blue See Dynamic Data Types below
    Matrix 2 Blue A Matrix 2x2 value
    Matrix 3 Blue A Matrix 3x3 value
    Matrix 4 Blue A Matrix 4x4 value
    Dynamic Matrix Blue See Dynamic Data Types below
    Dynamic Blue See Dynamic Data Types below
    Boolean Purple A Boolean value. Defined as a float in the generated shader
    Texture 2D Red A Texture 2D asset
    Texture 2D Array Red A Texture 2D Array asset
    Texture 3D Red A Texture 3D asset
    Cubemap Red A Cubemap asset
    Virtual Texture Gray A Texture Stack
    Gradient Gray A Gradient value. Defined as a struct in the generated shader
    SamplerState Gray A state used for sampling a texture

    Promoting/Truncating

    All Vector types can be promoted or truncated to match any Vector type Port. This behaviour occurs only when the Port in question is not of type Dynamic Vector. When truncating, excess channels are simply removed. When promoting, the extra required channels are filled by default values. These values are (0, 0, 0, 1).

    Dynamic Data Types

    Some Data Types are dynamic. This means a port using these Data Types can change their underlying Concrete Data Type based on what Data Type is connected to it. By default, Nodes using dynamic Data Types can only have one Concrete Data Type, meaning that once a connected edge has applied its Data Type to that port, all other Dynamic Data Type slots of that Node will apply the same Data Type.

    One notable exception to this is the Multiply Node which allows both Dynamic Matrix and Vector types.

    Dynamic Vector

    The Dynamic Vector type allows connected edges of any Vector type. All connected edges are automatically truncated to the type with the lowest dimension, unless the lowest dimension is 1, in which case the Float is promoted.

    Dynamic Matrix

    The Dynamic Matrix type allows connected edges of any Matrix type. All connected edges are automatically truncated to the type with the lowest dimension.

    Dynamic

    The Dynamic type is a special case. Nodes that support it must define how it is validated. In the case of the Multiply Node, it allows connections of any Vector or Matrix type, ensuring the correct multiplication is applied depending on the mix of Data Types.

    In This Article
    • Description
    • Data Types
    • Promoting/Truncating
    • Dynamic Data Types
      • Dynamic Vector
      • Dynamic Matrix
      • Dynamic
    Back to top
    Copyright © 2025 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)