Mathematica graphics to VRML converter

m2wrl.m (Mathematica to wrl VRML format) provides a set of functions to convert Mathematica 3D graphics objects to virtual reality modeling language (VRML) version 1.0 documents.

Limitations: Only Polygon graphic primitives are supported. However, the polygons are constructed by using a shared set of points, which makes the rendering faster and gives the VRML browser better hints how to shade the polygons.

Note: The program is free software; you can redistribute it and/or modify it. It is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

source: m2wrl.m

known bugs: the seams


Sample: Torus (Doughnut)

<<m2wrl.m
ParametricPlot3D[{(2 + Sin[2 Pi u]) Cos[2 Pi t], (2 + Sin[2 Pi u]) Sin[2 Pi t], Cos[2Pi u]}, {t, 0, 1}, {u, 0, 1}]
m2wrl[%]
OpenWrite["m2wrl-torus.wrl"]
WriteString[%, %%]
Close[%%]

m2wrl-torus (picture)

Output:
#VRML V1.0 ascii ...
Separator { Coordinate3 {point [ -2.95571 -0.493222 -0.0825793, -2.95571 0.493222 -0.0825793, ... ]}
IndexedFaceSet {coordIndex [ 351, 345, 361, 367, -1, 345, 323, 339, 361, -1, ... ]} }

Enjoy!

Keywords: m2wrl, mtowrl, Mathematica, mma, Graphics3D, Polygon, virtual reality modeling language, VRML, VRML 1.0, world/vrml, x-world/x-vrml, Mathematica converter, Mathematica document converter, Mathematica graphics converter, Mathematica 3D graphics converter, Mathematica to VRML converter, conversion, converter, convert, source code


lr / Mon Mar 30 1998