Search Unity

Question Partially lit shader

Discussion in 'Shader Graph' started by PaCoStudio, Jul 29, 2021.

  1. PaCoStudio

    PaCoStudio

    Joined:
    Apr 4, 2019
    Posts:
    1
    Hi,

    I am using URP and shader graph to light 2d sprites in a 3d environment... kinda like paper mario. the sprites have a lit shader graph material, and cast / recieve shadows, in the inspectors debug mode set to ON, so that the recieve and cast shadows. Everything is working fine so far.

    Now I am looking for a way to do a rim light effect. Meaning, at the moment the whole texture is affected / illuminated by the light. I would rather have this only at the edges to be the case.

    I was thinking about doing a secondary texture channel with a mask and somehow tell shader graph only light those parts that are masked. Or combine lit and unlit shaders but there is no way to add a second shader and combine them like in blender for instance as far as I am aware of.

    Do you guys have any suggestions?

    Thanks!
     
  2. lilacsky824

    lilacsky824

    Joined:
    May 19, 2018
    Posts:
    171
    If you use lit graph, you can't control which part should lit.
    So the only way to do this with shader graph should be use unlit graph then calculate lighting by yourself.

    However what you want to do is rim lighting. Rim lighting's result should be as emission.
    I think you can just use texture to mask rim lighting(emission) .