Examples of Mathematica Graphics Converted to VRML

Feel free to use any of these VRML objects without giving me credit. However, I would be interested in seeing any of your creations that use these objects or that use VRMLConvert, if you wouldn't mind sending me the URL.

Example 1: A Seashell

This example uses the default camera position, lighting, and surface properties. The default surface material is white. The most noticable feature is the lighting. It consists of a red, a green, and a blue light, all on the same side of the object as the camera. So the back side of the object is dark.

Mathematica Code

  x[theta_,phi_] = phi/18 Sin[theta] Cos[phi];
  y[theta_,phi_] = phi/18 Sin[theta] Sin[phi];
  z[theta_,phi_] = phi/18 Cos[theta] + phi/6;
  seashell = ParametricPlot3D[
     {x[theta,phi], y[theta,phi], z[theta,phi]},
     {theta,0,Pi}, {phi,0,6Pi},
     PlotPoints->{15,60}];
  VRMLConvert[seashell, "Macintosh HD:seashell.wrl",
      PlotLabel -> "Seashell"
    ]

Mathematica's Output

VRMLConvert's VRML Output


If you cannot view the above VRML image in-line, you can either pass seashell.wrl to an external helper application or save it to your hard drive.


Example 2: A Blue Stellated Icosahedron

In this example, we explicitly specify surface properties and lighting. The stellated icosahedron is Wolfram Research's Mathematica logo.

Mathematica Code

  Needs["Graphics`Polyhedra`"];
  stellplot = Graphics3D[Stellate[Icosahedron[]]];
  Show[stellplot];
  VRMLConvert[stellplot, "Macintosh HD:stellate.wrl",
    PlotLabel -> "Stellated Icosahedron",
    SurfaceMaterial -> SurfaceColor[RGBColor[0,0,1]],
    LightSources ->
      {{{1,1,1},GrayLevel[1]},{{-1,-1,-1},GrayLevel[.7]}}
  ]

Mathematica's Output

VRMLConvert's VRML Output


If you cannot view the above VRML image in-line, you can either pass stellate.wrl to an external helper application or save it to your hard drive.


Example 3: Henneberg's Minimal Surface

This is a minimal surface created using Roman Maeder's MinimalSurfaces package (Roman Maeder, Mathematica Programmer, AP Professional, 1994).

Mathematica Code

  Needs["MinimalSurfaces`"]; 
  SetOptions[ParametricPlot3D, Axes->None];
  SetOptions[ParametricPlot3D, PlotRange->All];
  PolarSurface[ 2-2/z^4, z, z, {0.35, 0.85}, {-Pi, Pi},
    PlotPoints->{12, 48} ];
  VRMLConvert[henneberg, "Macintosh HD:henne.wrl",
    PlotLabel -> "Henneberg Surface",
    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]}}
  ]

Mathematica's Output

VRMLConvert's VRML Output


If you cannot view the above VRML image in-line, you can either pass henne.wrl to an external helper application or save it to your hard drive.


Example 4: A Fish

This example shows how to apply different surface properties to different parts of the object. Each part must be created as a separate Mathematica 3D object. The surface properties of each part is listed in the SurfaceMaterial option of VRMLConvert.

Mathematica Code

  fishtop =
    ParametricPlot3D[{x, .2(2x-x^2) Cos[t], (2x-x^2) Sin[t]},
      {x,-.25,2},{t,0.1,Pi-.1}];
  fishbottom =
    ParametricPlot3D[{x, .2(2x-x^2) Cos[t], (2x-x^2) Sin[t]},
      {x,-.25,2},{t,Pi+.1,2Pi-.1}];
  leftstripe =
    ParametricPlot3D[{x, .2(2x-x^2) Cos[t], (2x-x^2) Sin[t]},
      {x,-.25,2},{t,-0.1,.1},
      PlotPoints -> {15,4}];
  rightstripe =
    ParametricPlot3D[{x, .2(2x-x^2) Cos[t], (2x-x^2) Sin[t]},
      {x,-.25,2},{t,Pi-0.1,Pi+.1},
      PlotPoints -> {15,4}];
  x = 1.7;
  t1 = Pi/2 + 1;
  t2 = Pi/2 - 1;
  eyes = Graphics3D[{{PointSize[0.05],
            Point[{x, .2(2x-x^2) Cos[t1], (2x-x^2) Sin[t1]}],
            Point[{x, .2(2x-x^2) Cos[t2], (2x-x^2) Sin[t2]}]}}
         ];
  Show[fishtop,fishbottom,leftstripe,rightstripe,eyes,
    ViewPoint -> {2,2,0}
  ];
  VRMLConvert[{fishtop,fishbottom,rightstripe,leftstripe,eyes},
    "Macintosh HD:fish.wrl",
    SurfaceMaterial -> {SurfaceColor[RGBColor[1,1,0]],
                        SurfaceColor[RGBColor[1,1,0]],
                        SurfaceColor[RGBColor[1,0,0]],
                        SurfaceColor[RGBColor[1,0,0]],
                        SurfaceColor[RGBColor[0,0,0]]},
    PointStyle -> Sphere, SphereSize -> 0.05,
    LightSources -> {{{ 1, 1, 1}, GrayLevel[1]},
                     {{-1,-1,-1}, GrayLevel[1]}},
    ViewPoint -> {2,2,0}
  ]

Mathematica's Output

VRMLConvert's VRML Output


If you cannot view the above VRML image in-line, you can either pass fish.wrl to an external helper application or save it to your hard drive.


Example 5: A Terra Cotta Roof

This example shows how different the scale can be in Mathematica's output and VRML browsers' output. The aspect ratio of this object is 0.2:4:4. Mathematica stretches the image vertically to fill the viewing window, while VRML browsers show the object in true scale.

Mathematica Code

  corrugat = Plot3D[0.1 Cos[5 Pi x], {x,0,4}, {y,0,4},
    PlotPoints->{100,2}];
  Needs["Graphics`Colors`"];
  VRMLConvert[corrugat, "Macintosh HD:corrugat.wrl",
    SurfaceMaterial -> SurfaceColor[Firebrick],
    LightSources -> {{{ 1, 1, 1}, GrayLevel[1]},
                     {{-1, 1, 1}, GrayLevel[1]}}
  ]

Mathematica's Output

VRMLConvert's VRML Output


If you cannot view the above VRML image in-line, you can either pass corrugat.wrl to an external helper application or save it to your hard drive.


Go up to VRMLConvert Description