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

Next-Generation 3D Graphics on the Web - WebGPU API

Discussion in 'General Discussion' started by JamesArndt, May 17, 2019.

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

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,932
    Google just announced the WebGPU API. Looks like this will be the next generation replacement for WebGL. I'm very curious if Unity has already been working on or R&Ding efforts for implementing this in the future?

     
    Ryiah likes this.
  2. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    I hope Unity will someday fix issues with the WebGL instead of just replacing it with another crappy solution.
     
  3. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,932
    I'm not sure they can. I think Unity Tiny was their next approach to work around their own limitations with WebGL. Unity's WebGL implementation works okay on desktop, but it's horrid on mobile. Not to mention Google themselves say in this video that WebGL was based around tech assumptions in 2012 and it's not reflective of the tech ecosystem today. They go on to state that this new API is the solution to that, basically a new WebGL for today and the future. They're making it sound as if they would deprecate WebGL in the future for this API.

    As for Unity, well I'm not sure where they'll go in the future for web game development. Just take a look at what a native Javascript engine like PlayCanvas can do...and how well it performs on mobile devices.
     
  4. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,950
    Like @JamesArndt mentioned WebGL was based off of approaches to creating graphics APIs that are no longer current and just like they have been replaced with a far superior approach WebGL itself now needs to be replaced too. WebGPU essentially is Vulkan for browsers and will bring similar performance improvements.

    https://en.wikipedia.org/wiki/WebGPU
     
    Amon, NotaNaN, xVergilx and 1 other person like this.
  5. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    What the web really needs is to get away from the entire model of html, sending javascript source code over the network, bloated css files... and just send a fracking pre-compiled binary or close to that's super fast to download and run. The days of literally sending "the source code to your page/game" to the end user in an effort to have them able to run it, is ridiculously behind the times. All the browser should have to do is execute, not parse source code. It's good to get an isolated box in which GPU stuff can run efficiently, but note that this is embedded inside an archaic model of content delivery. It'd be nice to just build a web app with fast gnu support and send it to the browser, and ignore other html/css/javascript content. But at present this kind of rich material is very hard/impossible for the likes of Google to understand. So I doubt they will be undermining the basics of the html model anytime soon, no matter how advanced a gpu plugin becomes.
     
    Last edited: May 18, 2019
    MaorDany and gnurk like this.
  6. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,083
    I can't possibly see this going wrong when we... [checks notes]... definitely have OS level sandboxing available on all computers.
     
    wetcircuit likes this.
  7. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,932
    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?

    PlayCanvas just works across all of these browsers, and it blazes through the mobile phone browser too. No problem running the Playcanvas Sponza demo on my Android phone at around 50fps. 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.
     
    NotaNaN and khaled24 like this.
  8. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,083
    Have you tried the Edge Dev branch? It is... shockingly competent. I've actually had it run things, which is more than I can usually say. It's basically just stripped down chromium, but hey, that's good enough for a bundled browser.
     
    JamesArndt likes this.
  9. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    Around 19 minutes is where it gets interesting with a 3x boost in FPS and a 50x reduction in CPU usage (based on a scene with 10,000 objects).
     
  10. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    Now that Edge browser is switching to a Chromium base, Google will basically be the foundation for approximately 80% of browsers (FireFox is the biggest holdout). That certainly gives Google the clout to make unilateral changes to web tech like this and force everyone else to hop on.

    Unity should at least be paying close attention to this, at minimum to avoid getting caught with their pants down if something were to happen to WebGL.
     
    JamesArndt likes this.
  11. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,932
    This is really great from my own perspective as a web developer. Microsoft was always the outlier (along with Apple) and had to have special fall-backs to make up for what already worked fine in Chrome and Firefox. This should help bring more parity between the browsers. However I do see you're point and I agree with you.
     
    Joe-Censored likes this.
  12. Flurgle

    Flurgle

    Joined:
    May 16, 2016
    Posts:
    389
    @JamesArndt Agreed. Just played a few playcanvas games, they are impressive.
     
    JamesArndt likes this.
  13. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,932
    Yeah its looks like not too many developers have really exploited it's potential. I was pretty blown away by the fact the experience on mobile was decently close to desktop (for one, it's loading was very fast). I have to brush up on my Javascript to really start using it seriously.
     
    NotaNaN, alect-edu and Joe-Censored like this.
  14. michaelgrilo

    michaelgrilo

    Joined:
    Oct 15, 2018
    Posts:
    21
    Since I have to learn C# anyhow while learning Unity, I'm hoping I can just stick with C# and utilize WebAssembly and WebGPU for a well performing Unity multiplayer game.

    I could streamline even more and also learn Blazor so I can build the whole game's web platform with C# as well.
     
  15. unity_b1W6Nl1D_xYz8A

    unity_b1W6Nl1D_xYz8A

    Joined:
    Aug 5, 2019
    Posts:
    11
    I tried to find any updates regarding webgpu for unity, but couldn’t find anything. Are there any official statements from Unity regarding the adoption of this new technology?
     
  16. jtiret

    jtiret

    Joined:
    Nov 11, 2020
    Posts:
    63
    Up! Would also be interested to know what Unity plans about it :)
     
  17. Schubkraft

    Schubkraft

    Unity Technologies

    Joined:
    Dec 3, 2012
    Posts:
    1,070
    We're closely following the spec development and are in contact/feedback with various browser vendors about it. However the spec is still in development and at this time we have nothing concrete to announce regarding this.
     
    jtiret likes this.
  18. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,083
  19. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    Fun cartoon but isn't it that WebGL is based on OpenGL an API created in 1991. So we have a 30 year old graphics API that no longer matches how modern GPUs actually work. Not an ideal situation especially when you then need the browser to talk to the hardware via it's drivers.

    Or isn't the gap between graphics API and hardware the reason graphics drivers are so large and need to be tailored to run fast for every game.
     
  20. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,083
    Saying WebGL is based on an API created in 1991 is like saying most games are based on Quake because they share the same code. WebGL 1.0 was based on GL ES 2.0 and WebGL 2.0 was based on GL ES 3.0, neither of which are even remotely based on the original OpenGL, which was a fixed-function system.

    It's also the latest in a long line of what amounts to various attempts to integrate 3D into browsers, be it through stuff like WebGL, WebGPU, or the eight billion browser plugins that came before.
     
  21. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194

    Based on this comparison it looks like WebGPU could be more performant than WebGL.
     
    Samuel411 and JamesArndt like this.
Thread Status:
Not open for further replies.