Search Unity

Unity point light's realtime shadow is ignored by directional light after baked

Discussion in 'Global Illumination' started by Alde-Baran, Oct 20, 2020.

  1. Alde-Baran

    Alde-Baran

    Joined:
    Nov 15, 2019
    Posts:
    39
    In my scene, there is 2 light one is mixed point light and other is mixed directional light. After i light bake in subtractive mode, non-static objects shadows are based on directional light. Even the object is in closed area. image: https://ibb.co/LZmnMnn
    Sphere is non-static. Both light is mixed. Btw, closed area has exterior.
    How can i fix it?
     
  2. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    Make sure that your room meshes are set to cast shadows. If they happen to be one-sided meshes, then enable double sided shadows.
     
  3. Alde-Baran

    Alde-Baran

    Joined:
    Nov 15, 2019
    Posts:
    39
    Insıde and out side of closed area is one mesh and it was on. I set it to two sided and nothing changed.
    upload_2020-10-20_18-17-58.png
     
  4. Alde-Baran

    Alde-Baran

    Joined:
    Nov 15, 2019
    Posts:
    39
    I disable the directional light and bake again. The point light the shadows.
    I guess the problem is point lights.
    upload_2020-10-20_18-55-43.png
     
  5. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
    Hi,

    Subtractive mode is a super performant but inaccurate lighting mode. It will bake out lights, but provide realtime shadows from the main directional light that can be mixed in with other baked shadows. So dynamic objects will not cast shadows from point/spot lights at all. For dynamic objects you need light probes to get shadows/indirect from other static objects (i.e. the walls and floor). Also, because only dynamic objects cast realtime shadows, you will see shadows in interiors (other static geometry) from the directional light. This mode is generally very limited but also very performant, but it is used widely in exterior games where you want character shadows. For interiors I would generally recommend using shadowmask mode.

    For reference docs are here:
    https://docs.unity3d.com/Manual/LightMode-Mixed-Subtractive.html
     
  6. Alde-Baran

    Alde-Baran

    Joined:
    Nov 15, 2019
    Posts:
    39
    But in shadowmask mode, mixed light doesn't affect to the light map. So the light map completely black.
    Shadowmask mode is only work in baked light but, dynamic object not affect by lights.
    upload_2020-10-21_19-18-30.png
     
  7. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
    kristijonas_unity likes this.
  8. Alde-Baran

    Alde-Baran

    Joined:
    Nov 15, 2019
    Posts:
    39
    I fix it. I change to light map mode to shadowmask, increase bounces and change shadowmask mode to shadowmask from distance shadow. And everything is go well. Only problem is light baking is take more time but ı have no longer use ambient light.
     
  9. Jesper-Mortensen

    Jesper-Mortensen

    Unity Technologies

    Joined:
    Mar 15, 2013
    Posts:
    232
    Here is a youtube version of the video. Some folks reported problems with the one I linked above.

     
    StefGoal043 and apkdev like this.