Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Thursday, June 8, for a Q&A with Unity's Content Pipeline group here on the forum, and on the Unity Discord, and discuss topics around Content Build, Import Workflows, Asset Database, and Addressables!
    Dismiss Notice

Question Getting correct InstanceID in ShaderGraph

Discussion in 'Shader Graph' started by Epineurien, Mar 30, 2023.

  1. Epineurien

    Epineurien

    Joined:
    Mar 9, 2013
    Posts:
    44
    I'm working with Graphics.DrawMeshInstanced, and it seems that by default the InstanceID provided by shadergraph is the one internally used by the GPU, which wrap back arbitrarily to 0 - preventing instances from fetching their personalized data.

    Unity apparently has functions that can give back the "real" InstanceID from the value provided by the GPU, but I can't get any of them to work in a custom node, and all documentation/threads about it seems to be for non-Shadergraph shaders.

    Has anyone encountered and solved that problem?