Search Unity

Mix Directional Light Error in Unity 2017

Discussion in 'Global Illumination' started by NestorAlgieri, Aug 12, 2017.

  1. NestorAlgieri

    NestorAlgieri

    Joined:
    Sep 11, 2011
    Posts:
    299
    I have attached a sample project to demonstrate a problem with light mapping in Unity 2017

    1.) Open it with Unity 5.3.4p3:
    2.) Bake it
    3.) toggle the Directional light in the scene

    Result:

    Only Shadow gets turned on and off. This is the correct behavior.

    1.) Open with Unity 2017.1
    2.) Bake it
    3.) toggle the Directional light in the scene

    Result:

    Shadow gets turned on and off. BUT the Light probes and Dynamic Object(sphere) also gets toggled.

    Why did this change in recent version?

    Thx
     

    Attached Files:

  2. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,735
    If you no longer have a light active how is the sphere going to receive realtime direct light?
     
  3. NestorAlgieri

    NestorAlgieri

    Joined:
    Sep 11, 2011
    Posts:
    299
    Try the sample project in the 2 unity versions. See the different behavior.
     
  4. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,735
    I see, I guess this use case is not exactly covered by the modes.

    If I understand correctly, what you want is for everything to be fully baked and just have dynamic objects cast subtractive shadows and nothing else.
     
  5. NestorAlgieri

    NestorAlgieri

    Joined:
    Sep 11, 2011
    Posts:
    299
    Yes. How do I achieve that with Unity 2017? Because for mobile, this performance is now degraded....
     
  6. kemalakay

    kemalakay

    Unity Technologies

    Joined:
    Jul 12, 2016
    Posts:
    224
    Hey @nepoez

    Currently, the difference you see in behaviour of Subtractive mixed mode is by design (for consistency reasons across dynamic and static objects) but I can see the point in your use case. To clarify: you want your static objects to use baked lightmaps only and your dynamic objects to be lit through light probes?

    If this is the case, then you can use a workaround by making your static objects use a shader that ignores direct lighting and dynamic objects sample lighting through light probes with a simple Lambert shader. Is that applicable?
     
  7. NestorAlgieri

    NestorAlgieri

    Joined:
    Sep 11, 2011
    Posts:
    299
    Hi @kemalakay

    You are slightly off. I believe you are under the impression that the directional(mixed) light is lighting the static objects in real-time. That's not the case. For Unity 2017 The directional(mixed) light is lighting the dynamic objects in real-time, casting shadows in real-time, also the dynamic objects are lit by light probes too. This is using enlighten light mapper. If I used Progressive, then you would be correct. This is why I stopped using Progressive because it's even worse for mobile performance for what I need.

    The behavior I want, is what Unity 5.3.4p3 provides where the directional (mixed) light only does one thing in real-time, which is cast shadows from dynamic objects onto static objects. Everything else is baked. So the only thing calculated in real-time is shadows. I use mobile diffuse for shaders for dynamic obj to cast shadow and the static objs to receive shadows.

    Hopefully you can help me solve this!

    Thank you.