5 ms·
To be fair neither are WebGL and WebGPU, versus the native API counterparts, the best you can get are shadertoy demos, and product visualisation on ecommerce si
by pjmlp 2y ago
To be fair neither are WebGL and WebGPU, versus the native API counterparts, the best you can get are shadertoy demos, and product visualisation on ecommerce sites.
Due to tooling, sandboxing and not having any control about what GPU gets selected, or why the browser blakckboxes it and switches into software rendering.
- chilmers 2y agoFigma uses WebGL for rendering and they seem to be doing ok.
- pjmlp 2y agoYeah, at a level like GDI+, CoreGraphics, XWindows hardware surfaces,.... This isn't really what real-time graphics is all about in modern times. This is, https://youtu.be/AV279wThmVU?si=Ou04h5z0Mju7kiJ0 https://youtu.be/AV279wThmVU?si=Ou04h5z0Mju7kiJ0 The demo is from 2018, 7 years ago!
- chilmers 2y agoThe claim was that with WebGL was "the best you can get are shadertoy demos, and product visualisation on ecommerce sites". Figma is neither, regardless of how it's making use of WebGL under the hood. Not sure what relevance an Unreal engine demo is, as you seem to think I was making a claim about real-time graphics that I wasn't.
- pjmlp 2y agoFigma falls under the graphics requirements of ecommerce sites, I have my doubts that they even make use of WebGL 2.0 features. It only a way to hopefully get hardware accelerated canvas, if the browser doesn't consider GPU blacklisted for 3D acceleration. That isn't real time graphics in the sense of games programming.
- fidotron 2y agoI had this argument with pjmlp not too long ago, and it goes in circles. Basically they define anything less than pushing the extreme limits of rendering technology to be worthless, while simultaneously not actually understanding what that is beyond the marketing hype. The fact most users would not be able to run that seven year old demo on their systems today, even natively, would be beside the point of course. WebGL particularly absolutely has problems, but the revealing thing is how few people state what they really are, such as the API being synchronous or the inability to use inverted z-buffers. Instead it's a lot of noise about ray tracing etc. WASM per call overhead is a whole other problem too, GC or not.
- davexunit 2y agoThanks for bringing a reasonable perspective to this discussion.
- locallost 2y agoAlthough I will say that the difference between my old Intel MacBook and the M2 Pro is night and day.
- samiv 2y agoNot to mention - the incredible overhead of each and every API call - the nerfed timers that jitter on purpose - the limitation of a single rendering context and that you *must* use the JS main thread to all those rendering calls (so no background async for you..)
- flohofwoe 2y ago> - the incredible overhead of each and every API call The calling overhead between WASM and JS is pretty much negligible since at least 2018: https://hacks.mozilla.org/2018/10/calls-between-javascript-and-webassembly-are-finally-fast-%F0%9F%8E%89/ https://hacks.mozilla.org/2018/10/calls-between-javascript-a... > - - the nerfed timers that jitter on purpose At least Chrome and Firefox have "high-enough" resolution timers in cross-origin-isolated contexts: https://developer.chrome.com/blog/cross-origin-isolated-hr-timers https://developer.chrome.com/blog/cross-origin-isolated-hr-t... ...also, if you just need a non-jittery frame time, computing the average over multiple frames actually gives you a frame duration that's stable and exact (e.g. 16.667 or 8.333 milliseconds despite the low-resolution inputs). Also, surpise: there are no non-jittery time sources on native platforms either (for measuring frame duration at least) - you also need to run a noise-removal filter over the measured frame duration in native games. Even the 'exact' presentation timestamps from DXGI or MTLDrawable have very significant (up to millisecond) jitter. > - the limitation of a single rendering context and that you must use the JS main thread to all those rendering calls (so no background async for you..) OffscreenCanvas allows to perform rendering in a worker thread: https://web.dev/articles/offscreen-canvas https://web.dev/articles/offscreen-canvas
- samiv 2y agoI didn't mean just WASM -> JS but the WebGL API call overhead which includes marshalling the call from WASM runtime across multiple layers and processes inside the browser. Win32 performance counter has native resolution < 1us OffScreencanvas is something I haven't actually come across before. Looks interesting, but I already expect that the API is either brain damaged or intentionally nerfed for security reasons (or both). Anyway I'll look into it so thanks for that!
- torginus 2y agoThat's kinda untrue - there are games (not necessarily high end ones, but quite sophisticated ones nontheless). The biggest issue is the API limitations that restrict you from doing things a certain modern way, and you have to use more mid 2000s techniques. Here's a game that uses an Electron powered engine that uses Js and WebGL: https://store.steampowered.com/app/1210800/Rum__Gun/ https://store.steampowered.com/app/1210800/Rum__Gun/
- fidotron 2y agoHonestly I've come to view the "it's the API's fault" as cope. There are times when it is legitimately true, but it's far easier to say that your would have been amazing efforts were blocked because you needed obscure feature of prototype GPU than it is to accept you were never going to get close in the first place for completely different reasons.
- whizzter 2y agoNo, it's a valid complaint. Even before hardware raytracing a huge amount of code was moving to compute shaders, most global illumination techniques in the last 10-15 years is easier to implement if you can write into random indices (often you can refactor to collecting reads but it's quite cumbersome and will almost certainly cost in performance). Even WebGL 2 is only equivalent of GLES 3.1 (and that's maybe a low 4.1 desktop GL equivalent). I think my "software" raytracing for desktop GL was only feasible with GL 4.3 or GL 4.4 if i remember correctly (And even those are kinda ancient).
- fidotron 2y ago> No, it's a valid complaint. For what? This is exactly what I am talking about: successful 3D products don’t need raytracing or GI, the bulk of the audience doesn’t care, as shown by the popularity of the Switch. Sure those things might be nice but people act like they are roadblocks.
- whizzter 2y ago
- davexunit 2y agoYes, I know there's more overhead on the web than native, but that is missing the point of my post. I'm talking about issues with Wasm GC relative to other ways of rendering with Wasm. I've played many browser games with good performance, btw.
- pjmlp 2y agoI would be interested in any that beats iPhone's demo of OpenGL ES 3.0 in 2011, Infinity Blade. In real time graphics quality rendering that is.