| This tutorial will take you step by step through using LightWave3D and XGLTool to create xplane/xgl compliant models.
You can reach a downloadble PDF version of this document as well as sample, ready-to-use files from my downloads directory.
This tutorial assumes you already know how to use LightWave and Modeler and is not a tutorial for these tools, simply a guide to using them and XGLTool to create XGL content and textures for use in X-Plane.
To fully utilize the tutorial, you'll need LightWave, but the techniques described here should generally work for most 3D modeling packages. LightWave has the best VRML output we have found for Mac OS X, but we have not yet experimented with any Windows modeling software.
There are also several 3D file format translators which we are researching, so if you have a 3D package that does not have good VRML output, you may be able to submit your model to us and we may be able to convert it to lightwave and VRML, which is needed for XGLTool at the moment.
Table of Contents (toc)
Before You Begin
Texture Use Limitations
Exporting VRML from LightWave
Viewing the VRML file in XGLTool
Compiling VRML into standard XGL
Building your HTML Image Map
Compiling VRML (.wrl) into XPlane XGL (.xpxgl)
Before You Begin
Visit the XGLTool page, install Java (if needed), GL4Java, and download the examples...
What's Included in the "lexington_example" package:
Let's start out with an explanation of the files/folders ....
Our convention is to name a folder with your model name (lexington_example), create a subfolder (original_model here), name the model with that folder name (lexington_example.lwo), put all the textures into this directory while working on the model, and then move copies out to the "main directory" before you do your final compile. What's most important for compiling (and modeling and image map creation) is that the textures/images/files/assets be in the same directory as any files that refer to them...
completed_xpxgl_model
- lexington_example.bmp - a single 512x512 bitmap containing all of the textures used in the model. To maximize simulator frame-rate and performance, all objects are limited to one texture file (.bmp) per object (actually it is 2, one named, for example lexington_exampleLIT.bmp that is combined with the "daytime" version during dawn/dusk and used during full darkness - this example does not include a lit bitmap). NOTE: This is not a completed model - the additional texture area will be used for other textures.

- lexington_example.xpxgl - this is an xplane ready compiled XGL file that contains all of the geometry and other information related to displaying the model in XPlane
imagemap_development
- lexington_example.html - this is an HTML file, created/edited with Adobe Go Live. Any HTML editor that can create image maps (clickable portions of an image) should be able to create a file like this. This file is quite important in this example because it allows you as the artist to use individual texture files in your 3D modeling package, then simply combine them into a single bitmap and create an HTML image map that maps your individual texture names to coordinates within your "combined" bitmap/texture.
- lexington_example.jpg - this is simply a JPEG version of your bitmap file to use when creating your image map. Most HTML editors do not support .bmp files, so this file (or a PNG) is necessary to view your image in the HTML editor so that you can define the image map coordinates. NOTE: You can NOT use JPEG files in X-Plane, you must use 24bit+ windows bitmap files.
lexington_example.bmp - the "master" bitmap for the model
lexington_example.html - the completed image map file again
lexington_example.wrl - the "ready to compile" VRML file (that requires lexington_example.html to be in the same directory)..
lexington_example.xpxgl - the completed xplane-ready XGL file that refers to the master lexington_example.bmp file
original_model - directory for working on the model
- hard_flightdeck.bmp - texture representing the flight deck
- hull.bmp - texture representing the hull
- lexington_example.lwo - lightwave object
- lexington_example.wrl - VRML file created from the lightwave object
- lexington_example.xgl - XGL file that refers to the individual textures (testing only)
- light_99_99_99_antenna.bmp - texture for the light at the top of the antenna
- smoke1_stack.bmp - texture for the smokestack
- tower.bmp - texture for the tower
Now that we have a brief explanation of the files, let's see some screenshots from the XGLTool viewer:
Here's a shot of what it looks like in lightwave (better lighting):
This example demonstrates all of our conventions in using a 3D modeling package like LightWave to generate VRML and XGL for use in XPlane:
- It uses material specifications for some surfaces (radome, antenna, some others)
- It uses a texture named hard_flightdeck.bmp to tell XPlane that this is a hard surface and can be landed on (see here)
- It uses a texture named smoke1_stack.bmp to tell XPlane to billow white smoke from the polygon (quad) that uses this texture. If it were named smoke2_stack.bmp it would billow black smoke. (see here)
- It uses a texture named light_99_99_99_antenna.bmp to tell XPlane that this is a red pulsing light. (see here)
toc
Texture Use Limitations
In order to optimize performance and frame rate, you can not currently use textures that repeat. This generally means naming surfaces and applying a texture to each surface. This is due to the single texture per object optimization.
We would suggest that you keep a non-textured version of your model in case we are able to remove this optimization/limitation in the future.
Prior to creating textures, you need to be aware of the 2 mechanisms we have for merging them:
Automatic merging into one horizontal, power of 2 bitmap. This can work nicely if you make them all the same height (like 64, 128, 256), or so that they fit horizontally inside a horizontal bitmap without wasting too much space.
Manual merging into a power of 2 bitmap, then creating an HTML imagemap, like you can see below (shot from Adobe Go Live):
This results in an imagemap where each region (shown above) has a link (url) that exactly matches the name of the original texture you used (without the .bmp extension). If you hover over the different regions in the image below and check your browser's status bar (bottom of the window), you'll notice the "url" changes to the various texture names that were originally separate textures:
The compiler can then use your original, mult-texture VRML file (xxx.wrl) and image map (xxx.html) to create a hi-performance single-texture XGL file.
Depending on the model, automatic merging may or may not work well, but you need to be aware of the limitations as you work.
Once you have a model with separate textures files (individual 24 bit .bmp files), you need to figure out how you are going to merge them into a single bitmap.
For the lexington example, we have chosen the manual method because the flight deck needs to be tall and thin and the hull needs to be wide and thin.
Here's a shot of the lexington's image map:
toc
Exporting VRML from LightWave
Assuming you have the VRML97 export plugin installed (if not, you can download it from here, then install it in LightWave), you open your model in lightwave (not modeler), press the File button and choose Export Scene as VRML97:

Next you uncheck Use Prototypes and check Embed Objects

Next you switch to the objects tab and select your object in the popup menu

Next you switch to the Environment tab and check Headlight

Next click on the output.wrl button above, navigate to your original_model directory, and name your output as lexington_example.wrl

Finally click on the OK button and you should see something like this:

toc
Viewing the VRML file in XGLTool
You now have the master VRML (.wrl) file you need to work with XGLTool in the same directory as your separate textures.
Start XGLTool, then use the file menu to view original_model/lexington_example.wrl ...
It may take a few moments as XGLTool must parse the VRML, which takes much longer than parsing XGL. This is really an optional step but does confirm that your .wrl file is usable/viewable.
XGLTool will also load the individual textures from your original_model directory
NOTE: We had at one point recommended using PNG format for your textures because few (if any) VRML viewers can use .bmp files.
XGLTool now handles .bmp format and a limited subset of VRML, but most other VRML viewers do not, so we now only support 24bit .bmp files, which is what X-Products currently use.
With a little zooming and panning, you should see something like this:

toc
Compiling VRML into standard XGL
You won't typically need to do this, but it is available as an option and can be useful while developing your object/model.
There are 2 main differences between Standard XGL (.xgl) and XPlane XGL (.xpxgl):
- Standard XGL keeps your textures separate, XPlane XGL requires all textures be in a single bitmap file.
- XPlane XGL knows about X-Plane constructs such as hard surfaces, lights, smoke, etc. - Standard XGL does not.
NOTE: XGLTool does not render these "special" kinds of objects (hard surfaces, lights, smoke) like XPlane does and it probably will not. You will see them close to how you see them in your 3D modeling package.
To compile liberty_example.wrl into standard xgl (.xgl), simple choose "Compile Standard XGL ..." from the menu, then select the same original_model/lexington_example.wrl ...
After a few moments you should see something like this:

Congratulations, you have just built your first XGL file!
You can now view it by using the "View 3D File..." menu and picking it - you will see the same thing as above, but much faster...
toc
Building your HTML Image Map
As discussed above, we have chosen to merge the individual textures manually into a single bitmap.
This requires creation of an HTML image map that will tell the compiler which region of the master texture corresponds to an individual texture file. There is a lot of "behind-the-scenes" stuff that happens to make this work (known as "S&T" parameters), so it is very important that your HTML image map (lexington_example.html here) be correct (or at least close to begin with).
Most important is that each of your individual texture files have a corresponding and correct "url" (which maps between texture names and parts of the master texture). If the coordinates are off, you can always tweak them, but if there are missing/mis-spelled/wrong names, you'll have problems with XGLTool.
We used Adobe Go Live to create lexington_example.html, along with a JPEG version of the bitmap (many HTML editors don't display bitmap files as they aren't used much on the web due to file size).....
I will try to put together some additional resources on this topic ... in the mean time, here is what I would recommend to create an HTML image map for your model if your are going to manually merge the textures...
- Start with a template, such as lexington_example.html, and duplicate it to [mymodel].html
- Put it into a directory with a JPG version of your master bitmap [mymodel.bmp] saved as [mymodel].jpg
- Use a text editor to open [mymodel.html], and modify the following parameters:
<img src="lexington_example.jpg"> - change this to <img src="[mymodel].jpg">
width="512" height="512" - change these to your image size (your image size must be a power of 2 in both directions)
- Save the file, then open it in an HTML editor - you should see your image (texture) and some boxes (shown above) that define the regions
- Move/resize the regions based on your image map
- Very Important: Image Maps have a "url" associated with them - this is usually used to direct a website visitor to another page. We are using this same concept, but as we are not building a website, we are using the "url" parameter as the name of the texture.
In the lexington_example.html, there is a region with a url of hull - this name must exactly match the name of your original separate texture file name, which you can usually copy/paste from the Finder (Mac) or Explorer(windows). Don't forget to remove the .bmp portion of the texture name.
- When you are happy with your regions and you have them "close" and one for each individual texture, save the HTML file.
- Once you have done this step, it's easy to go back and add regions, tweak their sizes, etc, etc. - this gives you a great deal of flexibility in laying out your master texture.
Additional notes:
- Do not use spaces in your texture names (or any file names)- use hyphens (-) or underscores (_)
toc
Compiling VRML (.wrl) into XPlane XGL (.xpxgl)
The tutorial download comes with lexington_example.html all ready to use, so you don't have to worry about the prior step for this tutorial.
Now that we have the 3 things we need (all in the same directory):
- lexington_example.wrl - the VRML file
- lexington_example.html - the image map
- lexington_example.bmp - the master texture
We can now compile xplane XGL..

Choose lexington_example.wrl from the main lexington_example directory, and in a few moments you will see something like this:
Congratulations! You now have an x-plane ready XGL file and bitmap!
You can now View it, create a LIT texture for it (for this example, it would need to be named lexington_exampleLIT.bmp), etc., etc.
toc
|