Hello!
I’m trying to render meshes with shader graph shaders from a custom render pass using CommandBuffer.DrawMeshInstancedIndirect
.
I’m passing my positions to the shader via a StructuredBuffer
defined in a custom function node. I index the buffer with the instance id and return the position, that gets added to the object space vertex position. This works great, but it renders all of my objects on the same position (the first one in the buffer).
I checked the draw command with Renderdoc and it was indexing the buffer for every instance with 0 instead of the instance id.
I was able to make it work without shader graphs, using SV_InstanceID
, but i would really love to get it working with shader graphs.
I also got multiple objects to render with DrawMeshInstanced
, using shader graphs, but then i’m not able to use compute buffers to provide the count and I also have to make a long array of matrices. However the instance id worked that time.
I attached some pictures to hopefully make it more understandable. Any ideas what I’m doing wrong? (I selected instance 24 in the Renderdoc picture)