Net Gains

Net Gains

By Ed Fear

December 8th 2009 at 8:45AM

Khronos Group explains how WebGL could mean the browser gaming boom skips plug-ins altogether

With the Khronos Group’s WebGL specification already picking up support before its first release, could the browser gaming boom skip plugins completely? Ed Fear spoke to Arun Ranganathan, chair of the WebGL working group, to find out more…

What is WebGL, and how does it relate to OpenGL?

The WebGL project was initiated by Mozilla earlier this year as a Khronos working group, and soon gained active support and participation from browser vendors in addition to various other companies, including Nvidia, AMD and Ericsson.

The project began as a Firefox extension created by Mozilla’s Vladimir Vukicevic, which initially showcased a low-level JavaScript API on top of OpenGL ES. It soon became clear that in addition to the 2D drawing API exposed through the HTML5 Canvas element, the Web needed an API for hardware-accelerated 3D graphics. Starting with pre-existing building blocks that were already in circulation on various hardware made a lot of sense, and so Mozilla approached the Khronos Group, which is the standards-setting organization behind OpenGL, OpenGL Shading Language, and OpenGL ES, amongst other media standards.

WebGL essentially brings OpenGL ES to the Web. Developers familiar with OpenGL ES 2.0 will recognize WebGL as a shader-based API, with constructs in JavaScript that are semantically similar to those of the underlying OpenGL ES 2.0 API. It stays as faithful as possible to the OpenGL ES 2.0 specification, with some concessions made for what developers expect out of JavaScript. We look forward to the intersection of OpenGL developers and Web developers, and are greatly anticipating the kinds of Web applications and Web pages they will build.

Are all of the browser companies behind it? Is there an estimated roadmap for uptake of the standard?
Major browser vendors are behind it – Google, Opera, Mozilla, and Apple. There has been some press about builds of Safari, Chromium, and Firefox already showing beta builds that implement WebGL. Even before a specification has been released, developers have been able to look at the source code of these browsers and build demos showing WebGL in action. We’re optimistic about uptake of the standard.

What competing standards exist in the in-browser 3D space?
The Web3D Consortium came up with X3D, although I don’t classify that as a competing standard, since it aims to solve a different problem than WebGL. Declarative representations of 3D graphics can live alongside a technology such as WebGL, and so I would say technologies like X3D are complementary to WebGL, and can envision JavaScript libraries that support X3D built on top of WebGL. All other 3D technologies are used with browser plugins, whereas WebGL will be implemented natively by browsers.

There have been some creative uses of 2D APIs to simulate 3D, or even emerging technologies like ‘perspective 3D’ which enables 3D transformations of 2D elements in Microsoft’s Silverlight. These are very different than what WebGL does, which is to provide safe access from Web content to hardware-accelerated 3D graphics, or to software rendering, by providing a familiar API in the 3D space. Again, technologies like Flash and Silverlight require a plugin; also, currently, they don’t constitute competing ‘standards’, since they don’t leverage a standardised way to access hardware-accelerated 3D graphics.

Google has its own 3D-in-browser solution, O3D, but is also a part of the WebGL initiative. How do the two approaches differ? Google’s O3D is an interesting and promising technology, but it starts with a much higher level API than WebGL. While WebGL is a low-level API with no notion of a scene graph API, O3D provides higher level abstractions in JavaScript, including ways to work with scene graphs.

Currently, O3D is built as a C++ plugin. We anticipate that in the future, technologies like O3D can be built on top of WebGL, taking advantage of radical JavaScript performance improvements. The Web has always benefited from libraries like Dojo, jQuery, and Prototype, which provide Web developers with programmatic conveniences on top of what browsers expose. We anticipate the same thing for 3D programming on the Web.

Speaking of JavaScript – does it offer speed disadvantages when compared to plugins? Does the memory footprint of the browser environment affect things?
JavaScript performance has increased dramatically in Web browsers, and there is a great deal of competition amongst browser vendors to introduce even more improvements. Through software techniques such as tracing, Firefox’s latest JavaScript engine (named ‘TraceMonkey’) can run certain JavaScript programs at least three to four times as fast as some other browsers. We’re very confident that JavaScript is a great environment for 3D programming on the Web.

Do you think that plugins will start to become a rarer thing as time goes on?

The plugins API serves a useful role on the Web – that of enriching the capabilities of browsers, and of delighting consumers with new experiences. Flash is a shining example of this, and enjoys ubiquity. Advances made by browser plugins and extensions have influenced the direction of the Web. For instance, the Web now supports audio and video natively through the HTML5 audio and video elements and their affiliated APIs.

The Web platform is getting more and more feature rich; many technologies that were once the purview of proprietary and closed-source plugins are emerging as open standards, and are in open source implementations such as Firefox. To the extent that developers are able to deploy interactive, visually rich, and accessible applications on the Web without needing plugins, some plugins may be obviated.

Additional concerns with plugins are security issues, as well as general memory management concerns. In addition to ensuring that their browser is up to date, consumers have to also ensure that their plugins are up to date. Mozilla wants to ensure that the plugin experience continues to be safe for consumers, since a vulnerable plugin can put users at risk.

How does WebGL handle legacy browsers?
Legacy browsers won’t have support for WebGL. Firefox beta builds have introduced support for WebGL; other browsers that have support for WebGL in beta builds include Safari and Chrome. When these browsers are released as final quality software, a browser upgrade will be necessary.

What sort of experiences do you visualise being enabled through WebGL?
Some demos that showcase WebGL exist already, but beyond that, I envision 3D games in Web applications, and 3D-enriched Web pages, including medical imagery, topographic maps, and information visualisations. Along with all the usual presentational technology standards on the Web – SVG, CSS, HTML and JavaScript – I look forward to what developers can do with the added capability of WebGL.

www.khronos.org