Search Unity

Baked Ambient Occlusion and Realtime Directional Shadow Strength

Discussion in 'Global Illumination' started by Doddler, Mar 10, 2020.

  1. Doddler

    Doddler

    Joined:
    Jul 12, 2011
    Posts:
    269
    I'm having an issue where when the shadow strength is not set to max on a directional light, the baked lighting and ambient occlusion is not showing properly.

    Here is the scene baked with the directional light disabled (there are no lights in the scene other than ambient):

    upload_2020-3-10_0-36-55.png

    After enabling the directional light (with 50% shadow strength) however, the scene appears like this.

    upload_2020-3-10_0-37-6.png

    Surfaces that face away from the light source get the full effect of the original shadows, but everything else the baked shadows are considerably reduced or gone. This causes the boundaries between the two surfaces to look terrible.

    I could solve the issue by increasing the ambient light color and lowering the strength of the directional light, but because lighting (via directional light) is planned to be dynamic and will fade out at times, and ambient color cannot be changed at runtime with the new lighting system, I can't push the ambient light past the lowest value the scene will have.

    Is there any way to have baked shadows and ambient occlusion to have their full strength when directional light strength is not set to max?
     
  2. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    I presume you are using a realtime/mixed directional light, given the fact that you are changing shadow strength? You could instead try switching to fully baked lights and then increase baked AO direct contribution.

    Alternatively, you could use screen space AO and increase its direct contribution as well.

    Word of warning: tweaking shadow strength is not PBR compliant. If you find that your scene's shadows are too dark, make sure that you have ambient lighting set up properly (either by using and HDRI, solid color, or gradient).