Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Shadowmask vs DistanceShadowmask

Discussion in 'Global Illumination' started by Stroustrup, Jun 4, 2020.

  1. Stroustrup

    Stroustrup

    Joined:
    May 18, 2020
    Posts:
    142
    why does it say that distance shadowmask has better quality in the documentation?


    so from what i understand, shadowmask = baked shadows, distance shadowmask = realtime. at least that's the behaviour i observe when setting the light from distance shadowmask to shadowmask. hence, wouldn't shadowmask just always be better since its precomputed? i get fuzzy edges and flickering in the shadows, unless i turn up the resolution to ultra.

    Light set to default medium Distance Shadowmask:


    Light set to Shadowmask:


    also, it took me some time to figure out what the difference between shadowmask vs baked indirect was for mixed lights, because the lights didn't use the baked shadows automatically. i had to set that shadows settings to shadowmask in the inspector for the lights to utalise the baked data. shouldn't it be on by default, so that it always uses bake shadow data?
     

    Attached Files:

    Last edited: Jun 6, 2020
  2. JenniferNordwall

    JenniferNordwall

    Unity Technologies

    Joined:
    Sep 19, 2016
    Posts:
    160
    Heya, looking at the docs there's a lot more there. Is any of this answering your question?
    https://docs.unity3d.com/Manual/LightMode-Mixed-Shadowmask.html

    With the Distance Shadowmask quality setting
    When you set a Scene’s Lighting Mode to Shadowmask and your Project uses the Distance Shadowmask quality setting, Mixed Lights behave as follows.

    • Dynamic GameObjects lit by Mixed Lights receive:
      • Real-time direct lighting.
      • Baked indirect lighting, using Light Probes.
      • Real-time shadows from dynamic GameObjects, using the shadow map, up to the Shadow Distance.
      • Real-time shadows from static GameObjects, using the shadow map, up to the Shadow Distance.
      • Baked shadows from static GameObjects using Light Probes, beyond the Shadow Distance.
    • Static GameObjects lit by Mixed Lights receive:
      • Real-time direct lighting.
      • Baked indirect lighting, using lightmaps.
      • Real-time shadows from dynamic GameObjects, using the shadow map, up to the Shadow Distance.
      • Real-time shadows from static GameObjects, using the shadow map, up to the Shadow Distance.
      • Baked shadows from static GameObjects, using the shadow mask, beyond the Shadow Distance.
    With the Shadowmask quality setting
    When you set a Scene’s Lighting Mode to Shadowmask and your Project uses the Shadowmask quality setting, Mixed Lights behave as follows.

    • Dynamic GameObjects lit by Mixed Lights receive:
      • Real-time direct lighting.
      • Baked indirect lighting, using Light Probes.
      • Real-time shadows from dynamic GameObjects, using the shadow map, up to the Shadow Distance.
      • Baked shadows from static GameObjects using Light Probes, up to and beyond the Shadow Distance.
    • Static GameObjects lit by Mixed Lights receive:
      • Real-time direct lighting.
      • Baked indirect lighting, using lightmaps.
      • Real-time shadows from dynamic GameObjects, using the shadow map, up to the Shadow Distance.
      • Baked shadows from static GameObjects, using the shadow mask, up to and beyond the Shadow Distance.
     
    BATTLEKOT likes this.
  3. Stroustrup

    Stroustrup

    Joined:
    May 18, 2020
    Posts:
    142
    what is more performant, a distance shadowmask with update mode set to on enable or baked shadow map?
    would on enable remove all of the cost associcated with making the shadows?

     

    Attached Files:

  4. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    The Distance Shadowmask mode is more expensive than the normal Shadowmask mode.
    Because in Distance Shadowmask mode, both dynamic and static objects can cast realtime shadow maps within the set shadow distance. Beyond this distance static objects get shadows from other static objects from the shadowmask mask. So more shadows means more draw calls.

    Therefore Distance Shadowmask is for high-end hardware while normal Shadowmask is a cheap solution for low-end to mid-end hardware.
     
    Last edited: Jun 17, 2020
    JenniferNordwall likes this.
  5. CodeRonnie

    CodeRonnie

    Joined:
    Oct 2, 2015
    Posts:
    531
    I've been really nailing down my lighting work flow. I want to have realtime shadows from static objects cast onto dynamic objects, but I also want the same static objects to cast baked shadows onto other static objects. Otherwise you don't see things like baked shadow angle or baked shadow radius on the static environment. Is there any way to achieve that? I want static to static shadows to be baked and have soft edges.
     
  6. JenniferNordwall

    JenniferNordwall

    Unity Technologies

    Joined:
    Sep 19, 2016
    Posts:
    160
    Hi
    Please create a new thread if you have a new question :) Thanks
     
    CodeRonnie likes this.
  7. CodeRonnie

    CodeRonnie

    Joined:
    Oct 2, 2015
    Posts:
    531
    Will do, and thank you for your Unite talks, they were some of the most helpful resources in understanding all of this.
     
    JenniferNordwall likes this.
  8. JenniferNordwall

    JenniferNordwall

    Unity Technologies

    Joined:
    Sep 19, 2016
    Posts:
    160
    Thank you, and you are welcome :) I had fun doing them, and happy they help people. Have you watched the latest "Baking at the speed of light"? Cheers :)