Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question No main shadow on Baked Indirect Light Mode

Discussion in 'Global Illumination' started by MetaDOS, Feb 4, 2023.

  1. MetaDOS

    MetaDOS

    Joined:
    Nov 10, 2013
    Posts:
    156
    Hi. I baked my big terrain 4000x4000 which is split into 4 scene (so 2000x2000 each). My plan is to use real-time shadow for playable characters and baked light and shadow for the rest. I tried both on Unity 2021 and 2022.

    My settings:
    • Universal Render Pipeline - Default setting
    • Lightmap Parameters for scene & Object: Default-Medium
    • All objects are static
    upload_2023-2-4_8-50-49.png

    upload_2023-2-4_8-52-28.png


    With the same setting, if I choose Subtractive, the light map will include the main shadow on the lightmap:
    upload_2023-2-4_8-51-26.png

    But If I switch to Baked Indirect for better quality (because this is PC game), there isn't an shadow in the lightmap.
    upload_2023-2-4_8-53-43.png
     

    Attached Files:

  2. wwWwwwW1

    wwWwwwW1

    Joined:
    Oct 31, 2021
    Posts:
    761
    Hi, "Baked Indirect" doesn't bake direct shadows, what you see are indirect lighting (shadows).

    You can set the Light Mode to "Shadowmask" to allow baked (direct + indirect) shadows to mix with real-time shadows.

    You should also change the shadow mix mode from "Distance Shadowmask" to "Shadowmask".
    Distance Shadowmask: baked shadows only appear when they're beyond (real-time) shadow distance.
    Shadowmask: mix baked shadows with real-time shadows. Shadowmask.jpg
     
    MetaDOS likes this.
  3. MetaDOS

    MetaDOS

    Joined:
    Nov 10, 2013
    Posts:
    156
    Thank you. But is Shadowmask too heavy since we plan to support mobile soon?
     
  4. wwWwwwW1

    wwWwwwW1

    Joined:
    Oct 31, 2021
    Posts:
    761
    I think it depends (what kind of mobile device will it be?), but performance is definitely better than casting real-time shadows (for everything) every frame.

    There're many other things that also have a performance cost. (triangles in view, rendering resolution, draw calls, shader complexity, ...)

    Shadowmask mode compared to other modes:
    - Need 1 more lightmap to store the baked shadow (mask). (lightmap has RGBA channels, so at most 4 lights)
    - In fragment (per pixel) shader stage, the shader needs to combine baked shadow (mask) and real-time shadow.​
     
    Last edited: Feb 4, 2023
    MetaDOS likes this.