Search Unity

DrawMeshInstanced doesn't render shadows

Discussion in 'General Graphics' started by nikk98, Jun 12, 2022.

  1. nikk98

    nikk98

    Joined:
    Mar 8, 2021
    Posts:
    43
    I think that the two following calls should have the same result. However when called for the same gameobject, via two mono scripts, the first one renders shadows while the second one does not.

    I'm in Unity 2020.3.33f1.

    Am I missing something, or should I file a bug?

    Shadows:
    Code (CSharp):
    1.  
    2. Graphics.DrawMesh(
    3.        Mesh,
    4.        transform.localToWorldMatrix,
    5.         Material,
    6.         gameObject.layer,
    7.         null, /* properties */
    8.         0, /* subMeshIndex */
    9.         null, /* camera */
    10.         ShadowCastingMode.On,
    11.         false /* receiveShadows */);
    12.  
    No shadows:

    Code (CSharp):
    1.  
    2.     Graphics.DrawMeshInstanced(
    3.         Mesh,
    4.         0, /* subMeshIndex */
    5.         Material,
    6.         new[] {
    7.            transform.localToWorldMatrix
    8.         },
    9.         1, /* count */
    10.         null, /* properties */
    11.         ShadowCastingMode.On,
    12.         false, /* receiveShadows */
    13.         gameObject.layer,
    14.         null /* camera */);
    15.