Animated X3Dom

X3D is a file format that enables the storage and playback of 3D objects. It is a format that involves a hierarchical structure of nodes and fields, all held as a string of text. I have used it, the java classes and open graphics library (ogl) binaries provided by xj3d, along with javascript or java scripts to output animated scenes to my browser. Unfortunately my web service provider does not entertain java files on their site and so I decided to try my luck with X3Dom, which does not use java.

X3Dom is much under development. It is intent on adapting the HTML5 specification to include meaningful X3D elements in its DOM (Document Object Management) tree. It renders elements using a javascript file delivered as part of that tree. A problem I met was that word press does not seem to like x3d tags and so the exploding cube I developed displays in a browser window outside of wordpress. Use your back button to return to word press.

Following my doing of the above I discovered at GitHub a create 3000 x-ite site. It provides libraries, like the xj3d libraries, for the purpose of displaying x3d but unlike xj3d the libraries are written entirely in javascript which is downloaded with the html and supports the x3d content therein.

I took a rotating spheres.x3d file I had previously written and used it to replace an x3d scene in an example x-ite scene. I was surprised that the animated spheres scene. ,with all of its nodes and fields and protoype (created) nodes, displayed without modification. The display works in a separate window so as for the exploding cube, use your back button to return to this wordpress post. I also note that x-ite provides a wordpress plug in and at some stage I will have a look at that.

For those interested the code for the expanding cube is to found here. The rotational part of the display uses quaternions. Years ago I studied quaternions and wrote two programs, one in javascript and one in java that took and converted to unit quaternion form, an existing orientation of an object and a desired rotational change to that object. By multiplying the two (order of multiplication matters) the programs delivered a new unit quaternion orientation for the object. That new unit quaternion had then to be converted back to an x3d SFRotation comprising 4 float values, 3 representing a vector and the other the angle of orientation about that vector in radians. The exploding and contracting parts of the display are simply changes to appropriate x, y and z translation values.