Search Unity

Lighting does not match between Game View and Player

Discussion in 'Global Illumination' started by mattnewport, Feb 26, 2016.

  1. mattnewport

    mattnewport

    Joined:
    Jan 29, 2016
    Posts:
    10
    I'm trying to get to the bottom of an issue with lighting in my project where lighting in the Game View does not match lighting in the Player (this is running both the editor and standalone player on Windows 10). The screenshot below illustrates the difference - the GameView is on the left and the Player on the right:



    The sphere is clearly darker on the underside in the Player than in the Game View but there are also some subtle differences between the lighting on the walls. This screenshot is from a minimal test project I created to try and isolate the issue, you can download a .zip here.

    Things I've tried that do not make the discrepancy go away: Deferred vs. Forward, Linear vs. Gamma, HDR vs. non HDR camera, forcing the Player to use Direct3D 11. The issue is much less visible if I turn off light probes on the sphere but there are still subtle differences. Turning reflection probes off on the sphere doesn't make much difference. Turning off Precomputed Realtime GI does appear to eliminate the difference which is why I'm posting this here. I'm not using Baked GI in this scene.

    Does anyone have any idea what might be going on here? Any suggestions for how I can make the Player lighting match the Game View? In my real project this is causing a lot of headaches since I can't get the lighting to look the way I want in the player when it doesn't match the game view (there's a major discrepancy in my real project, more visible throughout the scene than in this cut down sample). I'd also appreciate it if anyone can try out the test project and let me know if they see the same discrepancy.
     
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    5,623
    If you disable Light probes from the sphere, then it looks quite similar to built version.. sounds like a bug?

    (tested on 5.3.2p1 in editor, and your exe)

    lighttest.png
     
  3. mattnewport

    mattnewport

    Joined:
    Jan 29, 2016
    Posts:
    10
    When I tested with light probes disabled on the sphere it looked very close but I thought I could still see some lighting differences. Your screenshot looks pretty much identical though. It does look like it is an issue with light probes but I really can't turn them off for my scene. Hard to tell if this is a general bug that just is particularly visible with my lighting setup or if there's something about the way I have them set up that is making the bug appear.

    I'm wondering if it's possibly related to using substance materials. There is some bug in 5.3.2f1 around generating the textures for substance materials. I thought I'd worked around it by setting their Load Behavior to "Bake and discard Substance" but I've noticed it popping up again in the editor. If the marble floor substance material was black when generating the light probes it might explain the much darker lighting.
     
  4. mattnewport

    mattnewport

    Joined:
    Jan 29, 2016
    Posts:
    10
    On further investigation I think this is a substance related bug. I manually baked out the textures for the floor in Substance Designer and created a material using those rather than using the substance directly in Unity and that seems to resolve the lighting issue in the Player.
     
  5. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    5,623
    tried with 5.3.3p1, same results as 5.3.2p1..
     
  6. mattnewport

    mattnewport

    Joined:
    Jan 29, 2016
    Posts:
    10
    Thanks for testing. I think it's maybe related to this issue with substance integration in Unity. Allegorithmic are saying it should be fixed in 5.4. For now I've got a workaround that solves my immediate lighting problem.