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. Dismiss Notice

Transparent/translucent sprites appear more opaque in WebGL build than in Editor

Discussion in 'WebGL' started by archiesteel, Jan 27, 2016.

  1. archiesteel

    archiesteel

    Joined:
    Jun 29, 2015
    Posts:
    15
    I've run into a minor yet annoying visual bug while testing the WebGL builds of the game I'm currently working on. It appears that translucent sprites/UI elements appear much less so in the browser builds than in the Editor or Standalone builds. I've included screenshots of a UI screen below for comparison, as well as comparison between the pause screen (which features a translucent dark background overlaid on the game scene) in the Editor and on Firefox. I get similar results on Chrome as well.

    levelselection_editor.PNG levelselection_WebGL_on_Firefox.PNG pausemenu_editor.PNG pausemenu_WebGL_on_Firefox.PNG

    Does anyone know if there is a workaround? Obviously this isn't a critical bug, but if there's a solution or a forthcoming fix then that would save me time as otherwise I need to guess the correct Alpha value for sprites before building the game (and basically need two values if I want to have a Standalone version as well as the WebGL one).

    Thanks!
     
  2. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    Would you please submit a bug report with a repro project for us to investigate ?
     
  3. archiesteel

    archiesteel

    Joined:
    Jun 29, 2015
    Posts:
    15
    Sure, I'll do that tomorrow and post here when it's done. Cheers!
     
  4. archiesteel

    archiesteel

    Joined:
    Jun 29, 2015
    Posts:
    15
    Okay, that's really weird, I did a small sample bare-bones project to test this and I'm unable to reproduce it (i.e. it looks identical in the Editor and WebGL build...). I'll have to investigate my project a bit more to see why it's behaving differently.
     
  5. archiesteel

    archiesteel

    Joined:
    Jun 29, 2015
    Posts:
    15
    All right, I found out what the problem was. If you set the ColorSpace to Linear in the Standalone Player Settings, it will affect what you see in the Editor even if your project is currently set to WebGL, but since WebGL does not support Linear ColorSpace the results in the build will be different from what you see in the Editor. So basically I've got to reset all of my transparency values as I set all of them while being in Linear ColorSpace. :-/

    I'm not sure this should be considered as a bug unless the expected behavior is for the Editor to reproduce the final look of the currently selected platform, in which case the Editor should automatically switch to Gamma ColorSpace when WebGL is selected as a Platform to avoid this type of confusion.

    Sorry for having wasted your time, I feel a little bit stupid now...
     
  6. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    that makes sense. Though it's somewhat expected, ideally we should log a warning at build-time.

    Which version of Unity are you using ?
     
  7. archiesteel

    archiesteel

    Joined:
    Jun 29, 2015
    Posts:
    15
    Yeah, some kind of warning would likely help.

    I'm using 5.2.4, but we'll probably switch to 5.3.x before the end of the project, which is due in April.