Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Drawcalls and lightmapping

Discussion in 'Editor & General Support' started by MadJohny, Apr 6, 2014.

  1. MadJohny

    MadJohny

    Joined:
    Mar 8, 2013
    Posts:
    143
    Hi, I am making a bomberman game and I would like to bake a lightmap with unity's beast lightmapping. The thing is, my map has a lot of objects, I have one plane for the ground and alot of objects on the map, including about +100 blue cubes, 3 red, green, grey and black cubes (3 for each color) and some metals boxes in the map itself.
    Since I am only using 7 materials, even with this number of objects I only get about 13 drawcalls, but when I try to bake a lightmap, it jumps from that value to about 130, I suppose this is due to having a huge number of objects in the scene, but is it possible to reduce the number of drawcalls and still have that sweet lightmap?I'll leave you with two images so you can see the difference by yourself (btw, the number of drawcalls changes depending on where I'm looking at, so looking at the diagonal of the map will give me a lot more drawcalls than almost facing a single wall)

    Edit: I am not being able to see the images on my post, so I'll also upload them to dropbox:
    https://www.dropbox.com/s/lgh18fuwrsb0j7x/Lightmapped.PNG
    https://www.dropbox.com/s/gohgdvi41yziv91/ugly.PNG
     

    Attached Files:

    Last edited: Apr 6, 2014
  2. Poppel

    Poppel

    Joined:
    Mar 4, 2014
    Posts:
    10
    Hello just my diagnosis: because of lightmapping many objects have different textures now, so they don't get batched any more (see "saved by batching"). Objects that are out of view frustum don't get drawn, thats frustum culling and is normal. ciao!
     
  3. MadJohny

    MadJohny

    Joined:
    Mar 8, 2013
    Posts:
    143
    Oh I see, there's that huge difference now that I notice :p, what if I build same thing in blender but only in one object, so the whole map would have about 7 materials but none multiplicated, one for all blue objects, another for all red, another for all metal boxes and so on...? Will that save me drawcalls?

    edit: I finished modelling in blender ( way easier than making it all in unity :p) however, since I used only one material/texture for all blocks of same type now I'm unable to lightmap it correctly, since when it wants to change something in the texture, ti will have to change on all the other objects. However this actually created a pretty fun shading xD https://www.dropbox.com/s/q7i6q44b7p83fxu/Captura de tela 2014-04-06 13.23.35.png
     
    Last edited: Apr 6, 2014