Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Status Of WebGL 2 In Edge And Safari

Discussion in 'Web' started by kognito1, Sep 11, 2017.

  1. kognito1

    kognito1

    Joined:
    Apr 7, 2015
    Posts:
    331
    https://caniuse.com/#feat=webgl2

    Not looking great. Seems like still no WebGL 2 support at all in the next version of Edge (Fall Creators Update). In addition while the next version of Safari (11/Technical Preview) supports it behind a flag, will continue to have it disabled by default. This is rather unfortunate because now we have to wait until ~mid 2018 at the earliest for all the (desktop) browsers to support WebGL 2 in practice/in the wild. I'm clearly just venting here but can Unity do some poking for information? WebGL 1 (ogl es 2.0) can be quite restrictive and it's a little annoying there's no technical reason (on desktop) that we have to be held hostage by it.
     
  2. Schubkraft

    Schubkraft

    Unity Technologies

    Joined:
    Dec 3, 2012
    Posts:
    1,070
    We have no more information to share compared to what you already listed.
    We do share our insights and wishes in meetings with them but can't magically make things get developed faster. Sad but true ;) And WebGL 2.0 game developers are but one target audience for browser makers to consider in their roadmap.

    However Chrome and FF do support it rather well and while they have quite the market share haveing a common set of features available in all browsers is clearly the more desired option.
     
  3. arumiat

    arumiat

    Joined:
    Apr 26, 2014
    Posts:
    321
    At the moment it can be enabled via the experimental features in Safari, anyone have an idea of when it will go into a release version?
     
  4. arumiat

    arumiat

    Joined:
    Apr 26, 2014
    Posts:
    321
    Also can the browser be made to fallback to webGL 1.0 when your settings are like this?

    I'd like linear/ webGL2.0 to be the default in Chrome and Firefox, but to fallback to webGL1.0 if a user is loading in in Edge/ Safari

    Capture.PNG
     
  5. Schubkraft

    Schubkraft

    Unity Technologies

    Joined:
    Dec 3, 2012
    Posts:
    1,070
    That wouldn't quite work and more importantly you'd have to author all you content twice, once in linear color space and once in gamma color space for WebGL 1.0 which is probably more effort than it is worth.
     
    arumiat likes this.
  6. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    If you want to fallback to WebGL1.0, you must use Gamma. WebGL2 is a requirement for Linear color space.
     
    arumiat likes this.
  7. arumiat

    arumiat

    Joined:
    Apr 26, 2014
    Posts:
    321
    So you can't use linear and 2.0 in supported browsers and have the content automatically fall back to 1.0 in safari or edge, shame :(
     
  8. benjcooley

    benjcooley

    Joined:
    May 3, 2014
    Posts:
    45
    We currently fallback to 1.0 on browsers that don't support 2.0, but we did have to switch back to gamma to do that.

    Oddly enough, except for some blurry textures due to no NPOT texture support on edge/safari, it works relatively well, even with some of our more complex streaming clips. However, very much looking forward to switching off 1.0 support permanently so we can move future content to linear color space.

    https://watch.3veo.com
     
  9. arumiat

    arumiat

    Joined:
    Apr 26, 2014
    Posts:
    321
    ''We currently fallback to 1.0 on browsers that don't support 2.0, but we did have to switch back to gamma to do that''
    Do you do that dynamically 'in-game' somehow?
     
  10. wetcircuit

    wetcircuit

    Joined:
    Jul 17, 2012
    Posts:
    1,409
    Is Linear/Gamma the only limitation of using 1.0?

    What other pitfalls should we be looking for?
     
  11. jRocket

    jRocket

    Joined:
    Jul 12, 2012
    Posts:
    699
    wetcircuit likes this.
  12. kognito1

    kognito1

    Joined:
    Apr 7, 2015
    Posts:
    331
    Somewhat related, WebGL 2 now reports as shader level 35, not 40 FYI.
     
  13. AlejMC

    AlejMC

    Joined:
    Oct 15, 2013
    Posts:
    149
    I would be very curious to know, how do you detect at run-time that it's using WebGL 1.0 and not 2.0?
    The information is lackluster on that front. Some people say "use user-agent" javascript api or similar. I think this is incredibly cumbersome for something that should be simple.
    So that's the way to go? if shader level is below 35 on WebGL player then it means it is WebGL 1.0?
    Thanks!
     
    arumiat likes this.
  14. kognito1

    kognito1

    Joined:
    Apr 7, 2015
    Posts:
    331
    Hard to remember exactly but these are the comments I left on our FXAA script for Safari and pre-WebGL 2.0 Chrome/Firefox (no MSAA on WebGL 1.0 under masOS, thus we fallback to FXAA):

    Code (CSharp):
    1. if (SystemInfo.graphicsShaderLevel <= 30) //webgl 1 = 30, webgl 2 = 35
    Still, I don't think it would be terribly difficult to check through javascript (might be a more robust solution since Unity has changed this once already...).
     
    JamesArndt likes this.
  15. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,932
    If you have "Auto Graphics API" checked on won't it build both versions and auto load them at runtime?
     
  16. wetcircuit

    wetcircuit

    Joined:
    Jul 17, 2012
    Posts:
    1,409
    That's not my experience.

    There are 3 possible end results:
    1. WebGL will fail with an alert error.
    2. You will get the alert error but WebGL will load anyway
    3. WebGL will fail without an alert error
    It will be consistent with your build, but no doubt each is a result of the project failing to workout the incompatibilities (this is on top of WebGL just failing because... it ran out of memory or whatever).

    The only way to force Safari to drop to WebGL 1.0 seems to be to build a 1.0 version and divert it with the browser.
     
    De-Panther likes this.
  17. kognito1

    kognito1

    Joined:
    Apr 7, 2015
    Posts:
    331
    Yes, but note various graphical features only work on WebGL 2 (so obviously be careful what you use if you plan to support Safari). When you enable "Auto Graphics API", Unity will print a harmless error when it falls back to WebGL 1 but it will still function normally. You don't need to generate a separate build.
     
    Hypertectonic and JamesArndt like this.
  18. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,932
    Excellent. Good to know. Nothing I'd be doing would be using anything beyond very basic.
     
  19. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,932
    I did discover that Babylon.js has a Unity exporter. I'm going to start experimenting with it as it appears to be quite a bit faster than the current WebGL exports. However I'm unsure if this supports exporting Unity UI elements...but I do believe that could be handled natively.

    https://www.babylontoolkit.com/
     
    Last edited: May 30, 2019
    wetcircuit likes this.
  20. UDN_08a62c30-cdb1-4e59-bb48-acda29f9e582

    UDN_08a62c30-cdb1-4e59-bb48-acda29f9e582

    Joined:
    Jun 19, 2018
    Posts:
    23
    Interesting. We used Babylonjs till we tried Unity with wasm. Same assets was unbelievable faster using Unity engine.
     
    JamesArndt likes this.
  21. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,932
    Yes I'm also experimenting with PlayCanvas right now and I'm a bit astounded. Unity WebGL exports run okay in Chrome and Firefox, but when I attempt to load my WebGL in Microsoft Edge and in Internet Explorer it errors out and will not run. However I went ahead and made a similar demo project in PlayCanvas, compiled the build and ran the page through Microsoft Edge and Internet Explorer and it ran beautifully, no errors, no console errors, no po-up warnings about no support. Unity WebGL exports however popped up warnings about not supporting the browser and/or just didn't run at all. How on earth can a company as successful and large as Unity is these days, not have stellar support for the latest in browser gaming tech?

    Maybe @Marco-Trivellato or @Schubkraft can help make this clearer why something like PlayCanvas just works across all of these browsers, and it blazes through the mobile phone browser too. I found this after trying to look into it:

    https://blog.playcanvas.com/playcanvas-versus-unity-webgl/
    • Unity WebGL apps are up to 21 times larger.
    • PlayCanvas apps load up to 43 times faster.
    • PlayCanvas app frame rates are up to 4 times higher.
     
  22. Schubkraft

    Schubkraft

    Unity Technologies

    Joined:
    Dec 3, 2012
    Posts:
    1,070
    As explained in the past there is quite a difference between native js engines and what the Unity WebGL export does.
    The JS engines are built from the ground up to be as small and fast as possible while we "just" compile the whole Unity runtime to JS which is a big difference in codesize and functionality and with that load/startup times and browser support.

    If you are looking for something smaller check out the new Tiny https://forum.unity.com/forums/project-tiny.151/ forum or demo https://unity3d.com/tiny
     
    De-Panther and JamesArndt like this.
  23. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,932

    Well I've gotten that from my own reading up on this. What I don't understand is why Unity can't pivot and create something that just works for WebGL across almost all browsers. It seems so fragmented and hit or miss at the moment. I'm not necessarily looking for smaller, though that's helpful, I'm looking at being functional at a base level across a majority of browsers. Tiny looks neat for it's own purposes, casual content, ad games using 2D. I'm talking full 3D content with modern rendering capabilities.
     
  24. Schubkraft

    Schubkraft

    Unity Technologies

    Joined:
    Dec 3, 2012
    Posts:
    1,070
    We can understand that. And folks are working at improving Tiny and the WebGL to meet people's expectations. But for WebGL there are no big wins left for us but only a lot of grinding for 1-2% improvements. But people are working on it and I hope it will be a better in the future.
     
    De-Panther and JamesArndt like this.
  25. jRocket

    jRocket

    Joined:
    Jul 12, 2012
    Posts:
    699
    I have seen a lot of demos and small projects in Babylon/Playcanvas which work great when you just want to quickly show off a 3d model- but I have seen very little in the way of actual games with an environment,characters, and gameplay. Those JS engines are much simpler and don't have things like mecanim, or proper baked GI lightmapping. And of course you have to use javascript :(
     
  26. sumpfkraut

    sumpfkraut

    Joined:
    Jan 18, 2013
    Posts:
    242
    KamilCSPS likes this.
  27. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    We have been tracking WebGL 2 progress in Safari for a while now. They are doing great progress, though unfortunately it is a known issue that neither classic Unity or Tiny Unity compiled projects actually yet run on their WebGL 2 backend in Safari Technology Preview 114.

    Hopefully though the issues will be easy to resolve and things will be smooth before they launch.
     
    KamilCSPS, wetcircuit and De-Panther like this.
  28. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,932
    So just to be clear, and this might sound dumb, but Safari will support WebGL 2 running by default but current Unity WebGL exports will not run in the browser? But you anticipate that by launch of the updated browsers it should run?
     
    De-Panther likes this.
  29. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    That is right. Current Safari Technology Preview 114 has bugs that cause it to soft-crash on JS exceptions when attempting to run Unity WebGL 2 content. They should have time before next stable release so that STP 114 should not be representative of the final result.
     
    JamesArndt likes this.