WebGL delivers 3D everywhere

WebGL is a developing standard for delivering 3D content inside an HTML5 canvas.

The spec hasn’t reached a 1.0 version yet, but Safari, Firefox, Opera, and Chrome have support we can try out in their nightly builds for the draft version. I had the best luck on both Linux and OSX in trying out WebGL by using firefox nightly builds. There are several documents out there to help you try it… see herehere, etc.

WebGL is not only highly anticipated on these desktop browsers. It has the potential to provide the first means to make 3D content that runs on the desktop and across the spectrum of high-end mobiles. Nokia was the first to introduce early support in its N900 mobile. We expect Apple and Google to add support before long.

There are a lot of libraries out there for making WebGL easier to work with. I went about asking the authors of a few of the packages how they might scale down to mobile use and where they fit in the big picture. I’ll summarize some of the discussion here and build some examples in the followup article.

Paul Brunt, working on GLGE, commented on where it fits in.

“I would have said that the best fit would be web developer type interested in making games, although GLGE can be used to make any application, the original code base was for a game I was intent on making. As a result I’ve abstracted quite far from the low level stuff and the library now handles creating GLSL shaders, animations, and other stuff commonly needed when dealing with 3D. Unlike say O3D/SpiderGL which are much more useful for more unusual applications as they are friendlier when lower level access to the GPU is required, but it does mean a lot more ground work to get an application going… As for mobile stuff, I’m hopping GLGE will deal okay. At the moment there are probably a few shader issues I’ve not spotted, but fingers crossed it should rapidly get sorted when the mobile devices start to appear with webGL and I get some bug reports in.”

Benjamin Delillo contrasts WebGLU. He penned a response characteristic to the minimal library I think:

“WebGLU would be quite appropriate for mobiles as its design allows applications written with it to be exceedingly simple. This is also its advantage over other frameworks.”

SpiderGL has possibly the coolest name and has as a goal to make it possible to use WebGL primitives mixed with its own calls so you don’t lose any of the flexibility of direct WebGL. Marco Di Benedetto explains:

“We had our paper on SpiderGL accepted at the Web3D 2010 Conference. I just updated http://spidergl.org with a link to the paper, I think going through the article is the best explaination about the library. In few words, SpiderGL is aimed at simplifying all the common webgl patterns for buffers, shader programs, textures etc. while not preventing access to the low-level webgl layer. It is not a scene graph. Moreover, it does not only provide rendering stuff but also geometrical classes and routines for (basic, for now) geometry processing.”

C3DL started out before WebGL became an official effort. C3DL has several developers working on it. It has an irc forum at irc.mozilla.org#c3dl. I asked if anyone there would care to speculate on how well C3DL would work on mobile and got a response on irc.

“[It] depends on the capabilities of the video rendering of the device. If new phones come out with NVidia/ATI ultra lite, and low power video chips with relatively decent framerates, it should be possible.”

SceneJS includes a parser for collada objects. The author, Lindsay Kay, was keenly interested about mobile operation.

“SceneJS is not actually tested on mobile devices yet, but after viewing the Collada presentations from WebGL camp, it dawned on me that it should be a priority for SceneJs to work efficiently on them… how it compares – thats a tough one. I think it’s currently behind a bit in terms of 3D effects like shadows, transparency etc., but I would say that it’s got some advantages in that its API is compact and flexible, and is geared towards modularity where instances [prerelease 0.7.6 docs] are fully parameterisable.

CopperLicht seems to be the option with the highest level of commercial support and includes tools for building models. You can use this library without buying support but for more access to source and tools you should plan on it. Nikolaus Gebhardt commented on the use on mobile platforms:

“…some users told me they were able to run the CopperLicht demos on their Nokia N900. See for example this blog post where the author writes that even the CopperLicht Quake 3 level demo seems to run (key control also works as someone in the comments writes).”

ProcessingJS is in a class by itself… rather than a javascript layer on top of WebGL, this library provides its own C-like visualization language that is converted into canvas operations, including WebGL operations. This would be a good choice for simple interactive visualizations. ProcessingJS has been adapted to work an interesting “IDE” (pictured above) that runs in iPad and other webkit mobiles. As a reminder, only 2D operations work on these mobiles since WebGL is not running on iOS yet. Since the 2D methods work on mobile, everyone fully expects the 3D operations to be workable on mobile as well.