Search Unity

  1. Unity 2020.2 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Resolved Fade material receives direct light even when inside a dark box

Discussion in 'General Graphics' started by rotsin, Nov 22, 2020.

  1. rotsin

    rotsin

    Joined:
    Feb 22, 2013
    Posts:
    10
    [edit] So apparently I have been living under a rock for the past 8 years or so as this is standard behavior for Unity, so the downvote for the question is well deserved. The real world issue that I had was faded particle systems on weapon fire impact. In a non lit area they would show up as fully white due to them being affected by the directional light in the scene. What I ended up doing was put the particle effects in a different layer, exclude the layer from the directional light and rely solely on blend probes to affect the light on the particles.

    I'm using Unity 2019.4.15f1 and having some issues with the standard shader Fade/Transparent materials. I've noticed that the objects using said materials receives direct light from a directional light wherever they are placed even when the light source should not reach the object. I've placed a sphere inside a sealed box made out of 6 streched cubes. If I use an opaque material, it is pitch black, when I change it to fade it receives light from the directional light. cap1.PNG cap2.PNG

    [EDIT] I've also made a gif to better illustrate the issue:
    https://gph.is/g/ZOJeKBP

    Has this always been the case, is it a bug in Unity and are there some workarounds available for this issue?
     
    Last edited: Nov 22, 2020
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    9,591
    This has always been a limitation of the built in renderer. Transparent materials do not receive shadows. There are multiple 12+ year old forum threads on this topic.

    There are some work arounds for getting the shadows from the main directional light to affect transparent objects, but it requires custom shaders and some scripting.

    Alternatively the URP* and HDRP both support this out of the box.

    * This seems to get broken frequently in URP with shadow receiving / casting transparent objects. I don't know the current state of this feature as I'm not a URP user at the moment. But it is supposed to work.
     
unityunity