X3DOM

X3DOM. It sounds complicated at first – but it’s really quite simple. Not only is it simple – it’s pretty cool. And yet – it doesn’t even have an entry on Wikipedia (Feb 2016). Just a link to some examples in the “External Links” section of the entry on X3D.

https://en.wikipedia.org/wiki/X3D#Example_documents_of_X3DOM_code

So, what is it about X3DOM that sounds complicated at first, but is really quite simple? The first thing you need to know is that the “D” in X3DOM is Doing Double Duty.

Its first job is to be the “D” in X3D – “X3D is a royalty-free ISO standard XML-based file format for representing 3D computer graphics. It is successor to the Virtual Reality Modeling Language (VRML).” (From the link above.)

Its second job is to be the “D” in DOM. “Document Object Model”. Again, from Wikipedia: “The Document Object Model (DOM) is a cross-platform and language-independent convention for representing and interacting with objects in HTML, XHTML, and XML documents.[1] The nodes of every document are organized in a tree structure, called the DOM tree. Objects in the DOM tree may be addressed and manipulated by using methods on the objects.

So. X3D is a file format – and DOM is a convention.

So, what the heck is X3DOM, then?

I could talk around that all day. There are sites out there that talk around that all day. What I’d like to do is lay it out, real clean and simple, before I end this post.

Think about how an html document relates to a button in a form on the page. It considers it a button, in a form, on the page. Seems simple enough.

Now imagine that an html document could consider the skyscraper in the scene in the X3D file on the page just the same way.

Imagine every node in your X3D file being just like every other node on your page. <img>, <a>, <form>, <sphere>, <mesh3D>, <camera>, all just nodes in the DOM tree as far as the DOM is concerned. X3D in the DOM. X3DOM.

Lucky co-incidence, then, that the structure of the DOM tree, and the structure of an X3D scene graph, are quite inter-operable? Or is it more like convergent evolution (dolphins look like whales) in that the “tree” structure is just the solution that makes the most sense, both for mammals and fish, er, html documents and 3-dimensional worlds? I tend to think it is that latter.

Anyway, that’s X3DOM, in a nutshell. I’m going to write about it some more, in the next few posts. But in the meantime – in my last post, I had found a way to import on of my old VRML files into Blender, then export it as a COLLADA file, and then load that COLLADA file into three.js – so that I could deploy that antique 3D content on the open web, for all to see, with no plugins.

I also tried exporting the contents of the VRML world into an X3D file, and just plain loading it into an html document with X3DOM.

You can drag your mouse on that to move it around – each button gives you a different motion when you drag.



Works fine. At least as well as the three.js experiments I’ve tried. But, what a completely different paradigm.

It is worth noting that the consortium that promotes X3DOM is quite up-front about that fact that it is a format/convention that is in development. Which is kinda cool – because like three.js – it obviously is…

Tweet about this on TwitterShare on Google+Share on LinkedInShare on FacebookEmail this to someone

Author: Pete

Editor-in-Chief, Lead Software Developer and Artistic Director @ 3dspace.com

2 thoughts on “X3DOM”

Comments are closed.