Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

2D WebGL Build is very dark, unplayable (linear fog not working?)

Discussion in 'Unity 5 Pre-order Beta' started by scarletshark, Dec 8, 2014.

  1. scarletshark

    scarletshark

    Joined:
    Jun 6, 2013
    Posts:
    33
    I've provided the following image to explain my issue. Just FYI, the WebPlayer build works approximately the same as the image labeled "Unity Editor." My issue is that using the new Unity WebGL build target, I cannot achieve the same level of brightness for my 2D game. It renders the game virtually unplayable on certain monitors.

    I was of the impression that the default 2D sprite material was unaffected by lights. This means that what we're seeing is not a lighting issue, but potentially a color space or gamma related issue.

    The image labeled "WebGL 2.5 Gamma" has had its levels shifted in Photoshop.

    WebGL-Gamma.png
     
    Last edited: Dec 9, 2014
  2. siliwangi

    siliwangi

    Joined:
    Sep 25, 2009
    Posts:
    303
  3. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,664
  4. scarletshark

    scarletshark

    Joined:
    Jun 6, 2013
    Posts:
    33
    Linear lighting was part of the issue, but the build is still quite a bit darker. I have pushed a bug report.

    Conceptual question: why isn't the lighting mode automatically switched to gamma during a build in an unsupported platform?
     
    Last edited: Dec 9, 2014
    DanSuperGP likes this.
  5. scarletshark

    scarletshark

    Joined:
    Jun 6, 2013
    Posts:
    33
    Update: Using "gamma" color space, the light is still shifted. Previously I had to gamma correct in Photoshop by 2.5, but now I only have to shift by about 1.8

    WebGL-Gamma2.png
     
  6. scarletshark

    scarletshark

    Joined:
    Jun 6, 2013
    Posts:
    33
    Ok. I've determined that this is not an issue with lighting.... It appears to have to do with fog. See below:

    I have the scene set to linear fog (0 to 1). Camera clipping plane is at 1500, and the object in the background is at 800. The effect appears to be that the fog intensity is about 10% of the intensity in the editor.

    WebGL-Gamma3.png
     
    Last edited: Dec 9, 2014
  7. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,664
    Do you have a case number for your bug report?
     
  8. scarletshark

    scarletshark

    Joined:
    Jun 6, 2013
    Posts:
    33
    Jonas, Please see report # 654767
     
  9. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,664
    FYI, i just took a quick look at this - the problem does not seem to be a WebGL issue, but a broader issue with fog being inconsistent between platforms. On OS X, fog looks the same in the editor and in WebGL, but on windows it is much brighter in the editor then both WebGL or OS X. I suspect that our OpenGL (and related) platforms differ from DirectX here. Our graphics team will look into this.