Search Unity

Question Getting correct InstanceID in ShaderGraph

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

  1. Epineurien

    Epineurien

    Joined:
    Mar 9, 2013
    Posts:
    45
    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?