Search Unity

Resolved Cannot bake light on the Terrain

Discussion in 'Global Illumination' started by dribaJL, Jan 17, 2019.

  1. dribaJL

    dribaJL

    Joined:
    Dec 13, 2018
    Posts:
    1
    Hi everyone,

    I have a large terrain scene with most of the outdoor environment and every object in the scene has very high polygon count. So to increase the performance I am trying to bake the lights into my scene. I have only 1 directional light but when I put my light in the baked settings the shadows on the terrain disappears.

    I have my gameobject marked as Static as well as my terrain. I have also checked the lighting settings. Check the screen shots below. The shadows are working when the directional light is in Mixed settings but it will just disappear when I try to bake them. Can you help me out on what am I missing?


    Current Lighting Settings
    LightingBug1.PNG
    Terrain Settings
    LightingBug2.PNG
    Directional Light Settings(Notice it is on the Mixed Mode)
    LightingBug3.PNG \
    Current Scene on the Mixed baking setting
    LightingBug4.PNG
    Scene after changing the mode to Baked(Notice the light mode is now Baked) LightingBug5.PNG


    I also tried putting the same object in another scene and baking the light map but instead of using a terrain I used a plane and it worked great so I am assuming that I have some setting in the terrain which maybe interfering with this.

    Best,
    Samvid
     
  2. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    Hey!

    The most likely reason why the shadow cast by your GameObject, is due to a low lightmap resolution. For your particular setup, it would make sense to rely on Mixed lighting mode instead. In that way, you would get the benefit of baked indirect bounce and sharp realtime shadows.

    In order to save on performance further, consider disabling realtime GI, if your scene lighting is going to remain mostly static.
     
  3. drugges

    drugges

    Joined:
    Dec 28, 2018
    Posts:
    42
    I spent the morning looking for answers on the same question. I am using Unity 2019.2. I thought I should share my fix. My problem was that the Lightmapping settings for the terrain had a very low Scale in Lightmap value. It was around 0.0002. So I increased to 1 and all the baked shadows appeared! Maybe 1 is a high value. But my terrain is very small so it will do for me.

    upload_2019-8-30_9-35-23.png
     
  4. Ostermalm

    Ostermalm

    Joined:
    Oct 5, 2019
    Posts:
    3
    In my case, my terrain object was fairly large (500x700). After much pain, I realized that this made the "shadow pixels" huge too, so I was seeing no baked shadows on the ground because they got averaged away. Larger light maps (1024) or larger scale in lightmap for the ground object made no difference, since the object reached its max size in the atlas.
    My solution so far is to put down 50x70 size Quads with the same texture as the ground, that work as shadow receivers under my shadow generating objects.
    Also, I was happy to find out that fewer units per texel (4 for direct, 0.5 for indirect) worked fine for my outdoor low poly scene as this made baking much faster.