Search Unity

Question Shader graph main light shadow mask

Discussion in 'Shader Graph' started by ntjahero, May 13, 2020.

  1. ntjahero

    ntjahero

    Joined:
    Jun 18, 2018
    Posts:
    9
    Hi guys.
    Sorry if it's answered somewhere, but I couldn't find any working example for shader graph.
    So my case is this:
    I'm fooling around with shader graph and want to make a comic book style shader, which will work with the HDRP, because I want also to be able to use all the cool post effects available. I managed to get the direction of the main light via a custom HLSL shader node, like this:
    Code (CSharp):
    1. DirectionalLightData light = _DirectionalLightDatas[0];
    Now, I can't find any usefull help about what is this _DirectionalLightData, and what else can I get from it.
    So back to the question - is there a way to get the shadow from the main light, I don't need more than one light for now.
    If it's of any importance, I'm using unlit shader with 'shadow matte' ON, so I got shadows, but I want to do some stuff with them.
    Stay safe and thanks in advance!
     
  2. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    1,553
    Hi @ntjahero,
    You can also get the main/first directional light by adding a property, which has a Reference field with the correct built-in keyword, in this case _WorldSpaceLightPos0.
     
  3. ntjahero

    ntjahero

    Joined:
    Jun 18, 2018
    Posts:
    9
    Thank you for the suggestion, but it doesn't work in my case. May be it's because directional lights have only direction, no position... or at least that's the concept in every other software I know. Anyway, it's not the direction, but the shadows, that are giving me headache
     
  4. Jakems

    Jakems

    Joined:
    Nov 23, 2017
    Posts:
    6
    Did you find any solution?