Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How to batch?

Discussion in 'High Definition Render Pipeline' started by Roggi_, Apr 22, 2021.

  1. Roggi_

    Roggi_

    Joined:
    May 14, 2014
    Posts:
    84
    Hi, Iam a bit confused about the current state of batching in HDRP.

    I have a large forest scene that I am trying to optimize. The trees have a custom shader made with shadergraph, each varying in the main texture for different kinds of trees.

    How do I batch this? Should the trees be marked as batching static? Should the Materials be set to gpu instancing. Or should I do nothing and let the SRP batcher do it's thing? Could someone recommend a correct setup?
     
  2. apkdev

    apkdev

    Joined:
    Dec 12, 2015
    Posts:
    277
    AFAIK the GPU Instancing checkbox does nothing when you have the SRP Batcher enabled. Objects that use the same shader (or rather, same shader variant, so keywords can affect this) should already be batched by the SRP batcher. If everything's working correctly, you should see batching happening in the frame debugger.

    Anyway, regarding optimization in general - have you established whether you're CPU or GPU bound?
     
  3. Roggi_

    Roggi_

    Joined:
    May 14, 2014
    Posts:
    84
    Thanks, SRP is visible in the frame debugger. So I guess there is nothing more I can do to improve that.

    Iam focusing on the gpu side of things now, though an issue for me is a large object count in the scene.
    There is about 30k trees in my scene and iam placing them during runtime with object pooling around the camera, but that would prevent me from using static batching since srp is doing it's thing.
     
  4. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,727
    Seems like you need to Optimize. 30k trees is alot, even though your pooling them. What shaders are you using for the trees?. You could try using a Mobile Based Shader, with gpu instancing...