Search Unity

Question Most efficient way to achieve glow effect and matching 2D light for main character

Discussion in '2D' started by lorenzoteslermabe, Mar 20, 2021.

  1. lorenzoteslermabe

    lorenzoteslermabe

    Joined:
    Dec 23, 2020
    Posts:
    24
    Hi all,

    What I am trying to achieve is this: Part of the main character in our 2D project is a lightbulb, and I would like the lightbulb itself, as well as the light it emits, to change colour and intensity based on what is happening in the game.

    My question regarding this objective is in two parts:

    1. My first instinct is to have a simple custom shadergraph shader, through which I can implement an emission layer (on just the filament, for example) and control the colour and intensity of the emission through script. Along with this, I would have a 2D light parented to the character, which I would also control through script. Ideally these would be synced quite closely, as they together would represent the light emitting from the lightbulb. Am I in the ballpark here, or should I rethink my strategy?

    2. Assuming that the above is close to hitting the mark, I am wondering about the best way to make the emission layer. I find that there is very little information online about emission layers and 2D sprites (or even in general), so thanks in advance! My understanding is that, upon creating a separate spritesheet for each animation, I should closely trace over the parts I want to glow with white. I should then put this new white layer on a black background, and then this white-on-black would be the emission layer. Is there an easier way for me to achieve this effect, for example by having the artist add this emission layer in as they build the original sprites? Or perhaps an emission layer isn't needed at all, and the filament can just be its own texture? I am very very unknowledgeable in this arena as you can tell. If you are confused by what I've just said (don't worry I am too), please refer again to my main objective at the top, as I may just be approaching this all the wrong way.

    Any other feedback/advice is welcome, as are any clarifying questions. Thank you so much :)

    -Lorenzo