- Home /
Making Sprites Darker / Shadowed?
I have a 2d game made of sprites (made of PNG files). I have no light sources, just the natural color of the sprite image files.
I would like to make everything darker evenly as the sun goes down but I don't see how I can do that. I also want to add light sources light torches that light up a small area.
Right now, I can't get any light sources to do anything in my 2d sprite world.
Thanks!
RJ
if you slide the color property towards black in the sprite renderer, The sprite should get dark I think. Have you Tried it?
Hi, yeah I tried that, but i can only set the red green blue alpha settings. technically I can make it darker using this, but the shade changes a little. there is no slider to make it lighter or darker while staying on the same shade - such as they have in photoshop, or even $$anonymous$$S Paint.
But that color editor has an alfa channel, doesn't it?. Have you tried select the black color rgb(0, 0, 0) and just move the alpha to reflect opacity?.
Wouldn't that create a semi-transparent all black silouette of my sprite?
Answer by RayJr · Feb 06, 2015 at 04:21 PM
For future readers - I solved this and it's pretty simple.
Any sprite you load into Unity has RGB values of 1,1,1, which technically is white. But for a png sprite for example, 1,1,1 translates to displaying the sprite the way it was imported.
So to change that, you simply need to adjust the RBG values EQUALLY between 0 and 1 - not the normal 0 to 255 that we have in other programs.
To make a sprite black, set RGB to 0f,0f,0f. To make a sprite slightly shadded, Set RGB to 0.8f,0.8f,0.8f To make a sprite almost black, set RGB to 0.2f,0.2f,0.2f
You get the idea. When you do it this way, the multi-colored sprite will evenly change to darker shades. All numbers between 0 and 1 will work but they have to be equal across all three RGB values, otherwise you will change the hue.
Good luck!
Your answer
Follow this Question
Related Questions
Casting sharp 2D shadows side on 0 Answers
Point light shadows broken? 0 Answers
Get sprites from a Texture2D 1 Answer
Shader Sprite/diffuse add shadow on spotlight 0 Answers
1px Gap Between 2D Sprites 2 Answers