Search Unity

Broken Static Batching with Lightmaps

Discussion in 'General Graphics' started by MoribitoMT, Nov 11, 2018.

  1. MoribitoMT

    MoribitoMT

    Joined:
    Jun 1, 2013
    Posts:
    301
    Hi,

    I have very large scene with around 50 batches ( saved bacthing 100-200 ), lots of atlassed single material objects.

    When I bake lights, I have 2 light-maps, however batching count jumps 50 to 250 ? What could be the reason and how can I fix this ?

    Screen Shot 2018-11-11 at 17.27.36.png
    Screen Shot 2018-11-11 at 17.28.02.png
     

    Attached Files:

    IgorAherne likes this.
  2. IgorAherne

    IgorAherne

    Joined:
    May 15, 2013
    Posts:
    393
    Hey @MoribitoMT, did you get it fixed? I am using UNity 2019.1.0b2 and have the same issue. Currently trying to circumvent this by using Instanced materials, but they are inferior to static batching in my game :/

    Edit might be silly, but people - make sure you are in play mode! Static batching only works in play mode
     
    Last edited: Mar 15, 2019
  3. MoribitoMT

    MoribitoMT

    Joined:
    Jun 1, 2013
    Posts:
    301
    You have 2 options

    1. Produce 1 lightmap, work with every single object mesh renderer lightmap scale. Some could be 1 some could be 2 some 0.1. Some even 0, so they wont be in lightmap, some small objects maybe

    2. Produce 2 or more lightmaps, however create 2-3 more lightmap settings instead default settings, every lightmap will have their own index. Then assign these settings carefully to each objects, assume you have 2 islands, all objects in island one uses setting 1, other island objects use other setting. This gives ability to choose which object goes to which lightmap. Then, when you travel in island one all objects will be in same lightmap, no extra batching..

    I used first solution 1 lightmap with different scaled objects. My ground and floor lightmap scales are 2, rest changes 0 to 0.5
     
    IgorAherne likes this.
  4. OmarVector

    OmarVector

    Joined:
    Apr 18, 2018
    Posts:
    130