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

WebGL Roadmap

Discussion in 'Web' started by jonas-echterhoff, Jun 18, 2015.

Thread Status:
Not open for further replies.
  1. artzfx

    artzfx

    Joined:
    Apr 28, 2008
    Posts:
    572
    Yes you can for a while now, however displaying a single sbsar in a Sketchfab scene compared with numerous Substances in a Unity WebGL scene is a rather different task. This is where the squeeze on performance becomes an issue with WebGL 1.0. Hopefully WebGL 2.0 will provide better scope for this :).



    In the meantime, we can use the Export Bitmaps option in the Unity Inspector once we have adjusted our Substance procedural settings:

    exportToBitmap.jpg
     
    Last edited: Jun 27, 2016
    minev likes this.
  2. ninjanosui

    ninjanosui

    Joined:
    Jul 12, 2013
    Posts:
    54
    Eric Batut from Allegorithmic says : "
    More work is needed on the Unity side (shared array buffers or something like that) to emulate threaded operation between the Main Thread and the Substance Thread before integrating a WebGL build of the Substance Engine can be considered.

    Rewriting the entire Main Thread <-> Substance Thread communication layer to be single-threaded (and making all Substance operations blocking operations) could be a workaround, but this would be throwaway effort and is very much not on the roadmap right now.

    Best Regards,
    Eric"
     
  3. kognito1

    kognito1

    Joined:
    Apr 7, 2015
    Posts:
    331
    So is WebGL 2.0 good to go in Unity 5.4? I noticed it's not listed as experimental in the project settings. I'm eager to try it out so we can put skinned mesh renderers on the gpu (our current biggest bottleneck on webgl).
     
  4. Schubkraft

    Schubkraft

    Unity Technologies

    Joined:
    Dec 3, 2012
    Posts:
    1,070
    This is what the blog post says:
    We’re also excited also to announce that WebGL 2.0 is available in Unity as an experimental target. While the WebGL 2.0 spec is still a draft and not yet in current releases of the web browsers, you can get a head start with Firefox or Chrome, by enabling it in Unity.
     
    yuliyF likes this.
  5. yuliyF

    yuliyF

    Joined:
    Nov 15, 2012
    Posts:
    194
    A new problem is on 64bit Chrome( last version - 54..m(64 bit) ) a WebGL doen't work !!! :confused:
     
  6. peterraze

    peterraze

    Joined:
    Nov 1, 2016
    Posts:
    1
    WebGL supports WWW class to download of video?
     
  7. arumiat

    arumiat

    Joined:
    Apr 26, 2014
    Posts:
    321
    Notice Android is getting Linear color space, can you comment on if is planned for webGL soon?

    https://unity3d.com/unity/beta
     
  8. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    Unity WebGL is going to get linear color space too, though we don't have a date yet since we depend on browsers to implement srgb texture compression format support. It is currently being worked on so hopefully it won't take too long.
     
    arumiat likes this.
  9. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    Last edited: Nov 14, 2016
    yuliyF likes this.
  10. Schubkraft

    Schubkraft

    Unity Technologies

    Joined:
    Dec 3, 2012
    Posts:
    1,070
    There'll be an experimental build with wasm support for you to test with in the future.

    It is running internally and we are in contact with all the browser teams to iron out the kinks and give feedback. As mention in your linked article the spec isn't completely done yet.
     
  11. dudespeaks

    dudespeaks

    Joined:
    Jul 23, 2016
    Posts:
    2
    I have been side-scripting JS on PlayCanvas the past couple of months and their WebGL does seem very efficient and rarely crashes my Firefox. In the below link, they say that they "handcrafted" their WebGL engine for maximum efficiency and that Unity and Unreal both use a less-than-efficient "Emscripten" translator that processes through 3+ languages. Hopefully, Unity dev team is looking to make its WebGL more efficient -- and competitive. ;-)

    https://blog.playcanvas.com/playcanvas-versus-unity-webgl/
     
    Tschoartschi and yuliyF like this.
  12. Tschoartschi

    Tschoartschi

    Joined:
    Apr 15, 2016
    Posts:
    4
    I'm not sure if the roadmap thread is the right place to discuss things like stability, reliability and performance. But the blog post of PlayCanvas describes many pains we also have in our Unity app.

    I think you can not directly compare Unity and PlayCanvas. But I would also like to see WebGL as a first-class citizen in Unity. In my opinion at the moment the WebGL export is not really "web ready". Yes it works somehow but it's not really reliable and competitive. The following sentence expresses the state of the WebGL export quite well:

    And I can provide numbers from our real world app. We prevent all mobile users and all users with pre Internet Explorer 11 versions from starting our Unity build and we are still losing almost 15% of the remaining users. In total numbers this is for the last 7 days: 17584 users tried to start the Unity build and only 15034 acutally saw the first scene. This is a dropout rate of 14.5% which is enormous high especially because we already prevent users with "problematic setups" to start our build.

    I hope the WebGL export will be reliable one day soon because rewriting our whole Unity app in something like PlayCanvas would be a huge invest in time and money.

    Are you guys planning to use more of the web technologies which the web platform already offers or are you betting for web assembly to solve all these issues?
     
    topofsteel and LazyMammal like this.
  13. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    999
    Let me tell you, Unity's WebGL has come a LONG way since it's first beta release. I consider it usable now, albeit pretty limiting. I do Arch-Vis work and send a link to clients with spicific browser recommendations. I could see how you would run into trouble managing users from across the board. I've experimented using a lightweight SketchFab snapshot of my scene for mobile since most people are checking email that way. Better than an error message and gets their attention better than am image.

    I've also looked into PlayCanvas and some others including Arch-Vis spicific WebGL solutions. I just couldn't reproduce my work in another environment. My biggest complaint is graphical quality. I use forward rendering because the built in AA is far superior to any of the differed post processing options. But if you ad any additional effects it breaks the AA.

    Standalone is dying. No one wants to download anything, and god forbid have to update it. In my opinion If the technology doesn't work on the web, it doesn't work.
     
    StaffanEk and arumiat like this.
  14. StaffanEk

    StaffanEk

    Joined:
    Jul 13, 2012
    Posts:
    380
    Amen brother, say it like it is.
     
  15. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    At the moment, there are issues with the builtin AA and ImageEffects on Windows, due to the rendering back-end (Angle) used by several browsers. This problem is solved with WebGL2.0 in 5.6 (we might consider back-porting to previous versions). By the way, we are updating docs with this information.

    For the time being, if you need both Image Effects and AA, I suggest you do not use the built-in AA, use a post-processing base technique instead.
     
  16. yuliyF

    yuliyF

    Joined:
    Nov 15, 2012
    Posts:
    194
    Unity3D 5.5 : WebGL: Aded the option to use Brotli compression instead of Gzip.
    What's it mean? Files .*gz will be changed?
     
  17. StaffanEk

    StaffanEk

    Joined:
    Jul 13, 2012
    Posts:
    380
    You should indeed. Especially since 5.5 is only released now. How many months would we have to wait for 5.6?
     
  18. wbl1

    wbl1

    Joined:
    Apr 22, 2009
    Posts:
    159
    So I installed 5.5.0f3 this morning, and then published a project using the WebGL 2.0 build option (or just WebGL since WebGL 2.0 is the default).

    I've been assuming that WebGL 2.0 would yield considerably smaller build files and be less demanding as far as browser memory is concerned.

    I enabled WebGL 2.0 in Firefox and then loaded the project. While I have not done extensive testing, I cannot see that file sizes are any smaller and the load time is still pretty long.

    I am sure that the build is much better considering the long list of enhancements and fixes to WebGL, but am I wrong to assume that file size and load times should be much smaller (compared to 5.3)?

    Is it that the published content still needs to accommodate browsers that don't support WebGL 2.0?
     
  19. kognito1

    kognito1

    Joined:
    Apr 7, 2015
    Posts:
    331
    WebGL 2.0 is just the graphics api. It has very little to do with load times and build size. I think what you are actually waiting for is webassembly (not in 5.5, maybe 5.6).

    WebGL 1.0 = OpenGL ES 2.0.
    WebGL 2.0 = OpenGL ES 3.0.
     
    wbl1 likes this.
  20. Schubkraft

    Schubkraft

    Unity Technologies

    Joined:
    Dec 3, 2012
    Posts:
    1,070
    What @kognito1 said is spot on. WebGL 2.0 doesn't do anything to file size or load times. It just allows you to use fancier OpenGL/graphics stuff in your shaders and enables us to support more gfx features.

    With 5.5 we've made WebGL 2.0 the default graphics API. You could do that in 5.4 yourself already if you wanted to.
    When a browser doesn't support 2.0 the Unity content will fall back to 1.0 unless you explicitly removed 1.0 from the graphics APIs before building your project.

    The confusion here probably comes from the ambiguous naming of things. We named the platform as a whole WebGL while it is also the name for the Khronos groups graphics API standard.
     
    wbl1 and topofsteel like this.
  21. tistik

    tistik

    Joined:
    Mar 15, 2012
    Posts:
    7
    Hi there, very useful thread with lots of info!

    Actually, I would be interested in an update from Unity guys about the multi-threading support. We're porting an app from Web Player to WebGL and have a huge amount of multi-threaded code in it that would be a pain to adapt in single-threaded version.

    Have you made further testing with SharedArrayBuffers ? Do you have any roadmap milestones to communicate about Unity WebGL engine multi-threading support, and also about user code WebGL multi-threading support ?

    Thanks in advance, keep up the good work
     
    StaffanEk likes this.
  22. Schubkraft

    Schubkraft

    Unity Technologies

    Joined:
    Dec 3, 2012
    Posts:
    1,070
    @tistik There is currently no date attached to the threading in JS. This is also not something we can do ourselves but can only happen in concert with the browser vendors who need to add support for it in their browsers.

    So I can not recommend you betting your WebGL release on some event at an undetermined future date.
    Sorry to not have any better news.
     
  23. arumiat

    arumiat

    Joined:
    Apr 26, 2014
    Posts:
    321
    And are you able to comment on whether Linear color space is being worked on currently?
     
  24. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    It is being worked on, however, the WebGL extension required (WEBGL_compressed_texture_s3tc_srgb) to get it working is only available on Chrome Canary on OSX and Linux at the moment. Support in other browsers as well as in Chrome on Windows will hopefully follow in the near future.
     
    arumiat likes this.
  25. bigbrainz

    bigbrainz

    Joined:
    Jul 21, 2015
    Posts:
    177
    I'd still love a comment from Unity about the WebGL build size. The specifics are debatable, but it seems clear that PlayCanvas is FAR smaller than Unity. Our company is seriously considering switching away from Unity because their WebGL builds are so massive. It's a massive problem for our clients. What is Unity doing to maximize the efficiency of WebGL?

    Web Assembly looks to shrink the zipped build by maybe 40%, the PlayCanvas is offering something vastly lighter than that. What do you say Unity--how seriously are you taking WebGL? Give me something I can use to convince our company to stay.

    Thanks!
     
  26. kognito1

    kognito1

    Joined:
    Apr 7, 2015
    Posts:
    331
    They aren't exactly comparable. PlayCanvas has a fraction of the features Unity supports (not to mention it only supports one platform). If your application only targets one platform (webgl) and does not make extensive use of Unity's feature set, then yeah PlayCanvas might be a better solution for your situation.

    In the long run better stripping will make Unity more competitive in this area, but those improvements will happen gradually over (a long) time.
     
  27. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    It depends what you need to do. If your project is a spinning cube, then Unity is not able to compete at the moment. But as soon as you start having more assets (especially textures), then the gap is not as big between Unity and a Native-Web solution. It also depends on the feature set you need, as mentioned by @kognito1
     
  28. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    I recently updated from macOS 10.9 to 10.12, and WebGL performance went from "mostly pretty good" to "indistinguishable from the old webplayer" (for what I've tried so far anyway), so it's clear WebGL depends more on the underlying browser/OS than the webplayer did. More improvements in build size would still be appreciated, of course. (And the progress bar still is...not very good. ;) I found some user modifications that I haven't tried yet, but it would be nice if the default bar worked better.)

    --Eric
     
  29. stephanwinterberger

    stephanwinterberger

    Joined:
    Aug 22, 2016
    Posts:
    27
    I have exactly the same problem in my company.

    Also the same things here! Our company is also questioning if Unity takes WebGL seriously. 5.5 brought us improvements so we got a "last respite" from our boss. But I'm afraid he pulls the trigger soon if there are no significant improvements.

    Of course Unity offers a lot of features (and this is why we love Unity), but I think this is not enough to justify Unitys "not so great" (or poor) performance on the web. Of course code stripping is a way to go and betting big on WebAssembly. But how about lazy loading code? Why do we need all the code upfront? We could lazy load code to improve perceived performance (no UI stalls). Also it could prevent some devices from crashing. Many of our users experience crashes when their browsers try to parse/compile the huge Unity JS file.
     
  30. AndresSepulveda

    AndresSepulveda

    Joined:
    Mar 12, 2014
    Posts:
    52
    I agree with @Marco-Trivellato .
    When we started to develop we had to choose threejs, babylon. The worst choice was unity because the size and loading times . But that comparison was not fair because we compare prototypes and demos.

    As Marco said, when the project becomes bigger, the other options become more problematic and even heavier on loading.
    We have achieved to convince our client but that means that we have develop a creative workflow of how make a game that can be playable on the web.
    Of course it can get better, but at least for us, it's the best option.
     
  31. stephanwinterberger

    stephanwinterberger

    Joined:
    Aug 22, 2016
    Posts:
    27
    I also think that the absolute code size of an Unity WebGL build is quite competitive BUT, the main problem is that it is one huge JS file. Engines specialized for the web try to load many small files. Overall the size will be the same or even more but the perceived performance for the user is better. There is no UI stall, the user sees progress sooner and the scene is interactive earlier. I think one huge JS file is not the way to go also not when WebAssembly is ready.

    Our clients are regular internet user (a.k.a. consumer) and our stats say that about 17% of our users can not start the Unity game. So, yes it is playable but only for 83% of our users.
     
  32. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    FYI, WebAssembly will support async compilation. So it will be possible to load even large WASM files without UI stall.
     
  33. stephanwinterberger

    stephanwinterberger

    Joined:
    Aug 22, 2016
    Posts:
    27
    @jonas-echterhoff I see, but I'm still not convinced that one huge file is a great pattern for web development. Maybe one huge file has a performance advantage in the over all measurement but I think an incremental loading/starting approach could lead to a much better perceived user experience.

    Nevertheless, a smaller overall build is always beneficial and in web development build size should always be considered as a serious performance metric. I think it's not enough to say: "we do everything, we provide millions of features therefore it's okay that our builds are huge and users should wait long until they can interact with the app because they get so many features". When doing web development we should also think about people with slow or unstable internet connections. Not everybody has a 1 giga bit internet connection.
     
  34. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    940
    Is there a good WebGL 2.0 demo that can be used to test it in a browser?
     
  35. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    arumiat and kenshin like this.
  36. roka

    roka

    Joined:
    Sep 12, 2010
    Posts:
    589
  37. 39thstreet

    39thstreet

    Joined:
    Jan 30, 2012
    Posts:
    104
    After load bar, this shows a white box in both Chrome and Edge for me, any idea why?
     
  38. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    The versions you're running don't support WebGL 2.0; e.g. with Safari currently you'd need to download the technology preview and enable WebGL 2.0 since the regular version doesn't support it yet.

    --Eric
     
  39. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    940
    Thank you @jonas-echterhoff!!!

    With Chrome 56.x webgl 2 is enabled by defaut, demo looks great!!

    I have just noticed a problem if switched at full screen:
    at fullscreen is correctly refresched the portion of vieweport that previously was windowed.
     
  40. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    940
    At the moment there are two main issues that I find in WebGL:
    1) a large size of the build
    2) a high startup latency fo the scene when the player has been downloaded

    Are WebAssembly a pontential imrpovement for problem 1?

    What about problem 2?
     
    arumiat and yuliyF like this.
  41. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    Yes, generated wasm binary code is expected to be smaller than asm.js but that will vary depending on the project.

    that should improve too but that will vary depending on the browser wasm implementation.

    If you profile any of these areas now, be aware that results may differ when wasm is enabled by default in browsers and it is officially supported in Unity.
     
    kenshin likes this.
  42. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    940
    Thanks for the answer @Marco-Trivellato !

    I have done a quick wasm test some months ago and it was not so quisk as I was expecting.

    Is there any planned release date (or just an idea) about wasm support by default in browsers?
     
  43. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    well...obviously we can't speak for browser vendors but there are reasons to be believe that Mozilla and Google are planning to release in Q1 2017 (see here and here).
     
  44. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    940
    Sure... but you are definitely more informed than me :)

    Thanks for the answer.

    Ciao,
    Stefano
     
  45. yuliyF

    yuliyF

    Joined:
    Nov 15, 2012
    Posts:
    194
    How can I build a project to asm.js ? I use v 5.5.1p4
     
  46. Schubkraft

    Schubkraft

    Unity Technologies

    Joined:
    Dec 3, 2012
    Posts:
    1,070
    Every project you build for WebGL gets compiled to asm.js. There is nothing to change/do on your end.
     
  47. HjorthBjorn

    HjorthBjorn

    Joined:
    Aug 12, 2013
    Posts:
    21
    If I start to build a project today, can I expect that Unity will have a working stable webassembly port in 2017? or atleast is that your goal?
     
  48. AFrisby

    AFrisby

    Joined:
    Apr 14, 2010
    Posts:
    223
    Not speaking for Unity - but WebAssembly support is expected in 5.6; and given that webassembly's first release is basically "more easily parsed asm.js with binary formatting options", it should be fairly stable from the get-go.

    The first version should help quite a bit - although some more features are expected on the horizon to bring it a bit closer to where we were with the webplayer.
     
    yuliyF likes this.
  49. Schubkraft

    Schubkraft

    Unity Technologies

    Joined:
    Dec 3, 2012
    Posts:
    1,070
    We'll have support for webassembly with 5.6 with the "experimental" label for the first release version of webassembly. The spec and browser implementation got finished just recently. So expect there to be some bugs and not take it for some Jesus features solving all the problems at once. Performance may vary quite a bit depending on browser implementation.
     
    HjorthBjorn, yuliyF and kenshin like this.
  50. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    940
    Great news! Another step forward :)
     
Thread Status:
Not open for further replies.