I’m experimenting a bit with custom renderfeatures.
i want do draw some quads onscreen via drawmeshinstanced.
this works as expected except for the materialpropertyblock
in code below, both meshes get the properties from index 0, both are rendered in geen.
CommandBuffer cmd = CommandBufferPool.Get(k_RenderTag);
cmd.SetViewProjectionMatrices(Matrix4x4.identity, Matrix4x4.identity);
Matrix4x4[ ] matrices = new Matrix4x4[2];
Vector4[ ] tilings = new Vector4[2];
Vector4[ ] colors = new Vector4[2];
matrices[0].SetTRS(new Vector3(0.1f,0,0),Quaternion.identity,new Vector3(28.0f/Screen.width,54.0f/Screen.height,1));
matrices[1].SetTRS(new Vector3(-0.1f,0,0),Quaternion.identity,new Vector3(28.0f/Screen.width,54.0f/Screen.height,1));
tilings[0]=new Vector4(0.03125f, 0.125f, 1*0.03125f, 5*0.125f );
tilings[0]=new Vector4(0.03125f, 0.125f, 3*0.03125f, 5*0.125f );
colors[0]=Color.green;
colors[1]=Color.red;
mat_properies.SetVectorArray("_BaseColor", colors);
mat_properies.SetVectorArray( "_BaseMap_ST", tilings );
cmd.DrawMeshInstanced(m_mesh, 0, m_material,0,matrices,2,mat_properies);
is this a bug or am I setting materialproperties for incorectly ?
I was under the impression i could draw instances with different shaderproperties this way.
kind regards,
Rob