Meshwork and VRML

Using Meshwork to build VRML models for use on the web

Meshwork's lean, polygon-efficient models are ideal for use with the Virtual Reality Modeling Language (VRML), a 3D standard often used on the web. Efficiency is especially important in web graphics, when the user may have a slow network connection or a computer that has other things to do besides render 3D graphics. This document will help you get started.

What You'll Need

  1. a VRML Viewer -- this could be a web browser plug-in, or a stand-alone program. See below for some suggestions.

  2. a text editor -- I recommend BBEdit Lite, but see here for some other good options.

  3. a graphics utility -- I recommend GraphicConverter, but there are many other options.

  4. Meshwork (of course!).

Important Links

If you intend to do any VRML on the Mac, then you must keep the following links at hand:
the #1 site for info and resources on web 3D and virtual worlds on the Mac
answers a lot of frequently asked questions about VRML on the Mac

Viewing VRML

If you're going to create VRML, first make sure you can view it -- you want to be able to view VRML97 (also known as VRML 2.0), not just the older VRML 1.0 files.

Start with the VRML FAQ, which will tell you how to get, install, and trouble-shoot Cosmo Player, an aging and unsupported Netscape plug-in which was until recently your best bet for viewing VRML on the web -- and may still be best, in some cases.

But also consider MacLookat, a great stand-alone VRML viewer. It's based on LibVRML97, an open-source standard library, and ported to the Mac by Michael Louka. It's a great program that provides the best combination of stability, efficiency, and power for VRML viewing on the Mac platform.

I also recommend Twirl, a stand-alone VRML viewer. It's much smaller, leaner, and more stable than the Netscape + Cosmo Player combination, which could be a big advantage when you're going back and forth between your 3D editor(s), your text editor, and viewing the VRML scene. It's also a lot easier to get going (just unpack it and run it, samples are included!), so it's a good place to start when you're just getting your feet wet in VRML. On the down side, it has a rather primitive interface, and doesn't support material attributes (each material is drawn in a random color).

Creating the VRML Model

Create (or import) your model in Meshwork, such as the example shown in Figure 1. Then, choose Export > VRML. The result is a VRML file, which will look something like this:

This is simply a text file containing all the information on the geometry of the model -- to see what it looks like, click the icon above. You can drop your own VRML file onto BBEdit or your favorite text editor.

Attaching the Textures

Do a search on the word "texture" in your VRML file. If your model uses any textures, you'll find some code that looks like this:
                texture ImageTexture {
                        url "texture1.jpg"
When Meshwork exports to VRML, it doesn't know how you'll want to name your texture files. So it uses a simple pattern: the first material (colored white by default) is called "texture0.jpg". The next one is called "texture1.jpg" and so on. In other words, Meshwork assumes you have texture files, stored in JPEG format, with numbers that correspond to the Meshwork material used.

To finish the VRML model, you have two choices:

  1. Supply textures with the names used by Meshwork, or
  2. Change URLs in the VRML file to point to where the texture files actually exist.

(In a future version of Meshwork, you'll be able to specify "material names" to be used as texture URLs in the VRML export, making this step unnecessary.)

If you have any difficulties, write to me, the Mac VRML/X3D Discussion List, or the Meshwork Discussion List.
Last Updated: 7/05/00 . . . . . .