2D Sprite Ligthing Problem

Hi
I spend hours on this problem, (I’m a noob)
I have problem to get light on my 2D game.
I want to put Static Light, it work perfectly if I put the TranslucentLitSpriteMaterial on all of my Sprites (Character, Tilemap)
BUT, I see my character to the top of the tilemap (Because of the Material)
And I can’t get the light on without this material. I tried to watch tutorial, modify the DefaultSpriteMaterial, but it’s only working with Directional Lights.
Thanks if you take the time to read, Thanks if you answer.

With the TranslucentLitMaterial (Work fine for the light)


But this happening
And this is with the DefaultSpriteMaterial (set with the right option, Emissive Color, Constant on Specular and Roughness with Default Lit)

I would use the MaskedLitSpriteMaterial, that works perfect with lighting. Just make sure, that your directional light is really shining on the right side of your map, and not at it´s backside ^.^
Then you can place smaller lights too, and they will (should) affect your tilemap and your chars.
For your char being on top of your buildings, you would need to separate those parts into two layers, where one is the background, where your char will be in front of (walking on), while the second layer (you may call it foreground layer) will be above the player, and therefore hiding him, if he walks in that area.

A simple example map with some lights (no directional light, but that works too, it was just an evening scene, that did not require a sun/directional light), plus some parts, that cover the character.

Edit: corrected a typo, confused with lit with unlit -.-´ lit for using with lights, unlit for emissive and ignoring lights

100% Use MaskedLitSprite Material

if you want to use Lights with your Sprite then it’s Lit
if your not using Lighting then it’s Unlit

translucent gives weird results

image

1 Like