Home Unity

Issues with Lightmaps, Batching and general F**KING optimization

polycounter lvl 10
Offline / Send Message
Sythen polycounter lvl 10
Hey guys,


So I'm working on a title that is due release next week, but unfortunately we've been stopped due to some issues with optimization.

Our scene, (4,000 polys), is having issues with batching. Due to Unity's unbelievably terrible Lightmap & Materials system it is impossible to use both lightmaps and achieve significant batching.

We've tried cutting down the polys in our scene, we've tried atlasing textures, we've baked our lightmaps but this only gives us 30 drawcalls less, and for a scene that is not that big and not that detailed we're idling at 80 drawcalls.

Unfortunately none of the pro features have been able to help, and we've been ripping our hair out for the last two weeks about this issue.

If anyone successfully achieved batching and lightmaps together, or has some method of optimizing that I've not tried yet, it would be greatly appreciated.

This is urgent, so if you could please message me, or find me here on this hangout:https://plus.google.com/hangouts/_/2a16ae9a66e2afd6d0ca841500008327db7792d9?authuser=0&hl=en-GB#

- Sythen.

Replies

  • Farfarer
    You've marked everything that doesn't move as Static (top-right of Inspector) and enabled static batching, right? Dynamic batching can sometimes end up having a negative impact in some situations as it can require more overhead at run-time than it actually saves.

    Other than that, there isn't a lot I can tell without more info. How many objects, how are they scaled, how many lightmaps, how many materials, what shaders requiring what vertex attributes...? All of those things affect batching.
  • gsokol
    Offline / Send Message
    gsokol polycounter lvl 14
    it is impossible to use both lightmaps and achieve significant batching.

    Care to elaborate? works just fine for me?

    You do have to realize, just like with anything else, batching does have overhead...and if your just batching 500 tiny things together....its not really going to benefit you that much.

    Are you using pixel lights at all? Your going to get more than one draw call for any object thats being hit by a light.

    If your using pro, you should really be checking the profiler to see where the draw calls are coming from.
  • spahr
    Offline / Send Message
    spahr polycounter lvl 8
    The things ive noticed with unity is it hates draw calls, alpha sorting, and per pixel lights. Unity is actually great at handling polygons so 4k is a cake walk for Unity. I was going to say maybe texture atlasing.

    Also dont overlook project settings. If you are using high cast shadow details(unlikely since you mentioned light maps), anti aliasing, any camera post effects, things like that, it may be just 1 thing mixing with another that just complicates things. Like thing A drops frame rate by 2, thing B drops it 2 as well, both on at the same time drops it 20!

    you could also try saving the lightmaps as 16 bit tgas, and using them in a light map shader if you are having memory issues or batching problems.
Sign In or Register to comment.