Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

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

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

  1. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,642
    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:
    1,636
    I hope Unity will someday fix issues with the WebGL instead of just replacing it with another crappy solution.
     
    JamesArndt likes this.
  3. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,642
    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.
     
    xVergilx and Ryiah like this.
  4. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    13,872
    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
     
    xVergilx and JamesArndt like this.
  5. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,617
    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
  6. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    5,410
    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,642
    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.
     
  8. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    5,410
    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:
    6,924
    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:
    5,435
    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,642
    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:
    368
    @JamesArndt Agreed. Just played a few playcanvas games, they are impressive.
     
    JamesArndt likes this.
  13. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,642
    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.
     
    Joe-Censored likes this.