X-Plane Modeler's Guide

Home

About Me
News
Contact Me


Work
My Resume
My Home Office

Client Testimonials

Play (& some work!)
JObjectTool

X-Plane
X-Plane Area 51

Personal
My Beloved Pupper Cody...

Opinions
Once You Go Mac...

Tips/Links
Mac OS X
WebMasters
Java (coming soon)

Important Update 03.04.11 - XGLTool changes

Last modified: Friday, April 11, 2003

This document, in combination with the documentation for XGLTool, the Lexington Example Tutorial, and the XGLTester pages, gives modelers both an overview and details about how to use 3D modeling tools, XGLTool, and most HTML editors for creation of X-compliant objects.


Table of Contents (toc)

Latest News

Introduction
X-Plane Considerations

Modeling Tools
Modeling Guidelines


Latest News

03.03.27 - New today

toc


Introduction

Over the last few months, I've been working with Austin and Anthony Booher on modeling-related issues for X-Products.

Austin originally talked to me about file formats, standards, and we did some preliminary work using DXF, which resulted in my Area51 package.

It soon became very clear that DXF was a poor choice for several reasons:

  • It's a proprietary format defined by AutoCad which means they can change it anytime they wish
  • It has no support for textures or materials

I continued researching the topic, and found that VRML (Virtual Reality Modeling Language), an ISO standard, had open-source libraries available, had support for both textures and materials, and in recent research regarding 3D translation, have found many recommendations that it is probably the most robust, complete, and most importantly, standard way of sharing 3D modeling related data between applications.

It has much, much more to it than is needed for basic 3D modeling data. It does not natively support the X-Plane concept of using a single texture (bitmap file) for an entire object, nor does it support special X-Plane types to support things like hard surfaces, smoke, or lights (point lights, flashing/strobes, traffic lights), but we have come up with some elegant solutions to these issues.

Since it is also textual, it is relatively slow to parse and render, which isn't very well suited for a real-time flight simulator.

For these and other reasons, I have developed/defined the hi-performance XGL (.xgl) and XPXGL (.xpxgl) file format which, basically, is "compiled" VRML.

It has most of the benefits that VRML has (particularly very efficient storing of vertices), but can be parsed hundreds or thousands of times faster.

My belief was, and still is, that modelers should not have to deal with limiting primitive tools, and should be able to "create" using their favorite 3D modeling package, and then let automated tools handle turning this model into an X-Plane usable object.

As you can see from the other pages mentioned above, we have made tremendous progress towards making this happen.

toc


X-Plane Considerations

Since X-Plane is a real-time flight-simulator, Austin has devised many innovative techniques for speed, one of the most significant being the mechanism to use parts of a single texture (bitmap) for an object rather than separate individual texture files.

I had some reservations about this (how to do it mainly!), and it does impose some limitations on the modeler which are discussed below.

At some point in the future, as video cards become more and more powerful, this technique may no longer be needed, so we recommend that, when possible, you always keep a copy of your model(s) before you apply textures.

Every professional/shareware 3D modeling package we have investigated to date that has support for textures does so by using individual, separate texture files.

XGLTool now has 2 mechanisms to combine these individual texture files (Windows 24-bit bitmap files) into the one (actually you need 2 - one named [model].bmp, the other named [model]LIT.bmp for night lighting) required for X-Plane:

  1. Automatic merging of the textures into a single, horizontally arranged, power of 2 bitmap - XGLTool only creates the [model].bmp file, you must manually create [model]LIT.bmp

  2. Artist merging of the textures into a single, power of 2 bitmap, and creation (using most HTML editors) of what is known as an image map that defines which region(s) of the "single" texture correspond to which original individual texture names/files. XGLTool then uses your VRML file and associated HTML file to create an XPXGL file that will work with the single texture (and X-Plane).

Power of 2 refers to the width and height of an image in pixels. Powers of 2 are 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, etc.

X-Plane requires that all texture files (.bmp files) always be a power of 2 in both dimensions, but they do not have to be the same power of 2. The following are all valid X-Plane bitmap dimensions (Width X Height):

  • 32x32
  • 64x32
  • 128x32
  • 256x256
  • 256x512
  • 1024x128
  • etc.

Note that these examples are for an X-Plane ready single texture, although we suggest using separate texture files that are also powers of 2, tho this is not a requirement.

X-Plane Special Types

One of the other challenges we had to resolve for objects in X-Plane are some special object primitives that X-Plane uses:

  • Hard surfaces - this refers to a surface that X-Plane knows is hard (like a flightdeck, heliport, etc.) and will allow aircraft to land on it. These surfaces must always be made up of quads (4-sided polygons).

    Additionally, any surface (1 or more quads) that you wish to be hard must have a texture of the form hard_flightdeck.bmp or hard_my_heliport.bmp applied.

    The texture filename must begin with hard_ so that this information can be passed on to X-Plane.

  • Smoke - this refers to surfaces the emit either white or black smoke (smoke stacks, etc.). Each instance of this kind of surface must always be a quad.

    Any surface (1 or more quads) that you wish to emit smoke must have a texture of the form smoke1_xxx.bmp (puffs white smoke) or smoke2_xxx.bmp (puffs black smoke)

  • Lights - these refer to point lights (blinking or not, strobes, etc.) as well as traffic lights. Each instance of a light must be an individual triangle, and have a special texture name applied to it. The center point of the triangle may eventually be used as the location for the light, but at the moment, the first vertex is used. Since lights are often used at the top of antennas, etc. and they are very small, this should not be a problem. For visual fidelity, you should probably use a material specification as well, and you must have a place-holder texture file and the texture must also appear in your master texture.

    light_NN_NN_NN_xxx.bmp - NN must be a 2 digit number 00..10 (special cases below) for the red, green and blue values of the light (on a scale of 00 to 10), and indicates a non-flashing (constant) light.

    light_blink_NN_NN_NN_xxx.bmp - NN must be a 2 digit number 00..10 for the red, green and blue values of the light (on a scale of 00 to 10), and indicates a flashing light

For light_NN_NN_NN_xxx.bmp, there are currently 3 special cases:

  1. light_99_99_99_xx.bmp - indicates a pulsing red light
  2. light_98_98_98_xx.bmp - indicates a strobe light
  3. light_97_97_97_xx.bmp - indicates a traffic light, complete with changing colors

toc


Modeling Tools

We are currently experimenting with commercial and other 3D modeling packages.

Our current favorite is Lightwave3D, because it runs on Mac OS X, and of all of the packages we have experimented with so far, it has the most complete and usable VRML export.

We are investigating 3D translation software, and LightWave can also import 3D Studio (.3ds) format files (not .max), tho we have not yet experimented with this.

toc


Modeling Guidelines

Below is a list of things to keep in mind when designing models. Some are suggestions, some are requirements. As mentioned earlier, be sure to save non-textured versions of your models!

#1 - Do Not Use Textures That Repeat

Due to the use of a single texture for an entire object (again, regions of it are actually used), you may not use textures that repeat. This means for example that you can't use a brick texture made up of say 9 bricks and then have that texture repeated many times over a polygon to create a wall.

Instead, use a higher-resolution texture with many more bricks (enough to look good), then apply this texture to each face / surface that needs bricks.

This is due to the way that texture repetition is implemented in OpenGL. When using a single texture with multiple regions (subtextures) as we are doing, the "wrapping" mechanism that normally works for separate textures/files causes portions of the single texture outside the subtexture to be drawn, which, to put it simply, draws the wrong thing.

toc

#2 - Limit your "master" texture to a maximum of 1024x1024 pixels

This is approximately 3 megabytes (1024x1024x3), which is a lot of texture memory, so whenever possible, try to use as little texture memory as you can get away with to balance quality with memory usage.

toc

#3 - Think About Textures

Study the Texture Use Limitations section from the Lexington Example Tutorial to see some examples of automatic and manual (via HTML image maps) merging.

The latest Liberty master texture, part of it shown below, uses the entire texture as the island, with the subtextures placed around it for a very efficient use of texture memory:

toc

#4 - Keep Your Polygon Counts Low(ish)!

Although our largest XGL-based (non-textured) test object has over 30,000 polygons, Liberty7 (with the island) has only 3,500.

Anthony's current Brooklyn Bridge has about 4,000, primarily because he is using 3-sided polygons for the cables of the bridge for the most realism (lines or points are not currently supported in XGLTool and lines do not really render well in X-Plane especially as your distance from the object changes).

toc

#5 - Use only Triangles, Quads, and Polygons in your models

These are the basics of 3D modeling which all map to the powerful IndexedFaceSet VRML entity, and allow the most realism. There are some conventions / requirements we have established for the X-Plane Special Types as mentioned above.

toc

#6 - Use lowercase filenames and extensions

Do not put <space>, "/", or other "funky" characters in your model or texturenames. For example, for liberty4 ... the model name is liberty4.lwo, the vrml file is liberty4.wrl, and the texture names are of the form body-front.bmp, fort-roof.bmp, etc. The day master texture is liberty4.bmp and the night master texture is liberty4LIT.bmp. You may use underscore (_) which is my personal preference, so body-front.bmp would become body_front.bmp.

toc

#7 - Put your model and all textures or other assets into a single directory with the same name as your model

Most important is that your VRML file (mymodel.wrl), optional HTML image map (mymodel.html), master textures (mymodel.bmp, mymodelLIT.bmp), and individual textures (tex1.bmp, tex2.bmp, etc.) all be in the same directory. XGL files (.xgl or .xpxgl) will be created in the same directory and be named mymodel.xgl or mymodel.xpxgl.

toc

#8 - Your master texture must be named [model].bmp

Whether you use XGLTool to auto-merge it or you create it manually and use an HTML image map, your master (day) texture must be of the form [mymodel].bmp

For the night texture it is of the form [mymodel]LIT.bmp and must be the same size and dimensions as your day texture.

X-Plane merges these textures together between dusk and dawn.

toc

#9 - Use 24-bit Windows Bitmap files (.bmp) for your individual textures

This is not an absolute requirement, but since XGLTool and X-Plane only fully support 24-bit .bmp files, you may want to do this.

You *can* optionally use 24-bit PNG (.png) for your individual textures so that you can view your VRML (.wrl files) in a VRML viewer such as Cortona, but since XGLTool can display both VRML and XGL files with an easier to use (IMHO) keyboard navigation interface, you might as well use 24-bit .bmp files.

Also, automatic texture merging only works with 24-bit .bmp files

toc

#10 - Automatic Texture Merging Considerations

If you are going to use automatic texture merging, and you won't really know how well it will work until you try it, you need to understand some things about how it works.

First, it loads all of your individual textures to determine their dimensions. It keeps track of the tallest texture, and calculates the combined width of all of your textures.

Since X-Plane requires a power of 2 bitmap, it then creates a single bitmap that is a power of 2 in each dimension (usually much wider than it is tall).

It then copies each individual texture into this master bitmap, left to right based on the order of the texture file in the model (.wrl file). It then adjusts the individual texture parameters to refer to these subtextures within the merged texture.

This can do a great job, or be very wasteful, depending on your individual texture dimensions.

If you wish to use this mechanism, here are some suggestions to get a fairly good result:

  1. Decide on a maximum height for your textures that is a power of 2 ... this could be as small as 32, or as large as 1024, but keep in mind that whatever height you choose, any textures that are less than this height will have wasted space above them... One version of Liberty that worked well had all textures 128 pixels tall, with varying widths to fit nicely into a 1024x128 bitmap

  2. Tho not a requirement, it's probably a good idea to make your individual textures a power of 2 width (2, 4, 8, 16, 32, 64, 128, 256, etc.) - I would also suggest you don't use anything less than 8 or 16 for the width.

  3. For height, you can use anything less than or equal to the "maximum height" texture of the group, but keep in mind anything less than that height will be wasted texture memory. Again, I would suggest the height also be a power of 2.

There will be cases where automatic merging won't work. The Lexington Example is one case ... the hull needed to be wide and not tall to apply correctly. The flightdeck needed to be tall and narrow. Using automatic merging for these results in a lot of wasted space, which is why the manual method (with an HTML image map) was chosen.

toc

#11 - Use a single model file per object

This means do not use separate parts/objects (in lightwave separate .lwo files) and try to merge them into a single scene or object. This does not work correctly at this time and is not supported nor recommended.

toc

#12 - Dimensional Considerations

Here are some important things to keep in mind as you build your model(s):

  • If you are building objects meant to be on the ground, always build up from Y=0

  • Place the Y=0 center of your object at X=0, Z=0

  • Think in meters (X-Plane's basic dimensional unit), and draw your objects in meters (1 unit in your modeling app = 1 meter in X-Plane). To convert feet to meters, multiply by 0.3048. To convert meters to feet, divide by 0.3048.

You may find it very useful at the early stages of your model development to use XGLTool and XGLTester to test your dimensions and be sure your object "fits well" inside X-Plane.

Although most 3D modeling packages do allow you to resize things as you work, we have found that doing this after applying textures has problems (at least in LightWave), so we would recommend using XGLTester/XGLTool to get your dimensions right before you get too far along.

toc

#13 - Using Materials

Most 3D modeling packages allow you to define things like color, luminosity, diffusion, and emission (or more). Exactly how these map to VRML / OpenGL materials is dependent on the VRML exporter.

VRML, which is our "intermediate" format, supports:

  • diffuseColor - this is the color that reflects diffuse light (like the sun in X-Plane)

  • specularColor - this is the color that reflects specular light (I am not currently sure if there is a specular light source in X-Plane)

  • emissiveColor - this is the color that is emitted from (generated by) an object (or portions of it). Currently examples are things like the USS Enterprise engines that emit blue, and intakes that emit red. We have also used this to "light up" a billboard on a blimp at all times, day or nite.

  • shininess - this defines how "shiny" a surface is - we are not sure how useful this may be in X-Plane yet, but things like glass may be a good example

All of these, except shininess, end up in VRML and XGL/XPXGL as RGB values where each RGB value ranges between 0.0 (0) and 1.0 (255).

We suggest that you initially use materials while working on the geometry of your model so that you can see it in your modeling package before applying textures.

Anthony, for example, used diffuse green for trees on Liberty Island. Some parts of the Lexington Example use materials and may continue to do so as the model is refined.

Materials can also be very realistic - most spacecraft models I have found use materials significantly, then use textures like "decals" to add additional realism.

Materials also take less memory than textures and from my testing, also render faster than textures.

Important Note: We do not currently have a mechanism to "disable" materials, and even when we do, it will have to be for an entire object. What this means is that if you have a surface that had materials (like the bright green trees on Liberty Island) and then you don't want the material to "show through", you must set the material to a neutral color (like light gray 0.2 0.2 0.2).

toc






Copyright © 1997-2004 David Spotts,
DSpotts.com and Clik2.com, All Rights Reserved

Site Footer Last Modified February 18, 2004
Comments?, Errors?, Omissions?

Site designed for 800x600+ Resolution
DSL/Cable Connection Recommended
Safari Recommended
Portions may require Internet Explorer, JAVA

Images, Servicemarks or Trademarks used on this site
are the property of their respective
owners and do not imply endorsement.

official paypal seal