Search Unity

Even lighting for 2D sprites? (Problem with Directional Light)

Discussion in '2D' started by _eternal, Apr 15, 2016.

  1. _eternal

    _eternal

    Joined:
    Nov 25, 2014
    Posts:
    304
    I'd love to set my game up with Unity lighting with the SpriteDiffuse shader, since it seems more straightforward than fiddling with something like Sprite Lamp.

    However, I'm having trouble illuminating my sprites at all. When I try hitting my tiles with a directional light, some parts of the screen show up brighter than others based on the light's rotation. See this gif for the unnatural sheen I'm talking about.

    Is there any way to hit all of my sprites with a flat, even light?
     
  2. Hyblademin

    Hyblademin

    Joined:
    Oct 14, 2013
    Posts:
    725
    It's really hard to tell what the problem is in the example you gave us, because it's rather low quality and the light is dim.

    If you want all sprites to have the same illumination, just change the ambient light in Lighting view under the Scene tab.
     
  3. LiterallyJeff

    LiterallyJeff

    Joined:
    Jan 21, 2015
    Posts:
    2,807
    Which direction is the directional light facing? If you have it face straight down the positive Z axis (camera's facing direction), everything should be lit an equal amount.
     
  4. _eternal

    _eternal

    Joined:
    Nov 25, 2014
    Posts:
    304
    Thank you! Somehow I never realized that environment lighting was a separate thing from individual light components. I can work around this if I have to, but is there no way to apply a culling mask to ambient light?

    That doesn't work - even when the light's rotation is (0, 0, 0), the middle of the screen is a bit brighter than the rest (see the house in this example).
     
  5. LiterallyJeff

    LiterallyJeff

    Joined:
    Jan 21, 2015
    Posts:
    2,807
    Are you certain you're using a directional light and not a point light or spot light? Directional lighting shouldn't have hot spots like that.

    Also make sure your light is at a lesser Z value than the thing being lit.

    http://docs.unity3d.com/Manual/Lighting.html