Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Unity 2021.2 and HDRP 12 - Possible to exclude objects from receiving raytraced shadows?

Discussion in 'HDRP Ray Tracing' started by newguy123, Jul 14, 2021.

  1. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    Hi Guys

    How can I exclude some objects from receiving raytraced shadows, is it even possible?

    I have a bunch of tree prefebs that look great, however I'd like to exclude them from receiving raytraced shadows. They can just get normal shadows if possible.....
     
  2. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    766
    Unfortunately, it's not possible right now with a simple checkbox (like I imagined you would like).

    The only ugly hack I can think off to make the ray traced shadow fallback to raster is to use an Unlit Shader Graph Transparent Shadow Matte with Alpha at 0 on a surface only slightly above the ground.
    That way you ray traced shadow can be "covered" by the shadow matte raster shadow.
     

    Attached Files:

    PutridEx likes this.
  3. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    Sounds an intersting hack. That's a bit tricky though since trees also throw shadows on other trees and bushes etc.
    A simple tick box would be great on a per object basis, and all the magic happens automatically in the background.

    The point of all this is for Offline Visualisation. We dont have teams of programmers who can implement fancy stuff. We're mostly artists who expect things to just "work" like we're use to with traditional DCC apps and rendering engines.
    If we have to struggle to do the simplest thing, then it defeats the purpose of the supposed "speed" you get from realtime workflows, and we may as well just continue using traditional workflows.

    For now though, we'll see how far we can push your workaround hack, thanks
     
  4. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    766
    Indeed, I know it's still an ugly hack and not a perfect solution.

    However, I would be curious as to why you prefer raster shadows instead of the ray traced one for the trees ? Is it for artistic reasons or is there actual issues with the raytraced shadows in that situation ?
     
  5. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    Yes its just for current issues with raytraced shadows. Here's an example in Unity 2021.2.0b4 using a simple plain as "ground", so no actual terrain as such, and a tree from Nature Manufacture Dynamic Nature Assets. They did mention they dont yet support 2021.2, but that doesnt stop us from trying to make it work somehow :)

    upload_2021-8-18_13-51-58.png


    Then with just regular shadows:
    upload_2021-8-18_13-52-58.png


    So in this case, would be nice to set the trees to not have raytraced shadows, but the house and other items in the scene STILL have raytraced shadows.

    Also, ignoring the above for a moment, even if it was working like supposed to, I imagine we can get some performace improvements from excluding certain items from raytraced shadows, while still having the more important things in the scene still cast raytraced shadows.