- Home /
Way to have 2D Sprites lit by Lights?
Is there any way to have lights actually apply lighting to 2D textures, without losing the transparency of the sprite? I have been using the Particles/AlphaBlended Shader to display my sprites.
I would like to have a dark room, and allow the player to use a light to make his way through, but I can't seem to make lights work.
If there isn't a way to make the stock lights work, then does anyone have another suggestion? I have heard of many ways to achieve similar effects, but I am not sure of the best approach considering Unity is built different than Engines I am used to.
Thanks -Kreed
Answer by zee_ola05 · Feb 23, 2014 at 08:34 PM
Create a material and use Sprite/Diffuse shader. Drag it to your sprite gameObject to apply the material. Voila!
Answer by Noob_Vulcan · Jul 30, 2015 at 03:34 AM
Sprites-default material does not respond to lights , but unity also supports another shader (Diffuse ) for sprites that supports lighting.
You just have to change the shader in Sprite renderer component
For more detail you can refer LINK REMOVED DUE TO MALWARE
That link won't let me open it until I install a Firefox Plugin, which I am definitely NOT going to do. Do you have a link which is less sketchy?
BEWARE: The link leads to malware, mods, please remove it.
YES! BEWARE! If clicked, do yourself a favor and run $$anonymous$$alwareBites.
Answer by Eric5h5 · Dec 13, 2011 at 09:04 AM
On the particle renderer material, use a shader that uses lighting.
I am confused by your comment. What do you mean by the "particle renderer material"?
Oh, I believe you misunderstood the question. I am using a texture on a plane for my character's sprite. I want to light him, not a particle system.
Well, same answer basically...on the sprite renderer's material, use a shader that uses lighting.
Your answer
Follow this Question
Related Questions
Lighting looks really weird in 2D game 1 Answer
Set Light2D sprite via scripting 1 Answer
2D Flashlight for a platformer 2 Answers
How to Change to the Same Point in Another Animation 0 Answers
Strange artifacts in builds 0 Answers