WebGL, One of the New Low Level 3D Languages for the Web

last updated 8 Jan 2010

I recently installed the latest FireFox nightly build (Minefield) to test WebGL. WebGL takes a much lower level approach than VRML/X3D, it uses a JavaScript interface to OpenGL ES functions and has been around longer than VRML, so its not exactly anything new its just new to have OpenGL accessible from JavaScript without needing a plug-in. OpenGL is of course already well supported and so having it accessible from the html browser seems like such a logical conclusion, I don't know why it has taken this long. Being low level, it has the advantage of being much easier to convert to from a wide range of 3D modelling applications.

Will a 3D engine written in JavaScript be fast enough for doing things a little more advanced than displaying 3D meshes? Since Techuelife Island was able to animate smoothly in 2000 and the hoppies used intensive scripting for each frame (even the gravity was all accomplished in JavaScript), I see no reason why JavaScript calling OpenGL functions to render the polygons should slow Techuelife Island down significantly and considering a decade has passed since this world was first online, a lot more could be done with the power of today's computers and the new fast JavaScript engines. However skinning was NOT performed originally on techuelife island and since then my interest has concentrated on organic models rather than robots and so skinning would be essential to keep me interested and unfortunately it seems OpenGL does not have built in support for skinning like DirectX has. It seems skinning with WebGL has to be done by processing each vertex one at a time using JavaScript or using the GPU which according to this O3D forum post there are issues because "it takes many shader instructions to do skinning and there will not be enough instructions to do both skinning and other effects (like shadow mapping)"

How to use WebGL in Firefox


You can NOT simply install the latest Firefox yet, you must install the latest nightly build from this directory: http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-trunk/ I downloaded firefox-3.7a1pre.en-US.win32.installer.exe

After installing and running the browser you must type into the address bar:

about:config

Then search for webgl and double click on webgl.enabled_for_all_sites to set it to true.

Online Examples


From the learningwebgl.com, the following example displays a rotating coloured triangle and square on my new computer.

planet-webgl.org also has WebGL examples that work for me.

x3dom.org uses WebGL to display X3D content but unless I am missing something fundamental, to run X3D on OpenGL, you have to either compile the X3D code to OpenGL or use an X3D interpreter written in JavaScript, the latter I guess is what x3dom is doing. I can see how it would be quite easy to write an X3D engine written in JavaScript for running Shape, TimeSensor nodes and Routes for simple animations but to implement the full X3D spec would be a major undertaking. X3D's deferred event design will make things awkward if the X3D specs are strictly adhered to.

It is interesting to find Chris Marrin’s name pop up when googling for info on WebGL.  In case you don't already know, Chris Marrin was one of main designers of VRML97. Later after leaving the Web3D consortium he was working on a high level 3D compiled language called Emma3d.

The Implications for Seamless3d


To make content for OpenGL you are going to need 3d modeling software like Seamless3d but Seamless of course is not dependent on WebGL for it's own native Seamless Chat environment and which unlike WebGL has built in support for skinning.


[3d Modelling Software] [Tutorials] [Forum] [Features] [Download] [Gallery] [FAQ] [Worlds] [Avatars] [Links] [Thyme]