X3D and DOM

My previous post was an introduction to X3DOM – which included a brief definition of the two components, X3D and DOM. I’d like to do another post, where I dig a little deeper into each of those.

What is X3D?

For a formal introduction, I would refer you to Wikipedia. But once you’re up to speed on the basics, I’d like to elaborate a little.

X3D, much like its predecessor VRML, is a way of storing data about 3D things in a human-readable format based on XML. You can write X3D by hand in a text editor – or you can output it from a 3D modelling tool like Blender.

X3D is just a way of storing data. But then, so is a .jpg. By now, I think everyone is willing to admit that .jpg files work everywhere, and that they’re not going away. In an ideal world, and by that, I mean a world where 3D content is as available on the open web as 2D content is now, there would be ways of packaging up your 3D data that are as ubiquitous and portable and universal as .jpg, or .png, or .gif.

And this seems to be the mandate of the Web3D Consortium.

From their website:

Founded in 1997, we are an International, non-profit, member-funded, industry standards development organization. We develop and maintain royalty-free ISO standards for web-based 3D graphics. Our standard   X3D (Extensible 3D) originated from VRML and is available in XML, Compressed Binary, and classic VRML formats. X3D is open, royalty free, extensible, interoperable, and runs on all platforms including desktops, tablets, and phones.

But while they’re looking out for the format itself – their site doesn’t particularly help promote the use of X3D on the web.

And that’s where the DOM comes in.

Why X3D and DOM?

For this, I’m going to provide another link to another website – x3dom.org.

The goal here is to have a live X3D scene in your HTML DOM, which allows you to manipulate the 3D content by only adding, removing, or changing DOM elements. No specific plugin or plugin interface (like the X3D-specific SAI) is needed. It also supports most of the HTML events (like “onclick”) on 3D objects. The whole integration model is still evolving and open for discussion.

From reading that, you’d think it was Science Fiction. Or, at least that you couldn’t practically use it today. Well, you can. x3dom.org provides a little JavaScript file and a little CSS file that you can load into your page, and *poof* – you can load a .x3d file like you’d load a .jpg file, and it’s all rigged up nicely into the DOM of your webpage. And by rigged up nicely – I mean, you can access every node in that X3D file, the same as you’d access a node on your DOM tree.

I tried it. It works. (This is from my previous post about X3DOM)

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

So there’s another attempt at simplifying the odd marriage between a file format and a convention – X3D and DOM.



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