Search Unity

Alpha blended objects and shadow strength

Discussion in 'High Definition Render Pipeline' started by Roggi_, Dec 14, 2019.

  1. Roggi_

    Roggi_

    Joined:
    May 14, 2014
    Posts:
    84
    Is there any way to render a shadow that is not at 100% strength in hdrp? Every transparent object - like glass, throws a fully black shadow as if it was made of bricks. Is there any way around this?
     
  2. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    Yes, in Light component, under Shadows are more settings hidden. There is a cog plus icon next the word Shadows on the right. Click on it to expand more options. Now there are settings like Dimmer and Tint. Try to decrease the Dimmer value.
     

    Attached Files:

    Last edited: Dec 14, 2019
  3. Roggi_

    Roggi_

    Joined:
    May 14, 2014
    Posts:
    84
    Thanks for that, however that changes the shadows for everything everywhere. Now solid objects have transparent shadows. I've tried using light layers but that seems to be broken aswell. It only works with one directional light in the scene and then the layer settings are ignored when 2 lights are present, each supposedly affecting different layer.
     
  4. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    Yes, that changes everything shadow that light component is casting. That is what you asked for but not what you want?
    Can you describe a little more detailed what you want to achieve?

    You saying shadow are too solid but then you saying shadows are too transparent?
    If you do not want transparent objects cast shadows, turn it off.
    Your scene might also lack ambient lighting.
    Last time I checked out Light Layers, it worked for me. I used them for example to make lights of lamp bulbs affect only the glass of the lamp.
    Are we talking about a photorealistic lighting? If that is the case, shadows working for me. So you may share your setup. Otherwise you may seek an art style that is hard to achieve with Unity buildt-in rendering.
     
    Last edited: Dec 15, 2019
  5. Roggi_

    Roggi_

    Joined:
    May 14, 2014
    Posts:
    84
    2 cubes in a scene. One is made of bricks - using an opaque brick material. The other is made of glass. Using a semi transparent, alpha-blended material that looks like glass. If you have the default lighting, the glass cube has the same shadow strength as the brick wall, even though it's 90% transparent. If you do the other setting, than the glass object can have the shadow right, but the brick wall now casts a 10% shadow as if it were transparent.

    So the only option is to layer it. But that isn't working for me. I've set it up like it says in the doc example. One object is in the layer 1, the other in layer 2. There are 2 directional lights in the scene, one in the layer 1, the other in the layer 2.
    First of all, I get thousands of errors mentioning that only 1 directional light can cast shadows in the scene ..
    But apart from that, there is actually no shadow in the scene at all. Both objects are not receiving any light at all. And other objects that are in default layer receive double the lighting but sill zero shadows. I've tried all sorts of combinations with the default layer but nothing works.
     
  6. Roggi_

    Roggi_

    Joined:
    May 14, 2014
    Posts:
    84
    ..bump?
     
  7. MajorParts

    MajorParts

    Joined:
    Sep 27, 2014
    Posts:
    88
    I would like to know this too! It wasn't a problem in legacy renderer.
    The top image is legacy, the bottom is hdrp

    upload_2019-12-17_11-48-27.png
     
  8. Roggi_

    Roggi_

    Joined:
    May 14, 2014
    Posts:
    84
    How many times can I bump this before I get banned?
     
  9. laurent-h

    laurent-h

    Joined:
    Sep 29, 2016
    Posts:
    78
    Hi,
    Semi transparent shadow maps are indeed not implemented in HDRP at the moment.
    For glass objects I'd recommend making sure they are in a separate object and disable cast shadow on them until we have a better solution.
    Sorry for the inconvenience.
     
  10. Roggi_

    Roggi_

    Joined:
    May 14, 2014
    Posts:
    84
    Are there any plans for implementing this? Can I work on my project and enable this later on when it's ready or should I switch to the old render pipeline since it's not missing something as trivial as rendering semi transparent objects correctly?
     
  11. laurent-h

    laurent-h

    Joined:
    Sep 29, 2016
    Posts:
    78
    We would like to have it but this feature is not being worked on at the moment. I cannot give an estimate when it'll come yet.
     
  12. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    Can semi transparent shadows be archived with Unity DXR? Or is support planned with Raytracing?
     
  13. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    766
    with DXR, not at the moment in the last package 7.1.7
    But it's being implemented and will probably land in the next HDRP package (7.2.0)
     
    Bordeaux_Fox likes this.
  14. Roggi_

    Roggi_

    Joined:
    May 14, 2014
    Posts:
    84
    That's a real bummer.

    However, for my specific usecase I found a workaround. Using a duplicate object set to shadows only using a dithered opaque alpha clipped shader with very specific variable values. Since it's being resampled by the shadowmaps, it gets blurred and it looks about as a 30% strength shadow would. Moving the numbers just very slightly creates a visible repeating pattern, even though I am multiplying it by a noise texture.
     
    Last edited: Jan 3, 2020