Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    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

Feature Request Turn off "Receive shadows" on custom PBR graph [LWRP]

Discussion in 'Shader Graph' started by WendelinReich, Apr 8, 2019.

  1. WendelinReich

    WendelinReich

    Joined:
    Dec 22, 2011
    Posts:
    225
    Hi, standard LWRP "Lit" and "Simple Lit" shaders have a checkmark for turning off "Receive shadows" (see below. There needs to be something similar for custom lit graphs.

    upload_2019-4-8_11-3-51.png

    Also, as of 2019.1 (I'm using b8), the MeshRenderer component doesn't have a checkbox for "Receive shadows" anymore, so right now (as a mobile dev) I'm pretty stuck...

    upload_2019-4-8_11-2-44.png
     
    patrickdown likes this.
  2. Kink3d

    Kink3d

    Unity Technologies

    Joined:
    Nov 16, 2015
    Posts:
    45
    Hi,

    This has been on our radar for some time now. Hopefully we will get to implementing this soon (it was/is dependent on some refactor work that is currently going on).
     
    patrickdown and WendelinReich like this.
  3. WendelinReich

    WendelinReich

    Joined:
    Dec 22, 2011
    Posts:
    225
    That's good to know. It would be great if you could treat this as a bug or somehow prioritize it, because it makes shadows on performance-sensitive devices unusable ATM (turning off shadows altogether seems to be the only way to avoid the performance penalty of having too many unwanted shadow receivers)...
     
    pauliusuza likes this.
  4. WendelinReich

    WendelinReich

    Joined:
    Dec 22, 2011
    Posts:
    225
    Hi @Kink3d, any ETA on this one?
     
    ZhavShaw likes this.
  5. Knipscher

    Knipscher

    Joined:
    Jun 20, 2018
    Posts:
    77
    Hi I'm also very interested in this but especially for the HDRP! I have a feature in my current project that absolutely depends on it (especially implementable for only front- or back-facing, so turning it off on the mesh renderer won't help). I don't really speak HLSL so I'd rather not have to write a custom node for it if it's going to be on the horizon within the next couple months -- @Kink3d is there an ETA? Thanks!
     
    WendelinReich likes this.
  6. jessemoreland0

    jessemoreland0

    Joined:
    Apr 10, 2018
    Posts:
    1
    I also need this functionality.
     
    WendelinReich likes this.
  7. tarahugger

    tarahugger

    Joined:
    Jul 18, 2014
    Posts:
    129
    I need it too.
     
    WendelinReich likes this.
  8. Jeffrey-Lee

    Jeffrey-Lee

    Joined:
    Nov 8, 2012
    Posts:
    2
  9. WendelinReich

    WendelinReich

    Joined:
    Dec 22, 2011
    Posts:
    225
    I think this thread should get a response from a Unity employee...
     
  10. jensen_305

    jensen_305

    Joined:
    May 15, 2018
    Posts:
    23
    Also looking for this feature.

    Since this comes up on Google Search and others may want to know how to turn receive shadows off as of 9/19/2019.

    Work around:
    Open Shader in Shader Graph. Right click the master node and select view code. Copy the code and in Unity create new shader of the standard type so it opens in an editor. Open the file and paste the code in and add the following line near the top, you'll see other #pragma stuff where it should go.

    Code (CSharp):
    1. #pragma shader_feature _RECEIVE_SHADOWS_OFF
    Save the shader file. In Unity select the new shader right click and create a new material from it. This material will no longer receive shadows.

    Note:
    Only downside is any change to the Shader Graph and you have to redo this.
     
    Last edited: Sep 20, 2019
  11. zezba9000

    zezba9000

    Joined:
    Sep 28, 2010
    Posts:
    795

    > #pragma shader_feature _RECEIVE_SHADOWS_OFF
    -- this doesn't seem to be working for me in 2019.3 beta.
    I'm shocked this option is missing. I'm making a simple ground fog shader for VR and this is the only missing thing.
     
  12. WendelinReich

    WendelinReich

    Joined:
    Dec 22, 2011
    Posts:
    225
    Does anyone know whom at Unity to make aware of this thread? Then please do. (Not getting a response from @Kink3d). This seems like such a blatant omission....
     
  13. LandonTownsend

    LandonTownsend

    Unity Technologies

    Joined:
    Aug 21, 2019
    Posts:
    32
    You can do this with the new "keywords" feature added in 7.1.1. Unfortunately we ran up against some engine limitations when developing keywords that makes doing this a bit hard to figure out, but it's still possible.

    Step 1:
    Add the following keyword to your shadergraph. Make sure the options are the same.
    upload_2019-9-27_11-13-41.png
    Step 2:
    Make a material with the shadergraph, and select the material in the inspector.
    Click the three dots in the upper right corner of the inspector and choose "debug".
    upload_2019-9-27_11-27-30.png
    Add your keyword to the "Shader Keywords" box:
    upload_2019-9-27_11-28-14.png

    And you're done.
    upload_2019-9-27_11-29-0.png

    upload_2019-9-27_11-29-13.png
     
    polemical, aminere, EZaca and 4 others like this.
  14. zezba9000

    zezba9000

    Joined:
    Sep 28, 2010
    Posts:
    795
    @LandonTownsend What version of Unity should be used with this ideally? Is the beta good enough or alpha preferred?
     
  15. LandonTownsend

    LandonTownsend

    Unity Technologies

    Joined:
    Aug 21, 2019
    Posts:
    32
    I did this on version 2019.3.0b4, as long as you at least have that version it should work. Remember to back up your project before upgrading.
     
  16. ClayChi

    ClayChi

    Joined:
    Mar 30, 2018
    Posts:
    8
    I tried using keywords.
    It looks like I can't make unlit shader to receive shadows with _RECEIVE_SHADOWS_ON / OFF keywords.
    But it works for PBR to not receive shadows.
     
    Last edited: Nov 24, 2019
  17. theonenr

    theonenr

    Joined:
    Aug 4, 2014
    Posts:
    19
    Thanks, works fine.
    But i wana receive the lighting settings fog in exponential mode too. I tried with the same steps and added FOG_EXP keyword as boolean from the global keywords in the shadergraph and in material keywords, but it does not work :(
    What am I doing wrong?
    shader_prob1.png
    shader_prob2.png
     
  18. Knipscher

    Knipscher

    Joined:
    Jun 20, 2018
    Posts:
    77
    @LandonTownsend Adding _RECEIVE_SHADOWS_OFF, or any keyword, to a Shader Graph breaks subsurface scattering -- it's as though subsurface scattering isn't enabled at all. Is this as expected? Thanks!

    (I'm using 2019.3.0f1, HDRP version 7.1.6)
     
  19. jp_xsi4life

    jp_xsi4life

    Joined:
    Jan 2, 2020
    Posts:
    6
    @LandonTownsend Any update on this for 2020.1? Is the debug / keywords workaround the only way to do this?
     
  20. Dorodo

    Dorodo

    Joined:
    Mar 8, 2015
    Posts:
    40
    Any updates on this? The workaround works but is pretty bad to deal with on a pipeline basis.
     
    WendelinReich likes this.
  21. tealm

    tealm

    Joined:
    Feb 4, 2014
    Posts:
    95
    Also wondering if there is any update on this? Workaround is not an option for us, because of generating too many variants by adding additional keywords.
     
unityunity