Search Unity

No shadows in baked static objects

Discussion in 'Global Illumination' started by Nicolas-Reynoso, Apr 9, 2019.

  1. Nicolas-Reynoso

    Nicolas-Reynoso

    Joined:
    Mar 31, 2016
    Posts:
    3
    Hi! im new with baked lightning and im having some problems.
    I use subtractive ligthing mode. I want static object to have baked ligthing and shadows. I want some non-static objects (player, enemies) to have realtime ligthing.

    Everything works perfect, but i only can see shadows from non-static objects. Static objects dont cast shadows in big terrain map. In a small/test terrain map they cast a very weak shadow if the object is big.

    If i change the static obj to non-static, shadows appears again. ShadowsNoShadows.jpg

    Weak shadows on big objects and small terrain only
    weakshadows.jpg
    Im doing something wrong? i appreciate any help, love the performance increase with baking lighting, i want to keep learning.
    Sorry for my bad english, not my native lenguage.
     
  2. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    Hello! Lightmap resolution is way too low for sharp baked shadows. Try increasing the lightmap resolution either on the terrain itself, or in the lighting settings. Keep in mind that increasing terrain resolution will eat up your lightmap space really quick.

    Another thing to consider, is that you will still not get any shadowing on your grass. Since the grass in your scene is not lightmap static, it will not receive any baked shadows.

    For large scenes with terrain it is better to use Mixed light sources + shadowmask or baked indirect. In that case, you would have realtime shadows and baked indirect GI. Since indirect GI does not need high lightmap resolution to be believable, you would avoid cranking the lightmap resolution too high, which would in turn save you baking time and lightmap space.
     
  3. Nicolas-Reynoso

    Nicolas-Reynoso

    Joined:
    Mar 31, 2016
    Posts:
    3
    Thanks for your answer!
    Having no shadows on grass is fine, i just want baked static shadows on terrain and maybe other static objects.

    I attempted with 1 directional light (mixed) + shadowmask, still, no shadows on static object (im missing something?)
    If i set high lightmapping settings (40 texels per unit), i get really really poor shadows in a very small terrain with low object, and a baking time of 7-8 mins (i9 9700k, 1070gtx).

    40 texels per unit feels like an insane amount in my project, even in small maps, but lower than that i get no shadows.
    Shadowmask.jpg
    How much would be a standard lightmap resolution (texel per units) for an android game?}
    Its normal for other projects to have so many texel per units and wait so long for lightmapper?

    Shadows in the image are OK for me, but i dont know if having high texel per unit is optimal (30-60 mins in big map baking time)
    This system is not intended for big maps?
    Thanks for the help!
     
    Last edited: Apr 11, 2019
  4. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    You do have the shadows in your scene, albeit they are blurry due to lightmap resolution. If the biggest issue you are facing now is their dim appearance, you can try lowering the amount of bounces in the Lighting Settings. Also, you can try tweaking Indirect and Albedo intensity sliders.

    If you are deploying for mobile, it is a good idea to minimize the number of lightmaps your scene uses. I would suggest setting Lightmap Size to 2K. Keep in mind that since you are using the GPU lightmapper you might run into cases where your GPU will run out of memory if the lightmap size is set too high. If that's the case, then switch back to the CPU lightmapper.

    It is strange that you are not seeing realtime shadows being cast from static objects even when in Shadowmask mode. Make sure that your shadowmask mode is set to Distance Shadowmask in the Quality settings. Also, realtime shadows are going to be cast within the shadow distance that is set in the Quality settings as well. Anything beyond that distance will be displayed as baked shadows. You can read more about it here - https://docs.unity3d.com/Manual/LightMode-Mixed-ShadowmaskMode.html
     
  5. 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.
     
    SonicCane11 likes this.