Search Unity

SRP. Why batching through material?

Discussion in 'General Graphics' started by StrongCube, May 24, 2019.

  1. StrongCube

    StrongCube

    Joined:
    Nov 22, 2016
    Posts:
    50
    Hello developers.

    I have a question.

    Why SRP instead of combining in one pass, divides them into three? With that there is one material, one texture?

    This is because a limit of vertices, the distance?

    How can we improve the situation?

    upload_2019-5-24_19-25-49.png

    Vertices:
    upload_2019-5-24_19-27-6.png
     
  2. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,028
    The profiler provides information on why it's not bacthed together.
    On the last two screenshots it says "SRP: Node have different shaders".
     
  3. StrongCube

    StrongCube

    Joined:
    Nov 22, 2016
    Posts:
    50
    So he writes because on top of ANOTHER SHADER, this question is why it splits into three and shuffles, not batching in one pass?
     
  4. StrongCube

    StrongCube

    Joined:
    Nov 22, 2016
    Posts:
    50
    Look at the screenshots, I've marked in red the same Shader, the same material. But he draws three times instead of one.
     
  5. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    But there are 2 more draw calls in between the ones you highlighted. Presumably those use different shaders, thus splitting the batches.

    It's hard to say why things got ordered in this way without knowing much more about your scene.
     
  6. StrongCube

    StrongCube

    Joined:
    Nov 22, 2016
    Posts:
    50
    True.

    On what principle does it divide objects? Distance from each other? In the hierarchy?

    Example:

    There are 6 groups of objects on the stage.

    3 groups have different shaders (* * *)
    3 groups have the same Shader and material (+ + +)

    According to the logic they need to join together in a 4 rendering.
    *
    *
    *
    + + + (batching)

    Right? And it turns out:

    +
    *
    +
    *
    +
    *
     
  7. StrongCube

    StrongCube

    Joined:
    Nov 22, 2016
    Posts:
    50
    Up. I wait.
     
  8. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285