Search Unity

Lighting - Interior of characters

Discussion in 'General Graphics' started by Tubb_1977, Jan 29, 2019.

  1. Tubb_1977

    Tubb_1977

    Joined:
    Oct 13, 2017
    Posts:
    10
    Hi all, hoping to find decent solution to this, and I've seen the problem in a few games..

    I've got an NPC bulit from character creator.. my problem is that whenever the NPC speaks, we see the inside of it's mouth, which recieves just as much light as rest of the body..
    Ideally the interior would be in shadow most of the time, with only a small part receiving light/reflections etc..
    Any tips for dealing with this?
    Using a standard material, in Unity 2018.

    thanks!
     
  2. BIGTIMEMASTER

    BIGTIMEMASTER

    Joined:
    Jun 1, 2017
    Posts:
    5,181
    look up "ambient occlusion"

    it's another texture map you'll need, but there is also ambient occlusion that can be added through post process.

    Besides that though, it does seem weird that your lights are shining right into there. Where is the light source coming from? Does changing the angle help? Is the inside of the mesh sealed shut?
     
    Tubb_1977 likes this.
  3. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,609
    Use an occlusion map for it. Map the mouth to a dark spot. That's what these are for.
     
    Tubb_1977 likes this.
  4. bobisgod234

    bobisgod234

    Joined:
    Nov 15, 2016
    Posts:
    1,042
    I have had issues using Occlusion maps for mouths, where a light shadow does not get cast in the mouth, and so part of the mouth still lights up brightly. I have found baking that part of the occlusion map into the albedo works well.
     
    Tubb_1977 and BIGTIMEMASTER like this.
  5. BIGTIMEMASTER

    BIGTIMEMASTER

    Joined:
    Jun 1, 2017
    Posts:
    5,181
    b-b-b-but that's cheating!
     
    Tubb_1977 and bobisgod234 like this.
  6. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,342
    Unity's occlusion map applies to ambient lighting, and this is a good example case for it (generally you'd want to bake the occlusion map with the character's mouth slightly open). However this doesn't help for direct lighting. The cheap solution is indeed to apply the AO to the albedo texture inside the mouth. For best results you might need to use the Standard "Specular Setup" shader instead (now called something else?) and black out the Specular color as well.


    More recent AAA games, and Unity's own demos from the past, do a couple of things special for this. They may use high resolution per-character shadows, or rely on screen space AO, screen space reflections, and screen space raytraced shadows to cover these smaller areas that shadow maps miss and which baked maps don't represent well. Yes, I said raytraced shadows. And by "recent" I mean the last 10+ years as I think the first Crysis game was the first to do it back in 2007, so this isn't some new fangled RTX thing.

    I think Unity's HDRP has this as a feature now, and there are two assets on the store that do this for the entire screen. But those older games would limit it to faces or characters.
     
    Tubb_1977 likes this.
  7. Tubb_1977

    Tubb_1977

    Joined:
    Oct 13, 2017
    Posts:
    10
    Thanks for all the suggestions..I'm gonna experiment with these options!