Search Unity

Best practices for batching materials across multiple room tiles?

Discussion in 'General Graphics' started by Reverend-Speed, Mar 20, 2021.

  1. Reverend-Speed

    Reverend-Speed

    Joined:
    Mar 28, 2011
    Posts:
    284
    I'm building an environment a little like this one, and I'm trying to decide how I should portion out materials across each separate room tile in order to optimise material batching.

    Has anybody here any experience with this sort of construction?

    Would you advise:
    1) making the entire room out of one material (which would be one draw call, but everything would share the same roughness attribute, etc),
    2) trying to minimise different materials (so lots of office supplies use the same material, but the floors/walls/ceilings use the same texture/material),
    3) or just go hell for leather - with different materials for different surfaces (eg. wood, ceramics, plastics, etc) on individual objects and rooms, etc?

    Usually when you're inside one room tile, you won't be able to see or see into other room tiles (though there will be a few exceptions).

    Thanks for any ideas on this, I appreciate your brains!

    --Rev
     
  2. ToshoDaimos

    ToshoDaimos

    Joined:
    Jan 30, 2013
    Posts:
    679
    The strategy for this problem is always the same. Use as few shaders and as few textures as possible. Ideally you want to use a SINGLE shader and a single texture for everything.
     
  3. Reverend-Speed

    Reverend-Speed

    Joined:
    Mar 28, 2011
    Posts:
    284
    Gah. It's so troubling to think about this...

    As you say, ideally, one material and one texture (+ maybe a normal map), but then you're missing the opportunity to have rough wooden surfaces and shiny glass and translucent plastic. Add to this the fact that you need this to be static meshes with the same mesh and you can't use per-instance-properties or you break batching. It's a real headache.

    I may need to try and forget all of this because it's just paralyzing me at the moment.
     
  4. FiveFingerStudios

    FiveFingerStudios

    Joined:
    Apr 22, 2016
    Posts:
    510
    If you put your textures into an Atlas, you can have rough wood and shinny plastic in the same texture. You would just need to separate out translucentt from opaque.
     
  5. Reverend-Speed

    Reverend-Speed

    Joined:
    Mar 28, 2011
    Posts:
    284
    Fair point, you just include another map (or channel) to act as roughness / emissive etc , using the Atlas UVs to distinguish 'em.
     
  6. BrandyStarbrite

    BrandyStarbrite

    Joined:
    Aug 4, 2013
    Posts:
    2,076
    @Reverend-Speed
    Okay. Do you have like a rough example illustration/drawing, of the entire room floor layout, that has labels that shows what should be shiny, and what should be not etc? If you do, that could help us give you a more precise answer, to your question.
     
    Last edited: Apr 5, 2021