Rendering Procedural Meshes in Shader Graph

Hello, I’m trying to render a procedural mesh in HDRP whose vertex data is generated in a compute buffer. I’ve been able to access the default Lit HDRP shader code, duplicate and change it to read my buffer, And use Graphics.DrawProcedural() to render it. But I don’t have a lot of control over the texturing with the default Lit shader.
This is what it looks like ATM:

For example I want to use the vertex colors to blend between different textures, use tri-planar mapping to add details and so on. I thought the best way to this would be with shader graph, but I have no idea how to override the vertex data in there.

I tried to plug in the code which worked on my custom Lit shader, as a custom function:

float4x4 transformMatrix;
struct Point {
    float3 vertex;
    float3 normal;
    float2 uv;
    float4 color;
};
StructuredBuffer<Point> points;
StructuredBuffer<int> triangles;

// Vertex input attributes
struct Input
{
    uint vertexID : SV_VertexID;
    UNITY_VERTEX_INPUT_INSTANCE_ID
};

// Custom vertex shader
PackedVaryingsType CustomVert(Input input)
{
    int i = triangles[input.vertexID];
    float4 position = float4(points[i].vertex, 1);

    float3 pos = mul(transformMatrix, position);
    float3 normal = mul((float3x3)transformMatrix, points[i].normal);
    float2 uv = points[i].uv;
    float2 color = points[i].color;

    // Imitate a common vertex input.
    AttributesMesh am;
    am.positionOS = pos;
#ifdef ATTRIBUTES_NEED_NORMAL
    am.normalOS = normal;
#endif
#ifdef ATTRIBUTES_NEED_TANGENT
    am.tangentOS = 0;
#endif
#ifdef ATTRIBUTES_NEED_TEXCOORD0
    am.uv0 = float4(uv, 0, 0);
#endif
#ifdef ATTRIBUTES_NEED_TEXCOORD1
    am.uv1 = 0;
#endif
#ifdef ATTRIBUTES_NEED_TEXCOORD2
    am.uv2 = 0;
#endif
#ifdef ATTRIBUTES_NEED_TEXCOORD3
    am.uv3 = 0;
#endif
#ifdef ATTRIBUTES_NEED_COLOR
    am.color = 0;
#endif
    UNITY_TRANSFER_INSTANCE_ID(input, am);

    VaryingsType varyingsType;
    varyingsType.vmesh = VertMesh(am);
    return PackVaryingsType(varyingsType);
}

but it gives me a “PackedVaryingsType is an unrecognized identifier” error.
How can I render a procedural mesh in shader graph?

I believe I’m dealing with a similar problem, although I don’t get the error Can't get Vertex ID node to work, what am I missing?

That being said I believe your CustomVert function doesn’t have the required definition, at least I have only seen custom functions being like void MyCustomHLSLFunction_float(float input, float input2, out float output)

And I don’t believe you can output custom data structures, only the supported types, but you can have multiple outputs ofc.

Anyways if you get it to work pls tell me cause I’m also trying to figure this out. I’ll do the same ofc

update: if you look at the code in my post, turns out you shouldn’t cast vertexId to int; buuut, although I can see my geometry the color is still not right