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

Static objects with the same material use one drawcall each after Lightmap baking?

Discussion in 'General Graphics' started by erana79, Sep 15, 2015.

  1. erana79

    erana79

    Joined:
    Jun 26, 2013
    Posts:
    61
    Hello everyone!

    I am working on a mobile game and ran into a problem when baking the light of the scene.
    In my scene I only use one tree GameObject which i placed about 150 times on a (modeled) terrain.

    Every instance of the tree is marked as static and (obviously) uses the same material.
    When i bake the scene lighting and start the scene, each tree uses 1 draw call (i use just 1 baked directional light).
    Aren't the tree supposed to be batched and only use 1 draw call?

    When i deactivate all trees in the scene the the draw calls are reduced for ca. 150 calls.

    Here's a shot with a couple of visible tree objects:

    When i deactivate the tree's the draw calls drop from 23 to 6:


    I use quite small atlas sizes (256px) and low quality for the lightmaps.
    Maybe Unity creates an atlas for each tree object and therefore uses a separate draw call for each tree?

    Is there a way to optimize this without increasing lightmap quality?

    Thanks in advance for your help!
     
  2. erana79

    erana79

    Joined:
    Jun 26, 2013
    Posts:
    61
    Anybody got an idea? This really drives my nuts :)
     
  3. erana79

    erana79

    Joined:
    Jun 26, 2013
    Posts:
    61
    I found the problem - in case somebody is interested.
    The lightmap resolution of every tree was set to 1. Therefore it took a lot of lightmaps to render the lighting.
    I reduced it to 0.01 (which is enough) and now the draw calls went down.
     
    theANMATOR2b likes this.