VRMLConvert Documentation
Description
VRMLConvert is a Mathematica package that converts Mathematica 3D
graphics into VRML format, and writes it to a .wrl file. This file can be
viewed using a variety of
VRML
browsers. You can navigate around and through your graphic. This does
not require a Web server.
Version 1.1 incorporates code generously contributed by
Eckhard Hennig <hennig@rhrk.uni-kl.de> or
<http://www.e-technik.uni-kl.de/organizations/itwm/people/Hennig/Eckhard.html>.
His contributions to
- reduce numerical print precision of point coordinates and
- remove duplicate polygon point coordinates
greatly reduce the size of the VRML file.
Examples
Even if you don't have a copy of Mathematica available, you can still
look at these examples.
Installation
Installing VRMLConvert
You can
download VRMLConvert
from the ftp site at the Mathematics Department, Indiana University of
Pennsylvania, U.S.A. VRMLConvert will also be made available on
MathSource.
Configuring your Web Server
If you want to distribute your VRML files
over the Web, you can do so by configuring your server to distribute .wrl
files as x-world/x-vrml MIME types.
Usage
Examples
Here is an example of how you can use VRMLConvert to convert a graph.
sinplot = Plot3D[Sin[x y], {x,-Pi,Pi}, {y,-Pi,Pi}]
Needs["VRMLConvert`"]
VRMLConvert[sinplot, "sine.wrl",
PlotLabel -> "This is Sin[x y]",
SurfaceMaterial -> SurfaceColor[RGBColor[0.5, 0.5, 0.0]]
]
VRMLConvert Options
VRMLConvert has quite a few options
primarily because I tried to incorporate as much of Mathematica's rich
3D graphics capabilities as I could.
Advise on Using VRMLConvert
ViewPoint and BoxRatios
The perspective of the VRML image will not be quite the same as the
perspective of the Mathematica graphic. Mathematica performs a series
of transformations on its Graphics3D objects before it plots them on the
screen. The last step is to expand the projected 2D image to fill the
display area. VRML browsers perform their own projections into 2D, so
VRMLConvert does not do any projections nor an expansion to fill the display
area. VRML uses a scaling equivalent to
Mathematica's BoxRatios -> Automatic. Some VRML graphs will
appear radically different from the corresponding Mathematica graphs.
This is likely to happen when
- the BoxRatios vary significantly. This can skew the image and it
can cause certain ViewPoint values to correspond to large values in the
world coordinate system.
- large values of ViewPoint are used in Mathematica to diminish the
effects of perspective, but the VRML version of these graphs will only fill a
small portion of the VRML browser's viewing window.
- the scales of the coordinate axes vary significantly. The VRML image
will be displayed using equal scales.
LightSources
The default Mathematica light sources are all in front of the image, leaving the
far side of the image dark. If you want the all sides to be illuminated,
then include some light sources with negative coordinates, for example,
LightSources -> {{{1.,0.,1.},RGBColor[1,0,0]},
{{1.,1.,1.},RGBColor[0,1,0]},
{{0.,1.,1.},RGBColor[0,0,1]},
{{-1,-1,-1},RGBColor[1,1,1]}}
Inline VRML worlds
If you want to use a VRMLConvert-generated world inline in another world
and if you want the inline world to inherit the properties of the other
world, then you may want to exclude the camera, lights, and/or material
surface properties in the VRMLConvert-generated world. You can turn off
these properties using the options Camera -> False, Lighting -> False,
and Surface -> False, respectively.
Future Needs
Axes
It sure would be nice to have the option to include axes. Anyone interested
in taking on the challenge?
Mathematica's 3D Text
Mathematica's 3D Text primitives are placed in the correct location in
the 3D VRML scene, but VRMLConvert doesn't try to orient the text in any
particular direction. It should be oriented so that it faces the initial
camera position.
Speed of VRMLConvert
I haven't done any tests of VRMLConvert to see if it
can run any faster. So I'm sure that its speed can be improved. A
ParametricPlot3D graphic with a 15x60 grid required 45 seconds to convert
to VRML on my PowerMac 6100/66. If you have some time to do some
experimentation, you might want to concentrate on the section that creates
the polygons.
Programs |
People |
Courses |
Facilities |
Calendars |
Projects |
Jobs
IUP Math |
Nat Sci & Math |
IUP Info |
Related Sites
Read this
disclaimer.
Maintained by
H. Edward Donley
<hedonley@grove.iup.edu>
Last Modified on Monday, 13-Aug-2001 16:55:26 EDT