drawmeshinstanced properties in custom renderpass only take first item

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

I’m using 2019.3.0b12 with the unlit shader

I make a copy of the unlit shader and removed _BaseColor and _BaseMap_ST from the CBUFFER_START(UnityPerMaterial) which should be shared properties per material ?
and added _BaseColor and _BaseMap_ST as a variable, but still it only takes the first value from materialproperyblock :confused:

Ok i managed to make the appropriate changes to my custom unlit shader,
if someone runs into this:

you define instance properties:

UNITY_INSTANCING_BUFFER_START(Props)
UNITY_DEFINE_INSTANCED_PROP(float4, _BaseMap_ST)
UNITY_DEFINE_INSTANCED_PROP(half4, _BaseColor)
UNITY_INSTANCING_BUFFER_END(Props)

and in the shader functions you can retrieve the properties with
UNITY_ACCESS_INSTANCED_PROP(Props,_BaseColor)

note that for tiling and scaling off the basetexture i had to skip TRANSFORM_TEX
and replace it with
output.uv = input.uv * UNITY_ACCESS_INSTANCED_PROP(Props,_BaseMap_ST).xy + UNITY_ACCESS_INSTANCED_PROP(Props,_BaseMap_ST).zw;