Search Unity

Question Need help with lighting for characters.

Discussion in 'Global Illumination' started by MrZeker, Jun 20, 2020.

  1. MrZeker

    MrZeker

    Joined:
    Nov 23, 2018
    Posts:
    227
    Hello
    Im starting to make a game that is going to be more perfomance-heavy than my first one, and i can't use the same trick that i used before of using 5 lights to make the characters look the way i want.

    I found a lot of tutorials about lighting for environment and static objects, but i can't find anything for dynamic objects.
    My problem is the following:

    This is how my character looks when the camera is facing the Directional light direction.

    this is how my character looks when my camera is facing the opposite direction.

    I want to have a less burned-out color all around, and not get that ugly effect when not receiving light from the directional light.

    In this scene there isn't any other lights yet.
    What lights should i use?
    Im going for 3d action game with guns and swords, with lots of environmental stuff and up to 9-10 enemies on the screen.
    How many lights i can use to do not destroy performance? and what kind of lights?
    I know it is a lot of questions, but i can't seem to find answers,
    thanks.
     
    BrandyStarbrite likes this.
  2. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    Few things:
    -Attach the directional light to the camera. That way whatever the camera is facing will always be bright. But you may see the shadows rotating as the camera rotates as a side effect. For that you might want to turn the shadows off and use other lights to cast shadows.
    -You could put the characters and dynamic objects on a separate layer that makes them get affected by a light that only affects those characters and does not cast shadows.
    -Attach a spotlight above the character or to the characters face depending on how you want it to be lit. That way no matter where the character goes or where they face they will always be lit. Turn off shadows for that light.
    -Messing around with the self illumination in the shader of the characters you want always lit.

    In terms of how many lights Unity can handle it's a lot as long as only 1 or 2 of them are casting shadows. The more shadow casting lights the worse off your performance.
    My advice is you can have as many lights as you like but only have shadows on 1 or 2 of them for performance and you should run shadow quality at medium.

    If you want everything dynamic then I highly recommend using the strategies above.
    There is one last trick I use to map a full arena and that is putting 2 directional light one in the north east and one in the south west so they are directly diagonally opposite to each other in each opposite corner and it's ok to have both that cast shadows. The result is a good balance of brightness without any dark areas or any need for extra tricks.
     
  3. MrZeker

    MrZeker

    Joined:
    Nov 23, 2018
    Posts:
    227
    Thanks i tried some of these settings, in the end the prblem was the shader!