Search Unity

Discussion Sorting Order seems to break material batching

Discussion in 'General Graphics' started by weiner_monkey, Mar 8, 2023.

  1. weiner_monkey

    weiner_monkey

    Joined:
    Aug 1, 2022
    Posts:
    49
    I've looked at some posts online where its mentioned sorting order has no effect on gpu instanced or shared material. I have a scene that has GPU instanced objects and some non-instanced objects that are batched with default sorting order (0). Incrementing the sorting order by one for each in this order:

    Instanced - 0
    Non-Instanced - 1
    Instanced - 2
    Non-Instanced - 3
    Instanced - 4
    Non-Instanced - 5

    In RenderDoc, the shader is switched each time between calls as well as the buffer bind, which breaks the purpose of instancing. To me this seems like expected behavior, but I just see claims of it having no effect on instancing. Am I forgetting something here?
     
  2. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,048
    Last time I heard about it someone did say it affected it. If you don't draw the same material at the same time it cannot batch it together