Page 1 of 1

Access UNITY_VERTEX_INPUT_INSTANCE_ID

PostPosted: Thu Jan 24, 2019 1:20 am
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

Re: Access UNITY_VERTEX_INPUT_INSTANCE_ID

PostPosted: Fri Jan 25, 2019 3:09 pm
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.

Re: Access UNITY_VERTEX_INPUT_INSTANCE_ID

PostPosted: Fri Jan 25, 2019 7:55 pm
by mrmcd
Oh wow, guess I'm super lucky. Thanks for the answer.

Out of curiosity, was it impossible before?

Re: Access UNITY_VERTEX_INPUT_INSTANCE_ID

PostPosted: Mon Jan 28, 2019 4:33 pm
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!

Re: Access UNITY_VERTEX_INPUT_INSTANCE_ID

PostPosted: Fri Feb 01, 2019 3:03 am
by mrmcd
Thanks for the information. Everything worked great!

Re: Access UNITY_VERTEX_INPUT_INSTANCE_ID

PostPosted: Fri Feb 01, 2019 4:54 pm
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!