I’m creating a procedural mesh that currently only has vertices (which are bound to the POSITION vertex shader input semantic). Today I realized that I needed an additional 3-dimensional vertex per vertex. It’s not a normal, not a tangent, not even a color. It has a meaning that’s very specific to my application (basically I’m doing some real time GPU raymarching), and thus, I can’t use the available Mesh fields:
- uv/uv1/uv2: Because they are 2-dimensional
- normal/tangent/colors: I might need them in the future. Also I don’t know if unity normalizes or clamps the values in these buffers to [-1,1] (and I wouldn’t be surprised if they did without any notice, after I found out vertices are scaled on CPU before being sent to GPU).
- position: Because they are in a different space than the space of the vertices that I need; a transform may be applied to them but that would be a stupid way to waste GPU cycles.
So, are there any alternatives here? Is there a more advanced Mesh class that gives me more control over the VBO? Or, even better, is there a way for me to create my own VBO and populate it with my custom data?