X3DOM template

X3DOM template is a Blender addon. The idea is to provide a tool for exporting 3D models to web with some basic menu-based navigation.

Template makes it possible to use Blender groups in order to organise model for user interaction. Users can toggle visibility of objects/groups (like layers) and it is also possible to explore indvidual objects from menu.

X3DOM template also allows users to add nodes to the X3D file, like LOD, Switch or Inline nodes that are not possible with basic export.

The actual export is done with slightly modified X3D-export of Blender. The export is controlled with "meta nodes" defined in a  XML file.

The produced HTML is based on template. Some example templates can be found here:


All examples below use this model: city.blend
The model is exported by using this metanode file: metanodes_city.xml
Here are three different layout (templates):

Quick start

  1. Download the addon and install it.
    wget http://opendimension.org/projects/x3dom_addon/2013_11_27_io_scene_x3dom.tar.gz
  2. Download x3dom-template-2-column-fixed template and extract it.
  3. Open the city.blend file from the template directory.
  4. Choose export -> X3DOM template (.x3d) and choose "metanodes_city.xml" and press Export.
  5. Open index.html with your browser.
  6. (note: If you are using index.html locally and you are using Google Chrome, then you must start it with -allow-file-access-from-files flag.  In linux: google-chrome --allow-file-access-from-files
  7. Examine metanodes_city.xml for clarification!

How does it work?

Template is HTML file that has certain structure. The exporter injects the control structure to the template and saves the result. The file name is defined in the metanodes file.

The are two kind of metanodes. First, there are nodes that affect the X3D file written by the exporter. This allows you to add for example Switch or LOD nodes.

Second type of nodes define what kind of HTML is written to the www-template. This makes it possible to define "links" to objects (so that viewpoint is focused to object) or define objects that can be turned on and off (layers).

Here is an example file:

The script uses groups as layers. This makes it possible to group buildings or parts together and allow users to switch them on/off (note: this is different from Switch). Layers (groups) are written in a JSON file.


These nodes affect the actual output of the X3D exporter.

This replaces an object called "Cube" with an Inline node:

          <blender_object name="Cube" >
                     <Inline url="palikat.x3d" />


With add_nodes one can add extra nodes to the exported X3D file.

        <Switch DEF="temple_or_cabin" title="rich and poor" whichChoice='0'>
            <Group title="poor Suzanne">
                <blender_group name="Suzanne's house" />
            <Group title="Rich Suzanne">
                <blender_group name="temple" />


These nodes does not affect the X3D-file. However, they define what is written to the html file.


  • title: string that is displayed as a header for the examineable objects
  • HTMLrender: "list" or "select"
<examineable title="houses" HTMLrender="list">
            <blender_group name="Suzanne's house" axis="posY" title="Suzanne talo"/>
            <blender_group name="House2" axis="posZ"/>

The code above will render something like this:

More info coming soon!