Search Unity

Linear color space in WebGL

Discussion in 'Web' started by edredar, May 11, 2015.

  1. edredar

    edredar

    Joined:
    Jul 26, 2012
    Posts:
    58
    Hello,
    Is linear color space supported by WebGL? If not, is it going to be supported in near future? Or is there any workaround to force gamma color space to look as linear?
    Thanks in advance.
     
  2. PlatformSix

    PlatformSix

    Joined:
    Feb 27, 2014
    Posts:
    57
    It doesn't work currently because webGL uses openGL ES2, IIRC. It'll work when the next version of webGL hits browsers probably. For the time being, any technique that allows it on mobile currently should probably work on weBGL - I think there's a linear lighting package on the asset store that might work?
     
  3. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    There is no extension in WebGL (AFAIK, not even in WebGL 2.0) to support compressed textures in sRGB format, so we cannot support linear color space on WebGL so far.
     
  4. edredar

    edredar

    Joined:
    Jul 26, 2012
    Posts:
    58
    Unfortunately, GoLinear package works only with Unity 4, and I have not found any other.
     
  5. edredar

    edredar

    Joined:
    Jul 26, 2012
    Posts:
    58
    https://www.khronos.org/registry/webgl/extensions/EXT_sRGB/
    As it says, it support EXT with sRGB. Hope they will support other formats:)
     
  6. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
  7. benjcooley

    benjcooley

    Joined:
    May 3, 2014
    Posts:
    45
    Where are we at now on linear lighting for WebGL2?

    I checked the other day and I did see some discussion about supporting SRGB compressed textures in the chrome bugs mailing list, but I'm not sure if there was any progress.

    Are you guys aware of any movement on this - as we move to full WebGL2 rollout for Firefox/Chrome?

    It seems that WebGL is the last platform that we're looking at to support linear now, as we seem to have a good bit of mobile.
     
  8. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    Yes, we are aware of it. WEBGL_compressed_texture_s3tc_srgb extension is one piece of the puzzle we need to support linear color space. This is currently in a draft state in Canary.

    So currently it's still a work-in-progress. Hopefully we will have an experimental build with linear color support at some point in the next few months.
     
  9. benjcooley

    benjcooley

    Joined:
    May 3, 2014
    Posts:
    45
    That's terrific. Publishing a single piece of content using two different lighting models is a real thorn in our side right now.

    Linear in webgl can't come soon enough.
     
  10. benjcooley

    benjcooley

    Joined:
    May 3, 2014
    Posts:
    45
    Just an FYI for anyone else following the progress on this:

    The Chromium Bug (for google Chrome) is here:

    Status: FIXED - will be in next release behind a flag as far as I know.

    https://bugs.chromium.org/p/chromium/issues/detail?id=630498

    T
    he Firefox Bug

    https://bugzilla.mozilla.org/show_bug.cgi?id=1325113

    Short story, full support (Angle/webgl platforms) was pushed to the latest chrome build yesterday (10th Jan 2016). Firefox is not started yet, but the bug is filed and prioritized.
     
  11. benjcooley

    benjcooley

    Joined:
    May 3, 2014
    Posts:
    45
    Just thought I'd bring this up.

    Now that this is in Canary in Chrome, would it be possible to enable linear as "(Experimental)" in 5.6 beta?
     
  12. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    We can't yet. We also need webgl context support for sRGB which is still being worked on. Hopefully we will have it in the next few months.
     
  13. arumiat

    arumiat

    Joined:
    Apr 26, 2014
    Posts:
    321
    Any update on this?
     
  14. Schubkraft

    Schubkraft

    Unity Technologies

    Joined:
    Dec 3, 2012
    Posts:
    1,073
    Not at this time. Once we have something it'll show up in the beta of whatever Unity version it is then.
     
  15. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    940
    Any good news for a future support?
     
  16. Schubkraft

    Schubkraft

    Unity Technologies

    Joined:
    Dec 3, 2012
    Posts:
    1,073
    The good news is that in the future it will be supported. The bad news is that we don't know yet when that future will be.
    As I said, once we have something it'll be in a beta for you to try out and give feedback.
     
    RomBinDaHouse, arumiat and kenshin like this.
  17. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    Based off of @jonas-echterhoff original reply - is there a workflow to 'mimic' linear space when building for WebGL?
    Planely speaking our exe looks perfect matching the editor display and outputting as expected based on our settings, with all the right colors from textures and lights, while the webgl build is - just not right. o_O

    Does webgl support uncompressed textures OR a different format other than sRGB for our texture?

    We are building for mobile but deploying demos via webgl and the entire game is being created using 1 (one) 256x256 texture map, and we have 1 (one) light in the scene which has a minimal yellow color (255,253,225).

    When we build to webgl it seems the color space change is affecting all texture colors by applying an overly saturated representation of the soft yellow light.
    If I can change the texture to uncompressed when building for webgl or to a different format other than sRGB to keep the lighting consistent I will, instead of changing the light to unrealistic white.

    Thanks all for keeping this topic ongoing.
     
    Last edited: May 16, 2017
    kenshin likes this.
  18. benjcooley

    benjcooley

    Joined:
    May 3, 2014
    Posts:
    45
    https://bugzilla.mozilla.org/show_bug.cgi?id=1325113

    SRGB compressed texture support now in Firefox beta. Will be coming with 55. Already supported in Chrome.

    Status: NEW → RESOLVED
    Last Resolved: 3 days ago
    status-firefox55: --- → fixed
    Resolution: --- → FIXED
    Target Milestone: --- → mozilla55

    Do you know the tracking bugs for WebGL context support?

    Always reasonable to mention why this matters though I know you guys are aware. Linear mode on cross platform content that needs to be on the web still gated by this. Looking forward to potentially having an experimental switch in the near future when everything is ready.

    Keep up the good work.
     
    arumiat likes this.
  19. arumiat

    arumiat

    Joined:
    Apr 26, 2014
    Posts:
    321
  20. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    Just a quick update on this: At the moment it looks like linear color rendering support is due to ship in 2017.2 and that it's going to require WebGL2.0.

    We will make sure this is included in our roadmap.
     
    kenshin and arumiat like this.
  21. benjcooley

    benjcooley

    Joined:
    May 3, 2014
    Posts:
    45
    Great!

    Thanks for the update.
     
    arumiat likes this.
  22. xAvatarchikx

    xAvatarchikx

    Joined:
    Aug 17, 2012
    Posts:
    69
  23. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    kenshin likes this.
  24. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654