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

Probuilder and GPU Instancing/Batching

Discussion in 'World Building' started by BentiGorlich, Aug 4, 2021.

  1. BentiGorlich

    BentiGorlich

    Joined:
    Jun 30, 2021
    Posts:
    21
    Hello everyone,

    I built a fence with probuilder and made a prefab for the inner poles, so it can be instanced. But the instanced objects overwrite the "mesh" property, so I'm thinking that it still uses different meshes -> can't use batching.
    Am I correct and if so, what would be the solution?
     
  2. kaarrrllll

    kaarrrllll

    Unity Technologies

    Joined:
    Aug 24, 2017
    Posts:
    552
    You can use the Export action to create a Mesh asset that is able to be instanced and batched without interference from the ProBuilderMesh component.
     
  3. BentiGorlich

    BentiGorlich

    Joined:
    Jun 30, 2021
    Posts:
    21
    So my assumtion is correct, that the pro builder meshes don't get batched?
     
  4. kaarrrllll

    kaarrrllll

    Unity Technologies

    Joined:
    Aug 24, 2017
    Posts:
    552
    Do you mean batching or instancing? ProBuilder meshes can by statically or dynamically batched without issue. They cannot however be instanced, as a unique mesh is instantiated for each component.
     
  5. BentiGorlich

    BentiGorlich

    Joined:
    Jun 30, 2021
    Posts:
    21
    I mean batched. I created a fence and thought that the fence might cause a lot of drawcalls, because each plank on the fence was its own probuilder mesh
     
  6. kaarrrllll

    kaarrrllll

    Unity Technologies

    Joined:
    Aug 24, 2017
    Posts:
    552
    Ok, then assuming that each plank is using the same material and is flagged as batching static, they are eligible for batching.
     
  7. BentiGorlich

    BentiGorlich

    Joined:
    Jun 30, 2021
    Posts:
    21
    yes they are, but I am using hdrp, so static batching would be inferior to the batching in srp (if I understood that correctly, because it is far from well documented). I cannot really tell, because I learnt about that not that long ago. And the stats window in the editor is still broken regarding srp batching.