Search and Rescue Manual
Index-> Create Your Own-> LWO Import HOWTO

LWO Import HOWTO

This document describes how to import LightWave 3D LWO files into Vertex 3D V3D model files for use with Search and Rescue.

[ Top | Create Your Own ]

Preplanning

LWO to V3D

The goal here is to import a LightWave 3D LWO file (.lwo file) to a Vertex 3D V3D file (.3d file) which Search and Rescue uses for its aircraft, scenery, objects, etc.

First, the LWO file needs to be "preped" before it can be imported to a V3D file. You should save as your LWO file to a different file name and then modify it (prep it) for the eventual importing to a V3D file.

Below are a list of issues that need to be considered before importing.

Level of Detail

Since LightWave is designed to maximize detail by creating 3d objects "as realistic as possible", the LWO model may be too complex (have too many primitives or too many graphics statements) than desireable.

Objects in Search and Rescue need to have a balance between simplicity and detail. For example, in a game situation you do not want 60 primitives describing a cylender when you can just use 4 primitives to achieve a similar level of detail.

Therefore it is important to simplify the LWO model before importing it to a V3D model. Remember that you can use normals to specify the exact description of shading per primitive after import (but this can be tedious).

Normals (or lack thereof)

Unfortunately the LWO format does not support normals. To be precise, the LWO format does not support normals in OpenGL's concept (and the V3D file format is really a slightly more advanced text file form of an OpenGL display list).

A normal is not a vector perpendicular to two "surface" vectors as typically thought of in the mathimatical defination of a normal. Here, a normal directs the angle of shading in accordance with OpenGL's implementation of normals.

A solution to that problem would be to use Vertex 3D's VPI Render Normals plug-in, however the resulting normals would be calculated and not intuitively placed to achieve the intended shading. It would result in precise but not accurate shading, meaning your imported LWO model may not look the way you intended it to.

(This issue is mentioned again in PostProcessing )

Graphics Statements

Graphics statements can be redundant and cause the display of the final V3D model to be slow and inefficient. Typically, excessive graphics statements in LWO primarly consist of color statements. For example you may have colored your LWO model in may shades, but the imported V3D file will have color statements between primitives in its serial order that make it inefficient. For example, the final imported V3D file may have statements of the following:

  • Color (red)
  • Quad
  • Color (blue)
  • Quad
  • Color (red)
  • Quad
  • Color (blue)
  • Quad

It would be much more efficient if the order was:

  • Color (red)
  • Quad
  • Quad
  • Color (blue)
  • Quad
  • Quad

Unfortunately, there is little control over how the LWO file is saved and how color statements are arranged. The best approach to this issue is to not have too many different colors.

Texturing

If your LWO model is primarly textured, then you should recolor your LWO model pure white and then select side, top/bottom, and front/back portions of the model and save them to separate LWO files (later you will import them all into V3D and recombine them).

Winding

The winding of all primitives with solid surface faces should be clockwise. This is not, however, a serious issue since the winding can be easilly flipped (using Vertex 3D) after the LWO file is imported to a V3D file.

Concave Primitives

The OpenGL specification does not allow primitives with solid surface edges that are concave curved. Such curved edges will be drawn as a straight line. Since the V3D file follows the OpenGL specification, you will need to make sure there are no primitives with solid surface edges that have concave curves.

If you do have primitives with solid surface edges that are concave curved in your LWO file then you should divide them into smaller primitives so that there are only convex curved edges and no concave curved edges.

From LightWave 3D to Search and Rescue

An LWO model in LightWave 3D
An LWO model in LightWave 3D

The LWO file now imported to a Vertex 3D V3D file
The LWO file now imported to a Vertex 3D V3D file

The V3D file after postprocessing
The V3D file after postprocessing

Finally into the Search and Rescue world
Finally into the Search and Rescue world

[
Top | Create Your Own ]

Importing

If you have not yet saved your LWO file to a different file name then save as your LWO file to a different file name now. Since you may need to make changes to it before it is suitable for importing to a V3D file.

Select unwanted primitives (primitives that would not contribute to meaningful detail) and delete them from the LWO file. Reduce the level of detail as needed, details such as the number of primitives representing a cylender's curve.

Remember that in V3D you can use OpenGL's implementation of normals to shade even a 4 primitive block into a cylender or sphere (thus conserving a lot of cpu and memory use)!

Recolor the LWO model using fewer colors, this will help reduce the number of color graphics statements and improve efficiency.

If your LWO model is textured then you may need to select side, top/bottom, and front/back portions of the model and save them to separate LWO files (later you will import them all into V3D and recombine them).

At this point you can now run Vertex 3D and import the LWO file(s). Make sure the LWO plug-in is enabled and go to File->Import (the LWO plug-in is available in the standard Vertex Plug-In Devel Package) to import the LWO file.

Once the LWO file(s) are imported, save as the now V3D model to a V3D file. Next you will need to PostProcess the new V3D model.

[ Top | Create Your Own ]

PostProcessing

Since the final V3D model came from a LWO model, there are certain modifications you will need to make after you import. Below are a list of steps you may need to take.

Flip Winding, Mirror, Rotate, Translate

The V3D model's primitives with surfaces should be in clockwise winding, thus you may need to select all the primitives and Flip Winding (and leave the primitives selected for the next few steps).

Past experience shows that the imported primitives need to be mirrored along the Y axis.

You may also need to rotate the imported primitives about the X axis too.

At this point the primitives are usually centered properly, however if they are not then translate them to the center as needed.

Save your V3D file.

Setting Normals

As mentioned several times before, LWO does not support normals, so you will now need to set normals on each primitive, there is the easy way and the hard way:

The hard way is to go through each primitive and set a normal to each vertex (very time consuming)

The easy way is to use the Render Normals plug-in to have the computer set normals to each vertex of each primitive. Go to Render->Render Normals

Save your V3D file.

Adjusting Color

You may need to adjust the color of the imported model, this can be tedious as you will have to select and modify every color primitive.

Since LWO does not specify OpenGL material values you should also set the color primitive's material values while you adjust the color.

Save your V3D file.

Texturing

If the LWO model was textured and you imported several LWO files into your new V3D file, now is the time to put all the primitives from each V3D visual model under one V3D visual model in your V3D file.

Insert a comment primitive between each set of primitives that came from the separate LWO files. This will help you distinguish which "side" to orient the texture with.

Create a new V3D visual model in your V3D file and cut & paste all the primitives from all the other V3D visual models into the new V3D visual model. Then delete the other V3D visual models in your V3D file.

Now add the textures as you normally would, remember to convert them to tex (Targa image file format) from whatever format it was when used for the LWO model.

Use the comment primitives you inserted between each set of primitives to easilly identify where the new texture select and texture orient primitives go.

Save your V3D file.

Header & SAR Parameters

Now create one "other data" model and make sure it is the first model in the V3D file. Enter in the usual SAR parameters to describe the object's behavor in Search and Rescue.

Make sure that the V3D visual model is named standard, or one of the supported V3D visual model names recognized by Search and Rescue.

You can repeat the above process to import the standard_far, standard_night, etc, models.

Save your V3D file.

[ Top | Create Your Own ]

Search and Rescue

http://wolfpack.twu.net/SearchAndRescue