Getting non-Lightwave created models into the game

More
19 years 10 months ago #18052 by Second Chance
This tutorial will explain how to get models from whatever 3D package you happen to use into Lightwave, and then get them into the game. This is not a modeling or Lightwave tutorial, nor is it "everything you could possibly need to know.� You must still be familiar with the EoC Graphic SDK.

Now, I'm sorry if this disappoints anyone but, Lightwave is required to get models into the game (see addendum 2). Although, it is not required to make the initial models.

Many of you might say; "Well if you've already got Lightwave, why wouldn't you just make the models in it?" Well, that's up to you. For me, I've been working with 3dsMax for many years (since version 1.0), and have even been through training classes for it. I'm just more comfortable modeling in Max. Or maybe you don't have Lightwave, but you have a friend that does. And he's willing to convert your model and make the texture templates for you. It could be any reason. So, here's your chance to make that EoC Super Cruiser you've always wanted.

<font size="3">Requirements:</font id="size3">

A 3d package that can export .3ds files.

Lightwave 3D, or a friend who has it and is willing to work on the models with you. I believe any version will work (except 6.0) by exporting the files as "Lightwave 5" files. Version 6.0 didn't have this feature, but 6.5 did.

A paint program for texturing.

STEP 1: Building the model
Start by creating a model in your 3D program. But be warned, EoC may react unpredictably with models that contain more than 800 polys per individual mesh section. An idividual mesh section is a single editable mesh in your model (whether the polygons are contiguous or not). Be aware of this and watch your poly count. However, also be aware that the number of polys shown in your program may not be the number of polys that end up in Lightwave after the import process. For instance; I do all of my modeling work in 3dsMax 3.1. Then I export to .3ds and import the models into Lightwave 6.5. When I view the models in Lightwave, I find that they are now made up of approximately 1/3 the number of polys that Max was showing (with no loss of detail). I don't know what causes this (perhaps a highly efficient conversion filter). Whatever it is, the poly count is different. So you will need to experiment with your program and find out how many polys you can safely work with to keep it around 800 for LW.

I mentioned 800 polys per mesh section. Here's what I mean about a section. The Lightwave system works differently from most other 3D programs. In most 3D apps, what gets displayed on the screen is usually an entire scene, with multiple separate objects all layed out within that scene. It's also where all the models actually get made and animated. It is a very natural way to work, as that's how we deal with real-life objects in the real-life world. Lightwave, however, is made up of two different apps: One is Modeler, which is used to create all the individual meshes of a larger model or scene. The Modeler only ever contains the single editable mesh you're currently working on. The other is Layout, which is more like the scene display we're used to, with all the separate objects, meshes and lights collected in one place. No changes can be made to any meshes in Layout. It is, as the name implies, only for laying out separate objects into a complete model or scene. It may seem strange at first, but the advantages are that working with individual polygons and applying surface textures in Modeler become a piece of cake (things which are typically quite a pain in the ass for normal 3D apps). So a section is a single mesh object that may, or may not, be a part of a larger model. For example, my entire Tie Bomber model is made up of only one mesh, that weighs in at 761 polys. Conversely, my X-Wing fighter model consists of three sections, or mesh objects; the fuselage (about 240 polys) and two wing sections (about 560 polys each). Each mesh gets loaded into Modeler and worked on separately. And each section was well under the 800 poly limit, but when they're brought together in Layout they become more than 1300 polys. Which is still fine, because most video cards today can easily display objects consisting of thousands of polys. It's just the flux engine that powers EoC that doesn't like individual meshes of more than 800 polys. (Although I have had success with up to almost 2000 polys per mesh.) Remember, the total polycount for your model will be dictated by the hardware that displays it (when EoC came out, a 16 meg card was hot!). But you'll have to carve it up into bite-sized pieces for the flux engine to handle.

So, when you build your model make sure to break it up into separate pieces if it starts to get a little high in the poly count. This will allow you to build more complex models without running into display problems in EoC. Personally, I like to build using many, many smaller meshes and then attach the ones in close proximity to each other until I get a single larger mesh of around 800 polys. I keep doing this until I have only a few meshes of around 800 polys each that make up the whole model. (Max users: Remember to collapse the modifier stack or right-click and select Collapse Selected To Mesh before attaching meshes or exporting.) And remember, you can "attach" one mesh to another even though none of their polygons actually share an edge (meaning that they're not connected). It's tough to explain, but easy to understand once you see it in action. In Max, you can select two editable mesh objects that are unconnected and in different locations and "attach" them. This means they become one mesh, just with some of the polygons over here and some of the polygons over there. A group of polygons doesn't have to be physically connected to the others to be part of a mesh.

And now a quick word about weapons: All weapons large enough to be visible in-game (turrets, pylon mounts, etc.) are separate models that are built using the same procedures shown here, and attached to the ship models using Lightwave nulls. The nulls are responsible for all subsim location and orientation. So if you're working with someone else to set up the Lightwave scenes, you'll need to discuss where the weapons and effects should go (or better yet, send them a render showing the various guns in their proper positions). Also, many smaller EoC objects (such as turrets and cargo pods) are only modeled with one level of detail; the highest. Their setup scenes do not include LOD switching nulls. Any scene without LOD switching nulls will default to high LOD status, meaning that when the player camera reaches medium LOD distance, the model will no longer render. This is why these objects disappear when you get a certain distance away from them. If you want your objects to always be visible, make sure to model all three levels of detail.

STEP 2: Smoothing and UV mapping
In most 3D apps, you typically think about polygon smoothing and texture mapping as a function of the mesh. Again, Lightwave handles things differently. And the results may pleasantly surprise you. In Lightwave, all material mapping and polygon smoothing are handled together in a single procedure, called "Surfacing.� This "Surfacing" is the main reason why materials and mapping from other 3D apps won't translate into, or out of, Lightwave. So don't be surprised when you try to import that prized 3D ship model with the beautiful textures into Lightwave and it comes out as a blank gray mesh. Texture mapping cannot be converted into a Lightwave 5 readable format, period. I have done extensive research on this and spoken to the companies that produce some of the most reliable (and expensive) 3D converters on the market. There are a few that come close, but even they are left guessing when trying to make a match. Bottom line; all texturing must be done in Lightwave.

That said, don't even bother thinking about poly smoothing or texture mapping coordinates while making you mesh, since it'll all get dropped when it's imported into Lightwave anyway. On the positive side, it greatly reduces the amount of work needed to make the model.

STEP 3: Pivot alignment
Ok, once you've got your Super Galactic Battle Cruiser mesh finished, with all of its separate sections, it's now time to set the pivot points for each mesh making up the model. Hopefully your 3D package allows you to change the location of pivot points for objects. If not, this step can still be accomplished in Lightwave (it's just easier to do it here).

But before you do this make sure you move the entire model so that the world origin (0,0,0) is located where you want your model to rotate around all axes. For instance, if you want your model to pitch, yaw and roll around the cockpit, move the entire model so that the cockpit is located at the world origin (0,0,0). Once that's done, it's time to select each sub-mesh's pivot point and relocate it to the world origin (0,0,0). This must be done to maintain object alignment when brought into lightwave. If you don't do this now, your model will end up looking like a jumbled mess that collapsed in on itself, as all the individual meshes that make up the model will be located in the same spot. It'll still show up in the game, but it won't be pretty.

The reason for the pivot movement is twofold; first, it will help to maintain part alignment when scaling for the finished size, and second, because Lightwave uses a different system of parts layout.

STEP 4: Scaling
Now is a good time to scale your model to the proper size. Keep in mind that typical EoC ships are Freakin' Huge, with engines the size of office buildings, and move at miles per second (or kilometers per second, if you prefer), so a relatively small model may be very hard to see. (We worried constantly about the size of the fighters in the Star Wars MP mod.) So select all of your meshes and scale to the appropriate size (using whatever method works best for you). If, after scaling, the model no longer sits at the world origin, that's ok. Once the pivot point of each mesh has been properly set to the model's rotation point, the model's location in scene space is no longer relevant. Each mesh's pivot point will become its world center after export. Of course, you're more than welcome to move it back to the origin for the sake of convenience.

STEP 5: Animation
Easy. Outside of Lightwave, there is none. All animation is done through the game engine, and must be set up in Lightwave. So don't try adding animation to your 3ds file, you'll just screw it up.

STEP 6: Aligning the model for export to 3ds
Hopefully, by now you've got a complete model that's the right size and is ready to go to Lightwave for "Surfacing" (texture mapping and poly smoothing). If you don't want your ship to end up flying upside down and backwards, pay attention. Many of the modeling programs I've worked with use the world Y axis to represent horizontal forward/backward movement and the Z axis to represent vertical up/down movement. Lightwave (and by extension EoC) uses the Z axis to represent horizontal forward/backward movement and the Y axis to represent vertical up/down movement. So before you export, make sure that the front of your model is pointing toward the +Z world axis and that the top is pointing toward the +Y world axis. Doing this before export makes importing to Lightwave a little less of a hassle, and should make your Lightwave using helper friend a little less likely to hit the delete button. Once again, if the model no longer sits at the world origin after rotation to alignment, it's ok.

(Note to Lightwave users: Make sure to uncheck the scale and rotate options in the 3ds import dialog.)

In Max, after aligning the model it's extremely important to remember to reset each mesh's transform so its local coordinate system matches the world coordinate system. You'll have to figure out how to do this in your particular package (if necessary), but for Max users: Select all of your meshes, and from the command panel select Utilities, then Reset XForm. Now, with all of your objects selected, press the Reset Selected button. This will apply a transform modifier to all objects. After you've done this, and with all objects still selected, right-click and select Collapse Selected To Mesh. The local coordinate system of each part should now match the world coordinate system.

STEP 7: Exporting
Before exporting, make sure that your objects don't have any kind of modifiers (applied by your program during modeling) left over. These modifiers (like taper, twist, stretch, etc.) may not export properly, and they definitely won't import to Lightwave properly, so it's best to export only basic meshes. For Max, simply collapsing the modifier stack will do this.

Now that the model is ready for export, here comes the most important part. If your model is made up of multiple mesh objects (what I referred to as sections), you must export each one separately. For each individual mesh on your model, export a separate .3ds file. Again, this is because of the way Lightwave handles individual meshes. Each of these separate pieces will then be brought back together in Layout to form the complete model.

(Note to Lightwave users: When you import a mesh into Lightwave be sure to merge the points (vertices) to prevent unwanted discontinuous surfaces. Pressing the "m" button should do it.)

STEP 8: Texturing
It's important to note that the old-style Lightwave models for EoC do not use uvw coordinate mapping. Nor do they initially use a single texture sheet with all the textures in one image. Each "surface" of each mesh of your model will have its own texture map. That can add up to a lot of texture painting (and a lot of textures). Just be aware of that. Eventually, all the separate texture maps will be combined into a single "texture sheet" when the model is run through the game converter, but for now, keep each texture separate.

Once you've successfully brought your model into Lightwave it's time to surface it and set the textures and polygon smoothing. You'll have to learn how to surface on your own, but once the surfacing is done, you can make the templates used for painting the textures. (Lightwave users: see post further down thread for important info about luminosity and specularity maps.) When surfacing, always try to make the surfaces perpendicular to one of the world axes (to avoid stretching parts of the texture). Remember to merge the points before trying to surface an object. See addendum 1 below for info on glowing textures.

(*Note - this is my current method of texturing, not the only method*)
When you've fully surfaced your mesh, change to sketch or wireframe shade mode and select the polys that make up one of the surfaces and hide the rest. This can be done quickly by pressing the "w" key in polygon mode to bring up the polygon statistics window, selecting the surface from the drop-down list next to "Surf:" and clicking the plus sign (+). The number on the right is the number of polys in that surface. Then in the disply tab click "Sel Invert", then "Hide Sel". Now choose a world view that best shows the surface (top, right, etc.). Pressing the "a" key will zoom the polys to fill up the screen. Press "w" again to hide the poly stats window. Now take a screenshot. For windows I press Alt/Print Screen to copy the window contents to the clipboard, then when I select New Document in Photoshop, it automatically creates a document the right size (1024 x 786 pixels in my case). Bring your screenshot into your paint program as a bottom layer, crop it to the outermost edges of the polygons, and behold, you now have a perfect painting template to create your texture with. Do this for each surfaced area. Save your finished textures with all their layers in your paint program's native format (so you can come back and play with them later) and then flatten the images save them in .IFF format. This image format is native to Lightwave and can even be read directly by EoC. Remember to intelligently resize your textures before saving to .IFF. This is a game after all, and a 1024 x 768 texture on a tiny cockpit window will quickly bring even the best nVidia card to it's knees.

After you've painted a texture that you're happy with, go into the Lightwave surface editor and use your new texture in the color map section of your surface. Do this by clicking the "T" button next to the word color. In the texture editor select "planar" from the projection drop down, then select "load image" from the image drop down. Load your texture. Now select the texture axis that matches the world axis you used when you took the screenshot for the painting template. Hit "automatic sizing" and you should be done. If the texture is misaligned, fix it in your paint program and not with the texture editing tools. For instance; if your texture showed up backwards, go back and flip it in your paint program. If you flip it in the texture editor it will look right in Lightwave, but will still be backwards in the game. The Eoc model converter will not accept changes made by the Lightwave texture editing tools.

*edit*
Recently, cambrogol has demonstrated that the texture editing tools in Lightwave 5.6 do in fact work. Including the repeating texture feature. Now that I have 5.6 I will test and confirm this shortly.

STEP 9: Levels of detail, or, LODs
Once your objects are textured it's time to make the different LOD models. If you, or whoever may be helping you, don't already use them, I suggest a combination of qemLOSS2 and the Co-planar Polygon Reduction tool. The qemLOSS2 plugin you'll probably have to download (although it may come with later versions of Lightwave), but the poly reduction tool is always included with the program. Using these plugins together will chop down the polys wonderfully while still retaining a well detailed mesh. I have shown that the SDK model converter will produce non-triangular polys, so optimization of co-planar polys will give you more polys to play with in making your model.

(Note - again, this is my method of making LODs, not the only method*)
For the highest LOD object I usually just use the Co-planar Polygon Reduction tool. I set the angle to anywhere between 1 and 20 degrees, depending on what looks best (remember, you can undo this operation, so try a variety of angles). If you've done a decent job of modeling you shouldn't need to lower the detail at all. This is just to combine co-planar polys in the part.

Now to make the second or "medium" LOD mesh, simply apply qemLOSS2. This should cause a new lower poly mesh to be created in a new layer (check the layer tabs at the top right corner), with your high LOD mesh still safely sitting in the first layer. This plugin is very powerful, and can reduce your object to nothing very quickly. Also, it doesn't seem to undo very well, so be careful. If it goes badly, delete the entire bad mesh and re-apply qemLOSS2 to the high LOD mesh. I usually set the poly reduction to 75% of original and check the "preserve mesh quality" button. Then use the Co-planar Polygon Reduction tool (set to between 1 and 30 degrees) to eliminate the unnecessary, left over polys. Sometimes, when using the co-planar poly tool, you'll find that it eliminates necessary polys. And you end up with a hole in the model. Play with the angle settings and, if you find that a higher setting looks great but makes holes, you might be better off keeping the holes and rebuilding the polys manually.

For the lowest LOD model you must start with the high LOD mesh. Don't use the medium LOD version. The poly reducing effects of qemLOSS2 are cumulative, so if you reduce a model to 75% of its original polys to make a medium LOD, then reapply it with the same setting, you will then reduce the already reduced model to 75% of its polys (which is probably more than you wanted to get rid of). This can quickly get out of control, so it's better to start with the high poly version and make each LOD from that. Usually I set qemLOSS2 to 50 % for the lowest LOD, then apply the co-planar tool with the same previous setting. Once you've done this to all the meshes in the model, save your current file as is with all the layers for later editing (this will be your master object file and not used in the game), and then export or save each LOD mesh as a separate LW 5 object (.lwo).

All the LOD versions will remain perfectly textured as long as you surfaced them before making the LODs.

You should now have three versions of each object that comprise your model; a high LOD, a medium LOD and a low LOD. This leads to lots of files, fast. Remember to name your LOD mesh files intelligently, like hull_hi, hull_med and hull_lo. This helps you know what's what.

And now, a word on concave polygons. Using the co-planar polygon reduction tool can cause polygons to be created that have cutouts or holes in them where they intersect other parts. EoC doesn't like these kind of polys, and will give you no end of grief over displaying them. The problems range to everything from simply displaying the bad polys in all black, all the way to causing the entire mesh not to display at all. I have written a tutorial on identifying and correcting these polys, which is located further down in this thread. Please read it. It will save you a lot of grief.

STEP 10: Converting the model to EoC format
Once you've finished modeling and texturing, and you've got a finished Lightwave 5 scene with all the meshes making up your different LOD models in it, you're ready to run the models and textures through the game converter. The Graphic SDK has all the instructions you need for that.

So go to it! :)

I hope this process helps you get your dream machine into EoC. And if you have any trouble, just post in the modeling forum and we'll get you straightened out. Only post here if there's something wrong with the tutorial or I left something out. Or if you just want to comment. I'll try to update it when necessary. Enjoy.


**Addendum 1 - Animated Glow Channels:** Originally documented by GrandpaTrout.
If you want to add animated glowing textures to your model the process is similar to making normal 3D glowing textures. Use the same texture painting template you used to make the color map and paint a color map to be used in the surface's Luminosity map slot. Then add the command <glow channel=xxxxxx> to the end of your surface name. The value represented by xxxxxx will be one of the potential values that can be assigned to an animated glow surface to achieve different effects. For instance; <glow channel=pulse1> will give a different effect than <glow channel=pulse2>, which will give a different effect than <glow channel=LZ?+s(0.5)>, and so on. All the channel names for thruster animation and weapon fire will also work for animated glows. However, the full extent of the animation commands are not currently known, so some experimentation is in order. Look in the Graphic SDK for the currently documented commands. Undocumented commands can be found by hex-editing some of the original .pso model files. If you discover any new commands, please write to me so I can update this document.

Recently, a chat with one of the Buda5 modelers revealed that glow and specularity map channels on models not saved specifically with Lightwave v5.6 or below generally don't work. It is unknown why this happens. Sad, but true. [xx(]

**Addendum 2 - Converting PSOs back to Lightwave Objects:**
A wonderful new community member named Jasper has put his considerable talents to work and designed a converter that takes EoC models and textures and converts them back into their original Lightwave and IFF formats, respectively. He has also created a program that can encode IFF files into EoC .ftc and .ftu texture files. His new knowledge of the .pso and .lwo object formats also opens the possibility of a direct .3ds to .pso converter. Which would mean that Lightwave would no longer be required for getting models into EoC. I would suggest asking him nicely if would consider making such a converter.

Follow his progress here.
PSO2LWO Converter Thread:
www.i-war2.com/forum/topic.asp?TOPIC_ID=2164

FTEX Generator Thread:
www.i-war2.com/forum/topic.asp?TOPIC_ID=2148

Jasper's EoC Tool Page:
pointless.net/eoc/

mailto:second_chance@cox.net
The Ultimate Guide To Modding: I-War 2 - Edge Of Chaos (on hold during SW MP mod)
cartoons.sev.com.au/index.php?catid=4
.

Please Log in or Create an account to join the conversation.

More
19 years 10 months ago #9797 by Xanix
Great work. Very helpful!

Thank's

Xanix

Please Log in or Create an account to join the conversation.

More
19 years 10 months ago #9966 by Second Chance
Added info on exporting, pivot alignment, mesh construction, scaling and model rotation.

mailto:second_chance@cox.net
The Ultimate Guide To Modding: I-War 2 - Edge Of Chaos (on hold during SW MP mod)
cartoons.sev.com.au/index.php?catid=4
.

Please Log in or Create an account to join the conversation.

More
19 years 8 months ago #11086 by Second Chance
New tutorial on managing odd shaped polygons in EoC coming soon!!!

mailto:second_chance@cox.net
The Ultimate Guide To Modding: I-War 2 - Edge Of Chaos (on hold during SW MP mod)
cartoons.sev.com.au/index.php?catid=4
.

Please Log in or Create an account to join the conversation.

More
19 years 6 months ago #11538 by Second Chance
And here it is! [8D]

*edit - This step should only be done in Lightwave as part of the final preparation of a model for conversion to the game's pso format. Again, doing this in another modeling package prior to importing the model into Lightwave is a waste of time!

<font size="4">Tutorial On Managing Odd-Shaped Open Polys</font id="size4">

Ok, here's the solution to a problem that vexed me from my very first EoC model. The problem stems from having a polygon with, basically, a cut-out in the poly. It doesn't matter if it's a hole or just a bite out of the side. Here's an example so you know what I'm talking about&#058; On the dish structure of my Millennium Falcon, the braces that support the dish itself are supposed to look like struts, as shown below.



As you can see, there are four structures that basically have an open space between two of their outer-most points. To make it really easy to understand the problem area; here are profile shots of two of the polygons in question:

.

Ok, now that you understand the problem area you're probably asking yourself "Ok, so what's the problem?" The problem is that flux won't draw polygons like these correctly. It will try to fill in the cut-out parts and make them solid. Or even worse, the entire part that the errant poly belongs to won't show up in-game, but it will seem perfectly fine in Lightwave. My X-Wing fighter's original wings had four tiny little polys with this problem, and it caused the entire wing section not to show up in the game. Unfortunately, I didn't know about poly cut-outs at the time and rebuilt the entire wing section unnecessarily. Flux just doesn't like these kinds of polys, so what you end up with is something like this:



Aaaaahhhh, now you see the problem, right? This looks like crap. It looks like the dish is held up by cardboard. And the upper braces show another bad result of these polys, sometimes only one side tries to become solid. The other side just shows up as black, or not at all (causing your model to have holes in it). I think the vertex order determines which problem you're going to get. So, how do we fix it so we can have shapes like this on our models and have them show up correctly? The answer, simply, is to tesselate the guilty polygons. Tesselation is a mathmatical procedure that splits polygons into triangles based on every vertice in that polygon. In Lightwave, it's called the Triple function; although I don't quite know why, it doesn't really seem to triple anything. It does, however, split the one poly into many. Effectively eliminating any open polygon cut-outs. Compare this picture with the previous profile:



The open space is no longer an issue because it's no longer a cut-out in a single polygon. Now it's a bunch of closed polys arranged around an open space. Now, in order for this to work properly you must perform this operation on every problem polygon! And that means lots of careful searching through your model to find the culprits. And so:



Now take a look at the in-game model:



Ahhhhh, that's better.

"So, how does this problem happen? And what can I do to prevent it?" Well, there's nothing you can do to prevent it, but it most commonly happens when you use some sort of polygon optimization tool to reduce the poly count. The trick is simply to thoroughly check your models for open poly cut-outs when you're finished with them.(And I really mean finished! Optimizing again after you've spent the time fixing problem polys could cause you to tap on your computer, with a bowling ball; thus making modeling increasingly difficult.) The fix is fairly simple, but beware! The polycount can really start to jump with these kinds of polys. So if the added detail isn't absolutely necessary, I suggest you remove it. In my case, it was necessary. So I just had to be careful with the other parts.

It's also important to note that fixing these kinds of polys is totally unnecessary for any LOD less than the highest, as you won't be able to make out the detail anyway. So feel free to optimize again when creating lower LODs.

So now you know the secrets of polygons with cut-outs. Hopefully, this will save you the hours of hair-pulling aggravation I spent trying to figure out why my models wouldn't display properly.

As usual, please feel free to ask questions, email me or critique my presentation.

mailto:second_chance@cox.net
The Ultimate Guide To Modding: I-War 2 - Edge Of Chaos (on hold during SW MP mod)
cartoons.sev.com.au/index.php?catid=4
.

Please Log in or Create an account to join the conversation.

More
19 years 2 months ago #12144 by Second Chance
Posted some new info on glow channels in the first tutorial addendum.

mailto:second_chance@cox.net
The Ultimate Guide To Modding: I-War 2 - Edge Of Chaos (on hold during SW MP mod)
cartoons.sev.com.au/index.php?catid=4
.

Please Log in or Create an account to join the conversation.