Search Unity

Question HDRP Shadows and Light Layers problem

Discussion in 'High Definition Render Pipeline' started by Toonas, Aug 23, 2020.

  1. Toonas

    Toonas

    Joined:
    Sep 4, 2017
    Posts:
    19
    Hi everyone!
    I used Light Layers to split my light on baked (baked Area Light and walls of the box) and realtime (sphere inside the box and Point Light). But now I want my Point Light and sphere to cast shadow on baked walls. So, I used Light Layer of Shadow Map, but it didn't work at all. So, how can I bake some light on the scene and then use realtime light, that affect only dynamic objects, but that allow to cast shadow on static? I want this to optimize my scene and use realtime light only on dynamic objects.
    P.S. Light Probes are not allow dynamic objects to cast shadows on other objects.
     

    Attached Files:

  2. Passeridae

    Passeridae

    Joined:
    Jun 16, 2019
    Posts:
    395
    I'm struggling with the same problem. From what I understand, you can't do it the way you want if what you want is a light source that casts shadows of dynamic objects onto static objects without actually illuminating those static objects since they've already received lighting vie lightmaps. Current light layer system allows you to illuminate an object without shadowing, but not the other way around. So you'll probably need some kind of your own shadows that could be decoupled from the lighting.

    But maybe I'm missing something here, so it would be great to know what other people think about it.
     
    Toonas likes this.
  3. Toonas

    Toonas

    Joined:
    Sep 4, 2017
    Posts:
    19
    Hi! Thank you for your answer. I tried some variants to resolve this problem, but there is no solution for me. So, now I use mixed light mode. This is not a best solution, but this is better than nothing.
     
  4. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
    Hey, why not using mixed lights and an indirect bake only? You will get realtime lighting and great indirect quality simultaneously.

    If you just want to simulate a ceiling light, a spot light will be a lot cheaper than an area light, and hdrp offers great shadow filtering with PCSS shadows for point and spot lights. And if you're worried about cost, you can tune the light and shadow fade distances on these lights. It'll be a lot simpler than having 2 hacky light setups to maintain (baked and non-baked).

    Btw, I also see the intensity you use on these lights is incredibly high, is this intended? You might want to look into adjusting the Exposure instead. This amount of lumen is really, really high if you just want to simulate 1 lamp.
     
    Toonas likes this.
  5. Toonas

    Toonas

    Joined:
    Sep 4, 2017
    Posts:
    19
    Hi! Thank you for answer. I'm using mixed light now. Why I didn't do it at the begginning? Because I had some problems. So, I think I can trick and use point light only.
    About high intensity - this is my test project, where I built simple boxes and test some features. I know about Exposure and I use it in my main project. I know good table of lux from unity, where described many useful things. Thank you for your help
     
  6. Passeridae

    Passeridae

    Joined:
    Jun 16, 2019
    Posts:
    395
    Not always that great, though. Properly baked lighting can sometimes offer far superior quality to PCSS shadows. More than that, contact shadows don't support any kind of filtering and therefore can't be blurred. So, in practice, you'll get good (but probably costly) looking shadowmaps that come with bias issues which are exacerbated by PCSS and nothing to counter it. Or, if you choose to enable contact shadows you'll get just very weird looking results with non-filtered parts of contact shadows on top of the PCSS blurred ones at the places of contact.
     
  7. KCGames47

    KCGames47

    Joined:
    Nov 3, 2014
    Posts:
    39
    Thanks for the answer, but, can you explain why the custom shadow lightlayers are not working as expected? I want to have a certain object in my scene to not receive shadows from a certain light.. so I set up the light source to exclude a certain layer "NoShadows" on its shadow settings. and I set the object to use the same "NoShadow" layer as its only rendering layer. but that object is still receiving shadow from that light.