- Home /
Data for each vertex from Material properties?
I need to get data into the vertex shader, specified somehow efficiently in the Material properties.
Background: I want to pass in precomputed data so I can exchange the float3 needed to offset the vertices in the vertex shader. I don't want to create seperate meshes either, so vertex colors and any other common way to pass in data (uv.zw, tangent, color, ...) isn't suitable for me.
I got some ideas that likely would work, but the most suitable one requires me to get the vertex index in the vertex shader and fetch my data from a texture. Any idea how I can get the vertex index? I found a resource here, but I'm not an expert with shaders and I could totally miss something. The alternative would be to sacrifice the second uv channel and set the uvs appropriately to get the right information for each vertex.
Is the first choice possible, and if yes, what is most preferrable performance wise?
Your answer
![](https://koobas.hobune.stream/wayback/20220611233115im_/https://answers.unity.com/themes/thub/images/avi.jpg)