Search Unity

Question Have parts of a sprite that are not affected by light

Discussion in '2D' started by bzkarcade, Jul 24, 2020.

  1. bzkarcade

    bzkarcade

    Joined:
    Oct 5, 2017
    Posts:
    21
    For example in the following image the pink part I do not want to be affected by light, but the gray part I do want it to be affected by light
    Untitled2.png

    Testing at Unity 2020

    Normal behavior is that the entire sprite undergoes light changes, with the "Sprite-Lit-Default" Material.

    cap_103.JPG

    What I can easily think of is separating the sprites into two parts and selecting the "Sprite-Unlit-Default" material for the part I don't want to light up. This works well for my static items in the game. But I have some animations it would be very difficult to work this way.

    I have thought of an approach that might work.

    With a shader define an outline and I know that only that part is affected by light, although it is not exact. At the moment I have my outline with the Shader Graph but what would I have to do to get the result I want.

    cap_104.JPG

    Oh I'm getting too complicated and is there a more natural way to do this?
     
  2. adehm

    adehm

    Joined:
    May 3, 2017
    Posts:
    369