Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Shadow ONLY Shader in URP 12.1.6 & Unity 2021.3.0+

Discussion in 'Shaders' started by Ruhan-_-, May 20, 2022.

  1. Ruhan-_-

    Ruhan-_-

    Joined:
    Sep 14, 2016
    Posts:
    20
    Just as the title says, I just need a simple shader to apply on a Quad on the ground so that it simply shows the shadow received only WITHOUT mesh or shadow casting.

    I have gone through the following forums but something in URP changed again and there is no way to obtain this..

    https://forum.unity.com/threads/how-to-make-receive-shadow-shader-in-urp.849178/
    https://forum.unity.com/threads/urp...hadows-exclusively-from-other-objects.871561/
    https://forum.unity.com/threads/wat...adows-universal-render-pipeline-order.748142/
    https://forum.unity.com/threads/matte-shader-only-shadows-in-hdrp.740684/

    This is the only poor hack I was able to find by experimenting but it still multiplies the colors behind it. There are no combination of settings to my knowledge that allows alpha 0 while showing shadows properly.

    upload_2022-5-20_12-32-41.png

    upload_2022-5-20_12-34-15.png
     
  2. Ruhan-_-

    Ruhan-_-

    Joined:
    Sep 14, 2016
    Posts:
    20
  3. Mr_FJ

    Mr_FJ

    Joined:
    Sep 4, 2013
    Posts:
    7
    With URP 3.1.8 I get this error when I import the package:
    Code (CSharp):
    1. Shader error in 'Shader Graphs/ShadowReceiver': Couldn't open include file 'Packages/com.cyanilux.shadergraph-customlighting/CustomLighting.hlsl'.
    Can anyone help? :)
     
  4. Ruhan-_-

    Ruhan-_-

    Joined:
    Sep 14, 2016
    Posts:
    20
    I'd recommend updating to Unity 2021. URP 3.1.8 is very outdated.
    As per your problem, the github root directory has the CustomLighting.hlsl file that the shader is complaining about. Move it to a new directory like root Asset folder and change that line in the shader file to point to 'Assets/CustomLighting.hlsl' instead of 'Packages/com.cyanilux.shadergraph-customlighting/CustomLighting.hlsl'

    upload_2022-8-26_15-13-19.png
     
  5. two7two

    two7two

    Joined:
    Aug 3, 2023
    Posts:
    9
    Hi, unfortunately this method is only for directional light. How do I support other lighting sources?
     
  6. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,969