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.


    Did you find this page useful? Please give it a rating:

    Thanks for rating this page!

    Report a problem on this page

    What kind of problem would you like to report?

    • This page needs code samples
    • Code samples do not work
    • Information is missing
    • Information is incorrect
    • Information is unclear or confusing
    • There is a spelling/grammar error on this page
    • Something else

    Thanks for letting us know! This page has been marked for review based on your feedback.

    If you have time, you can provide more information to help us fix the problem faster.

    Provide more information

    You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:

    You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:

    You've told us there is information missing from this page. Please tell us more about what's missing:

    You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:

    You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:

    You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:

    You've told us this page has a problem. Please tell us more about what's wrong:

    Thank you for helping to make the Unity documentation better!

    Your feedback has been submitted as a ticket for our documentation team to review.

    We are not able to reply to every ticket submitted.

    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)