Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Pointlight in a 2D game

Discussion in '2D' started by Sonatai, Aug 14, 2019 at 11:59 AM.

  1. Sonatai

    Sonatai

    Joined:
    Jan 14, 2018
    Posts:
    1
    Hi,
    we are developing a 2D game and wanted to use pointlights.
    We saw the following tutorial about light in 2D games:

    Because we wanted an advanced lighting we are using our own "normal map", but the pointlight don't behave like it should. Just half of the circle illuminate the map, the other half is just black. We tried some solution approaches, but nothing works.

    We tried to change the configuration of the normal map, also tried to import first as texture than as normal map.
    Also we tried to change the property of the light or the z position but we have still the problem. We don't know what else we could try, that's why we hope, that someone could help us from the forum.

    I attached a picture of the problem and a picture of the property from the normal map.
     

    Attached Files:

  2. Gambit-MSplitz

    Gambit-MSplitz

    Joined:
    May 16, 2015
    Posts:
    1,181
    I do not believe your normal map was made correctly. Most of your map is yellow, which represents a surface which is facing up and to the right from the viewers perspective, so it makes sense that it only receives the light shining down and to the left (against the direction of the normal map).

    Below is a normal map of a cone. The yellow faces the upper right. If you want different parts of your map to receive light from different directions, you will need to use the normal colors from the appropriate direction. The solid blue-ish purple outside the cone is the normal color you should use for flat surfaces, like the ground, that should receive light from "above" it instead of a particular direction.

    C1.PNG

    Good luck!
     
    Last edited: Aug 14, 2019 at 8:10 PM