Graphics.DrawMeshInstanced Doesn't work with transparent materials

Im trying to render multiple quads using Graphics.DrawMeshInstanced. It works fine with opaque materials but when I change the surface type to transparent it doesn’t render. (using HDRP btw)
Here are some screenshots demonstrating the issue. Note the cube above the quad using the same material.
Opaque:

Transparent:

Here is the code:

 private void RenderClouds() {
         cloudMaterial.SetFloat(cloudsWorldPosName, transform.position.y);
         cloudMaterial.SetFloat(cloudsHeightName, cloudsHeight);
         _offset = cloudsHeight / cloudsResolution / 2f;
         var initPos = transform.position + (Vector3.up * (_offset * cloudsResolution / 2f));
         for (var i = 0; i < cloudsResolution; i++) {
             _cloudsPosMatrix = Matrix4x4.TRS(initPos - (Vector3.up * _offset * i), transform.rotation, transform.localScale);
             _cloudMatrices.Add(_cloudsPosMatrix);
         }
         Graphics.DrawMeshInstanced(cloudMesh, 0, cloudMaterial, _cloudMatrices.ToArray(), cloudsResolution);
         _cloudMatrices.Clear();
     }

Is this a bug or am I missing something?
Thank you.

1 Like

I also noticed this and not sure if it’s a bug or if I’m missing something. Hopefully someone more knowledgeable can reply with an answer.

Edit:
Apparently it is in fact a bug:
Bug - DrawMeshInstanced not working with transparent - Unity Forum

1 Like