XML format for 3D geometry

Jean-Marc Vanel


For our project of making botanical data available on Internet, we need 3D images. We need a compact, non proprietary, preferably XML, clean definition for complex 3D geometries.

It seems that a representation both compact and flexible should be based on  mathematics. VRML's cones and cylinders are just special cases of intersections of volumes defined by equations:


NURBS and Beziers patches are just special cases of surfaces defined by 3 functions R2 ---> R3

(u,v) ---> (X(u,v),Y(u,v),Z(u,v))


A solution is to use the content part of MathML (spec. of MathML) . I have reviewed it: it has the desired capabilities, i.e. allows to define functions and sets, it is XML. Certainly only a subset of MathML is needed: n-dimentional geometry, n>3 is not relevant. On the other hand, some geometrical primitives could be added :  See below for a sphere Example showing how a preliminary definition for a parametrized sphere shape (that could reside in a configuration file or on Internet) makes for a very compact definition.

Also an advantage of mathematical  representation is being able, by formal differentiation, to compute exact normal and tangent plane for light-ray reflection rendering.


I have followed the debates about  VRML/X3D (Virtual Reality Modeling Language) for weeks on x3d-contributors@web3d.org. The point is about modular schemas versus monolythic Schemas. X3D is a very "good" example of monolythic DTD. NOTHING is taken from the XML world outside X3D.
VRML has existed for years, and has not met a huge success. The current X3D specification seems merely a word-for-word translation of VRML97 in old XML monolythic DTD style. It's more than time to have a modular state of the art XML VR vocabulary, with all the facilities of XML Namespaces, XML Schema, and possibly XSLT, SMIL, etc.

 It's also more than time to search other partners for the 3D geometry subset outside of the video circle, notably CAD and scientists involved in numerical simulations, and biological descriptions. See below the wide perspectives opened by this convergence.

Also there is a big opportuneness to have skilled computer scientists from the numerical simulations domain join the design process. They are shure, like I am, discouraged by the current design of VRML, and its too narrow scope.

Design hints for VR

It seems that Virtual Reality (VR) involves several layers that can be used and designed independently:


This need for a compact, non proprietary, preferably XML, clean definition for complex 3D geometries is common with other important domains: CAD is a very important field that has currently no XML non-proprietary language. The current non-XML formats, IGES, STEP are not satisfactory for a number of reasons. It seems that the proposed solution could bring an interesting synergy able to speed up developments, together with a better design. And also a common subset for CAD and Virtual Reality will bring new possibilities to exchange data. Think of the advantages for the VR people of being able to import directly shapes from manufacturing industry, and use them in animations! A well-designed model and XML syntax for virtual reality could also be used for cartoons and video games.


ANNEX 1: a sphere in MathML

Note: this is just a example to show the vast possibilities of MathML; a final version of sphere would be different. We would use the characteristic function associated to sets, and multiply functions for intersections, and add functions for unions. Below is an XSLT  transform from a MathML 3D geometry file such as this example  to C++ declarations.


ANNEX 2: an XSLT transform from a MathML geometry to C++

The XSLT below transforms a MathML 3D geometry file such as the sphere example above to C++ declarations.
sphere.cpp generated C++
Geom3d.cpp additional declarations