Graphics.DrawMeshInstanced Doesn't work with transparent materials
Opaque:
Here is a quad that is rendered by Graphics.DrawMeshInstanced next to a cube with the same material. When I change the material type to transparent it doesn't get rendered. Is this a bug or am I missing something?
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();
}
Thank you.
screenshot-2021-03-14-135009.png
(289.2 kB)
screenshot-2021-03-14-135303.png
(397.8 kB)
Comment
Your answer
Follow this Question
Related Questions
Graphics.DrawMesh Leaking Mesh Memory 1 Answer
How could I implement a "border" system for my medieval game? 0 Answers
Making a mesh from a texture 0 Answers
Mesh & Shadow crash on Android platform build 0 Answers
Rotate a point around a mesh vertex 1 Answer