4 ms·
What is the future of WebGL? I have seen cool demos but is this the way forward. So one has a game to develop or a complicated visualization, is it worth invest
by rdtsc 13y ago
What is the future of WebGL? I have seen cool demos but is this the way forward. So one has a game to develop or a complicated visualization, is it worth investing time in learning WebGL or try to use Canvas directly.
- petercooper 13y agoWebGL is essentially a specialized OpenGL-ES based context of canvas. HTML5 canvas in its usual context is only for 2D. You can render 3D on it but you'll essentially be creating your own software rendering engine from scratch.
- rdtsc 13y agoSo then my question is what is the future of WebGL? I could see canvas extended to have 3D operations. Like say draw point takes 3 coordinates now. I can see a third party library that does 3D but projects it down to 2D and uses regular 2D commands on the canvas, or I see supporting WebGL interface and writing OpenGL style code.
- etherealG 13y agoI think the suggestions of using a lib to get higher level stuff are good ones. For simple enough stuff, d3, or more complex whole game engines are available.
- _greim_ 13y ago> I could see canvas extended to have 3D operations. Like say draw point takes 3 coordinates now. I think that's the role WebGL essentially fulfills. It was just done in a way that uses OpenGL instead of reinventing the wheel, since a 3D rendering engine is a non-trivial thing to build. In other words, you can do either: var ctx = myCanvas.getContext('2d'); // ctx has the 2d api var ctx = myCanvas.getContext('webgl'); // ctx has the webgl 3d api > I can see a third party library that does 3D but projects it down to 2D and uses regular 2D commands on the canvas. I think it would be a lot slower. Either way there's a 3D rendering engine. Embedding the engine natively and having GPU speedups is a dominating factor. > or I see supporting WebGL interface and writing OpenGL style code. See first point above.
- gmac 13y agohttp://threejs.org/ http://threejs.org/ may be relevant.
- daredevildave 13y agoIf you just want to make a game, you may not want to bother learning WebGL directly. You can use an engine like PlayCanvas[1]* to build a game and you don't have to worry about the low-level stuff. [1] https://playcanvas.com/ https://playcanvas.com/ *I'm a co-founder
- superqd 13y agoVery cool stuff.
- higherpurpose 13y agoThere's a WebGL2 spec in the works, but not sure if it's based on OpenGL ES 3.0 or 4.0/Next. Since it's taking so long to finish it, I'm hoping it's the latter, since 3.0 didn't bring that many improvements, and ES 4.0/Next/whatever they want to call it is supposed to launch soon, I think.
- frik 13y agoWebGL 2 Specification: http://www.khronos.org/registry/webgl/specs/latest/2.0/ http://www.khronos.org/registry/webgl/specs/latest/2.0/ (Editor's Draft 26 September 2013) [...] API that conforms closely to the OpenGL ES 3.0 API.
- TazeTSchnitzel 13y agoWebGL is using canvas directly, it's the 3D canvas API.
- rdtsc 13y agoOk so if it is using canvas directly why bother calling it WebGL and why does it not run on some machine on Linux based on availability of certain graphics drivers? If it was based on canvas and using that directly I would expect it to be an add-on library that takes a 3D scene for example and translates it to a 2D canvas commands. It seems it is doing more than that though...
- bskap 13y agoBecause it's using the graphics card to convert the 3D instructions into 2D equivalents in real-time. You can't calculate that stuff ahead of time if you want to allow the user to manipulate the canvas. And the whole reason we have graphics cards in the first place is because doing that on the CPU is too slow.
- rdtsc 13y agoWell I've seen some demos and games of people using a 2D canvas to show a 3D scene. Back in the day computers didn't have 3D accelerated cards, it was all done on the CPU and there were enough 3D games that ran on them. I can also see canvas API extended to have 3D operations on it. It just seems WebGL is (was?) popular, lots of demos, but I still haven't seen too many industry uses of it and I have heard people at work claim "it is dead". So I was just wondering, ok, if it is dead is there any hope of having 3D accelerated graphics in the browser or is there something else replacing it. * It seems a sibling comment answered my question: https://news.ycombinator.com/item?id=7264524 https://news.ycombinator.com/item?id=7264524
- IE5point5 13y ago> and I have heard people at work claim "it is dead". Then people at your work are clueless I'm afraid
- CmonDev 13y agoYou can use something that is not browser-specific (since WebGL is not a part of HTML5), such as Unity instead.
- superqd 13y agoIt's a pretty bright future for WebGL. Lots of companies are doing 3D visualization on the web, including the one I work for. Our product includes an embedded web based architectural model 3D viewer (written by myself and one other dev). So there are definitely companies making serious use of it.
- Joeri 13y agoInteresting producr. I've been looking into BIM integration for the FM software suite I work on, and the possibility of embedding a webgl BIM viewer to match our existing SVG-based CAD viewer. It seemed like a lot of work though to get it running properly (it seemed like one of those things where you can get a demo going in a matter of hours but finishing it up takes months).
- superqd 13y agoYou are correct. One of our devs built a prototype using a 3rd party WebGL framework quickly (few days), but for the real deal, we started over and went straight to WebGL ourselves (so we could better optimize for large models, etc). The prototype that was built just couldn't handle models of any meaningful size, so we definitely needed to own everything about the code so we could optimize for our needs. We are in the BIM space and have one of the few web based viewers for such models. Some other products require a plugin to render 3D, but we really wanted to reduce friction to use our product, so we decided to go with WebGL. It's now supported in all 3 major browsers too.
- nairteashop 13y agoIt's a good question. I have an entire bookmark folder of "cool WebGL demos" collected over the years, but have seen very few full-fledged applications. One way you could hedge the WebGL vs. Canvas bet is to use something like THREE.js, where you use THREE's cameras, lighting, etc and then specify whether it should use WebGL or Canvas for rendering. But then again, you'd be betting on THREE.js :) https://github.com/mrdoob/three.js/ https://github.com/mrdoob/three.js/
- AshleysBrain 13y agoWebGL is not just for 3D: it can be used for 2D games, where it is way faster than ordinary canvas2d, and allows use of shader effects and such. Major web game engines like Construct 2 [disclaimer: I am developer] use WebGL rendering with effects, and fall back to canvas2d if WebGL is not supported. So at least with Construct 2, it's been in commercial production use for a couple of years already.
- TazeTSchnitzel 13y agoWorth noting that only the WebGL renderer has normal FPS.
- thejefflarson 13y agoThat depends. At ProPublica we've done a bunch of visualizations with canvas and SVG in the past, and they are powerful tools. However, as part of our investigation into Hurricane Sandy flooding we knew we wanted to make a 3D visualization of NYC of show the storm surge: http://projects.propublica.org/nyc-flood/ http://projects.propublica.org/nyc-flood/ If your data is inherently 3 dimensional I'd say it is worth the effort to dive in, but the majority of visualizations that we do are charts and plots which don't really need to be 3D.