Object Node | Shader Graph | 7.2.1
docs.unity3d.com
    Show / Hide Table of Contents

    Object Node

    Description

    Provides access to various parameters of the currently rendering Object.

    Note: The behaviour of the Position Port can be defined per Render Pipeline. Different Render Pipelines may produce different results. If you're building a shader in one Render Pipeline that you want to use in both, try checking it in both pipelines before production.

    Unity Render Pipelines Support

    • Universal Render Pipeline

    The High Definition Render Pipeline does not support this Node.

    Ports

    Name Direction Type Binding Description
    Position Output Vector 3 None Object position in world space
    Scale Output Vector 3 None Object scale in world space

    Generated Code Example

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

    float3 _Object_Position = SHADERGRAPH_OBJECT_POSITION;
    float3 _Object_Scale = float3(length(float3(UNITY_MATRIX_M[0].x, UNITY_MATRIX_M[1].x, UNITY_MATRIX_M[2].x)),
                                 length(float3(UNITY_MATRIX_M[0].y, UNITY_MATRIX_M[1].y, UNITY_MATRIX_M[2].y)),
                                 length(float3(UNITY_MATRIX_M[0].z, UNITY_MATRIX_M[1].z, UNITY_MATRIX_M[2].z)));
    
    In This Article
    • Description
    • Ports
    • Generated Code Example
    Back to top
    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