Search Unity

Lighting not working right

Discussion in 'Getting Started' started by NermNermNerm, Nov 24, 2019.

  1. NermNermNerm

    NermNermNerm

    Joined:
    Jan 21, 2019
    Posts:
    4
    I'm new to Unity, and am hitting a lighting issue that I can't figure out. This game object is not getting lit correctly:

    \

    The problems are many. The bottom part of the object isn't getting lit at all, even though the light source is actually below it. The top (which is composed of 3 different objects), is getting lit, but it seems to me that the light is calculated as if the object was facing the light differently (e.g. why is it so bright on the top? Why is there such an abrupt cutoff between one piece of the top and the other?)

    Extra data: I'm trying to mod Kerbal Space Program; The part was imported as a .blend from Blender; The material is KSP's "bumped specular" shader. Inside the game, the lighting on the lid is just as wonky as it is in Unity, but the lighting on the trunk seems at least close to correct.
     
  2. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,791
    That’s a directional light, that means it doesn’t really matter where it’s positioned but rather how it’s rotated.
     
  3. NermNermNerm

    NermNermNerm

    Joined:
    Jan 21, 2019
    Posts:
    4
    Ah, I thought it was like a flashlight, but really it's like a point-source direction light like the sun that's way off in the distance. That partly solves the mystery, but you can still see something amiss in the lid, right? And the trunk still doesn't seem like the highest glare is where it should be. Here's another shot:
     
  4. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,791
    What shaders are you using?

    Also go to mesh import settings and set Normals to Calculate
     
  5. NermNermNerm

    NermNermNerm

    Joined:
    Jan 21, 2019
    Posts:
    4
    Thanks for your help so far! The shaders are from KSP's "PartTools" collection and it's called "Bumped Specular". Calculating the Normals didn't have an effect (not surprising since KSP's one of those games that doesn't render correctly if they're not right.)

    Also, I should have mentioned this before, the 3 lid doors were done in Blender with the "Linked Duplicates" feature. I suspect that might have something to do with it. The ownership chain for the doors is the door clamshell is parented to a little hinge part (you can see it sticking out a bit) which is parented to the main thing. There are animation sequences to open the clamshell and close it plus some other stuff for the inside.
     
  6. NermNermNerm

    NermNermNerm

    Joined:
    Jan 21, 2019
    Posts:
    4
    Given what you were saying about the shaders, I tried dorking with the shaders and found that any of the ones that used my bumpmap showed this effect and the KSP shaders that didn't worked fine. The Unity "Standard*" shaders both have the same lighting problem that the KSP "bumped" shaders do.