Search Unity

Bug Shadowmask alpha channel not working

Discussion in 'Global Illumination' started by hypnoslave, Jan 30, 2023.

  1. hypnoslave

    hypnoslave

    Joined:
    Sep 8, 2009
    Posts:
    439
    Hi there! I'm currently on Unity 2021.2.7, working with shadowmasks. My understanding is that Unity will use a lightmaps R,G,B, and A channels to bake out shadow masks for any given light (and cull lights that it runs out of space for). This seems to be working for me mostly, except all lights that appear to use the Alpha channel simply do not bake shadows.

    Please see the attached gifs. there's a light that's using the red channel that's working fine - when I disable shadows in the quality settings, Unity falls back to the baked shadow. However the light using the white channel does not do this.

    Any ideas? am I missing something?

    P.S - just to confirm, this is consistent across all lights. Also, when I remove a nearby light so these alpha-users fall back into one of the RGB channels, they work.

    Update: Amazing, in a different scene, I have discovered that A channel lights seem to be working. :confused:
     

    Attached Files:

    Last edited: Jan 30, 2023
  2. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
  3. hypnoslave

    hypnoslave

    Joined:
    Sep 8, 2009
    Posts:
    439
    Hey hey! Thanks for the reply, I appreciate it. Also that thread is fantastic!!!!

    ...but that's not the issue.

    I'm aware that if you have too many overlapping lights, Unity basically runs out of color channels to bake shadow masks and shunts some lights to baked. that makes sense. However the lights I'm complaining about are NOT set to baked after rendering and clearly use the white channel. The problem is that there's no baked shadow information in the actual white channel. To make matters even more strange, this seems to be relegated to (at least) one scene - alpha channel shadow maps seem to be baking fine in other scenes. Please see the above gifs in my post for clarity. If you let the gif run it'll actually show the shadow mask.
     
  4. hypnoslave

    hypnoslave

    Joined:
    Sep 8, 2009
    Posts:
    439
    Note also that the shadow mask its self is super fishy. For example, here's a section of the alpha channel for a shadow mask that's working:

    upload_2023-1-31_9-54-59.png

    And here's for the broken scene:

    upload_2023-1-31_9-55-30.png

    It appears that it's basically filling every texel with white.
     
  5. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    Thanks for the additional information. I've just realized that you're still using 2021.2.7f1. I suspect that you're running into this issue:
    It was resolved as a dupe against another internal case. I know for a fact that the fix was backported to 2021.2.9f1, so try upgrading to that version, if possible.

    There was another bug where Shadowmask alpha channel was nuked when using certain denoisers. This one was fixed in 2021.2.10f1.

    In short, try upgrading to the latest 2021.2 release (or better yet, to 2021.3 LTS, if possible), and see if that fixes the issue. If not, then I'd ask you to report a bug.
     
  6. hypnoslave

    hypnoslave

    Joined:
    Sep 8, 2009
    Posts:
    439
    hurrah! looks like that did the trick! Thanks very much Kristijonas!
     
    kristijonas_unity likes this.