Search Unity

DrawMeshInstanced, How to sort z depth?

Discussion in 'General Graphics' started by valtteri_m, Sep 14, 2020.

  1. valtteri_m

    valtteri_m

    Joined:
    Aug 6, 2014
    Posts:
    15
    I'm instancing bunch of planes, but shadows get placed in the wrong order with them, because apparently with Graphics.DrawMeshInstanced they dont get sorted for transparency or z efficiency.
    How am I supposed to sort them manually then?
     

    Attached Files:

  2. valtteri_m

    valtteri_m

    Joined:
    Aug 6, 2014
    Posts:
    15
    Okay I got it working!

    I had to add these to my ShadowCaster pass as well:

    #pragma multi_compile_instancing
    UNITY_VERTEX_INPUT_INSTANCE_ID
    UNITY_SETUP_INSTANCE_ID(v);