Search Unity

Question Utterly confused by baked/mixed lighting...

Discussion in 'Global Illumination' started by PenProd, Feb 14, 2023.

  1. PenProd

    PenProd

    Joined:
    Dec 17, 2022
    Posts:
    171
    I think I have a pretty good understanding how lighting works, yet the results are almost never what I expected.

    In below examples, I have a door, surrounded by walls. The door handle is a brass texture, so are the buttons to the left of the door. For speed (this is going to be a VR game), the walls are set to the URP/Baked Lit shader. Everything else is set to the URP/Lit shader. All objects in the scene are Static.There is a single light source. A BAKED Spot Light on the ceiling above the door, pointed at the door.

    Here is the scene without any lightmaps applied:

    NoLightmaps.jpg
    Now this is how it looks after I Generate Lighting:
    baked.jpg

    This looks how I want it to look, with one problem. The brass textures are black since there's no specular lighting (they would need a realtime light for this). So the solution, as I understand it, is to use MIXED lights. So after changing the spot light from BAKED to MIXED, it looks like this:

    mixed.jpg

    Now both the door handle as the button panel look as intended. But the door has lost shadows (in the panels) and the wall (around the door) is for some reason, no longer lit. Why?
     
    Last edited: Feb 14, 2023
  2. wwWwwwW1

    wwWwwwW1

    Joined:
    Oct 31, 2021
    Posts:
    769
    The only difference between Real-time and Mixed mode is that Unity will bake indirect lighting for mixed lights. So there's no baked soft shadow on the door.

    Baked Lit doesn't consider any real-time lighting. You can try switching the wall shader to Lit.
     
  3. PenProd

    PenProd

    Joined:
    Dec 17, 2022
    Posts:
    171
    Hi, and thank you for your anwser.

    Yes, I get that. So if the door is set to static, it will bake the shadow into the lightmap. If the door is set to dynamic, I should see realtime shadows (since the light is set to Mixed, not to Baked). But I don't see any shadows.

    Yeah, I knew that. What I didn't know was that if you set the Lighting Mode to Shadowmask, that would cause a problem since direct light is not baked into the lightmap, and the Baked Lit causes the wall to ignore the realtime part of the mixed light. So that adds up to no light being visible on the wall from that light. Setting the lighting mode to Substractive solved that problem.
     
  4. PenProd

    PenProd

    Joined:
    Dec 17, 2022
    Posts:
    171
    Wait, that's not entirely true. I do see shadows, I just don't see the level of detail when the door is set to static.

    So is it correct you can never get the same level of (shadow/indirect lighting) detail on a dynamic object with realtime/mixed lights as on a static object with mixed/baked lights?
     
  5. wwWwwwW1

    wwWwwwW1

    Joined:
    Oct 31, 2021
    Posts:
    769
    I think the answer is yes, because all dynamic objects will be ignored during lightmap baking.
     
    PenProd likes this.
  6. angiemon

    angiemon

    Joined:
    Mar 26, 2018
    Posts:
    37
    hello! Kinda old thread but I wanted to chime in to maybe help others and possibly even you if you haven’t done that already, just wanted to ask if you’re using Reflection Probes? :) all metallic things need reflection probes to look their best, and this should then work with only baked lights too (you could also try tweaking the intensity of the reflection probe)