Search Unity

How to ...Graphics.Drawprocedural using complex data structure

Discussion in 'Shaders' started by lsonic, Feb 14, 2019.

  1. lsonic

    lsonic

    Joined:
    Apr 15, 2013
    Posts:
    2
    Hi All!

    I'm working on hair.. I was able to generate hair strips from line segments and extra hairs using bilinear interpolation using AppenedStructureBuffer, simply adding the newly generated vertices in compute shader also extend them to triangle strips.. Its just works fine, I can draw it using Graphics.Drawprocedural... but when I started generating uv-s and normals I realized that i need to generate vertex positions, uv-s and normals into a single buffer because if they are in separet buffers and calling append in the same loop to each buffer - because of compute shaders parallel processing - could end up in a different vertex index... so single structure and a single append call is necessary for this to make this work... and then the question is how to draw it if my struct is not only float3 stream but contains uv and normal data like:
    struct myVertexData {
    float3 pos;
    float2 uv;
    float3 normal;
    };
    Maybe Graphics.DrawproceduralIndirect? There is an 'argsOffset' parameter but I cant really understand what this is for...

    Thanks for Help!