Access UNITY_VERTEX_INPUT_INSTANCE_ID

Node-based Shader Editor
Post Reply
mrmcd
Posts: 3
Joined: Thu Jan 24, 2019 1:16 am

Access UNITY_VERTEX_INPUT_INSTANCE_ID

Post by mrmcd »

Hi ASE Community!

I created a shader that is drawn by Graphics.DrawMeshInstanced, and I need to have different variables for the instances. To differentiate in the shader I need to access UNITY_VERTEX_INPUT_INSTANCE_ID to use it as array index for my custom data.

How can I access UNITY_VERTEX_INPUT_INSTANCE_ID?
(https://docs.unity3d.com/Manual/GPUInstancing.html)

Best regards,
mrmcd
User avatar
Amplify_Borba
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Access UNITY_VERTEX_INPUT_INSTANCE_ID

Post by Amplify_Borba »

Hello, thank you for getting in touch and for your support!

You're in luck, as we've just added an 'Instance ID' node in a build that was released this week:

Image

Please ensure that you're using the latest version currently available from our website, and do let us know if you come across any issues.
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
mrmcd
Posts: 3
Joined: Thu Jan 24, 2019 1:16 am

Re: Access UNITY_VERTEX_INPUT_INSTANCE_ID

Post by mrmcd »

Oh wow, guess I'm super lucky. Thanks for the answer.

Out of curiosity, was it impossible before?
User avatar
Amplify_Borba
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Access UNITY_VERTEX_INPUT_INSTANCE_ID

Post by Amplify_Borba »

No problem, happy to help!

I don't think that there was any way to access that data before, not even outside of the scope of our editor, which is also why I said in my previous reply that you were in luck.

Please let us know if you have any further questions, thanks!
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
mrmcd
Posts: 3
Joined: Thu Jan 24, 2019 1:16 am

Re: Access UNITY_VERTEX_INPUT_INSTANCE_ID

Post by mrmcd »

Thanks for the information. Everything worked great!
User avatar
Amplify_Borba
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Access UNITY_VERTEX_INPUT_INSTANCE_ID

Post by Amplify_Borba »

Glad to help!

Have you had the chance to rate and review Amplify Shader Editor? It would be awesome if you could share your experience with the Unity community, every bit helps and your feedback is extremely valuable to us.

Feel free to get back in touch if you have further issues or questions, thanks!
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
Post Reply