Important Message

You are browsing the archived Lancers Reactor forums. You cannot register or login.
The content may be outdated and links may not be functional.


To get the latest in Freelancer news, mods, modding and downloads, go to
The-Starport

** Tutorial ** - Lightwave 3D to Freelancer

Here you find the different tutorials on editing and MODing Freelancer

Post Thu Apr 24, 2003 1:06 am

** Tutorial ** - Lightwave 3D to Freelancer

I've had very little experience writing good tutorials, so please bear with me.


Things you will need:
Lightwave 3D v6.0+ (I'm using 7.5 for this tutorial, but most of it should work with older versions back to 6.0)
Photoshop (Or similar image editing software)
Milkshape 1.6.5+ (Or any version that will work with the LWO 5.x and 6.0+ importer/exporter plugins by CCCP.)
Milkshape FreeLancer CMP exporter
FreeLancer UTF Editor (With MFC)
A ship to import to Freelancer

Brief Outline of what we'll be doing:
- Model Preperation 1
- Creating the Game Texture
- Model Preperation 2
- Adding Hardpoints
- Converting to CMP
- Making the Ship's MAT file
- Making the Ship's Commodity Button
- Installing your Ship

What this Tutorial will NOT do:
- Deal with Levels of Detail (LOD)
- Deal with INI editing (We'll touch on it so that your model will be used, but nothing more.)

Now that we have everything together, let's begin.

-------------------------------------------

Model Preperation 1

Step 1: Open Modeler and load your model. It can be a photographic version of your ship, as we are about to lower the poly-count. NOTICE! It IS important that none of the textures be on UV maps, as this will create major problems as we lower the poly-count of the ship for the game.

Step 2: Using your favorite method, lower the poly count of your model to under 3000 Polys. Don't feel the need to add polys though. Levels of Detail (LODs) are NOT something we deal with in this tutorial.

Step 3: Add a new UV map for the entire model. The name is un-important, but make sure it's Map type is set to "Atlas". Save the model.

Creating the Game Texture

Step 4: Open Layout and load your model. Position your camera so you can see the ship rather well. Make sure to set the camera's width and height to 64. Light the ship as you see fit, but make sure that it shows up well when rendered.

Step 4.5: (Optional) Open Modeler back up, and create a simple square in the top view. Give it a surface of "Ground", with a color of 128, 128, 128 and save it. Add it to your current scene, and lower it so that it's underneath the ship. Turn off all your lights so that none of them effect the ground. Add a Spotlight, set it's intensity to 100% and position it so that the light shines onto the ground, in the bottom left half of the ground. Set the Ambient Light to 0%, and position the camera so that it sees all of the ship from the left side, and slightly up. Render it, and it should look like one of the ship icons in the game. When you are happy with it, continue to the next step.

Step 5: Open the Surface Editor, and select a single surface. Click the "Shaders" tab, and add the "Surface Baker" shader.

Step 6: Open the Surface Baker shader. Make sure "Continuous Map", "Bake Entire Object", "Bake Color" and "Bake Diffuse" are all selected. Unselect "Bake Shaders" and "Bake Illumination". Shaders should be off, because it would bake the baking shader, thus crashing Lightwave. We don't want Illumination because that would bake the lighting you currently have set, and we want only the game to effect the lighting. Also make sure the "Bake To" is set to "Image". Set the UV Map to what you created in Step 2. "Image Resolution" can be any multiple of 2. I recommend 1024, however, this creates 3 Meg images, so you might want to stick to 512. Make sure you set your texture name to something like "shipname_baked.tga", and (THIS IS IMPORTANT!) make sure your image type is set to 24-bit! It will not work (well) if it's set 32-bit!



Step 7: Close Surface Baker and the Surface Editor, and save your scene if you have not already done so. Make sure your "Render Display" under Render Options is set to Image Viewer, or Image Viewer FP. Hit F9 to render a frame.

Step 8: When it is done, save the small image as "shipname-commodity.tga". I tend to save everything as a 24-bit Targa (TGA) file, so make sure you do that. It makes things easier later. You can close Layout now.

Model Preperation 2

Step 9: Load up Modeler again. First thing we do now, is we make a copy of out model. (Save it as "shipname-game.lwo".) Add a new surface for the entire model, and call it "a_shipname". Why do we call it "a_shipname"? It is because when we load the model into Milkshape later, it loads groups according to their surface name. Hence, if we called our ship "Zulu", the "Zulu" group would be loaded after all our Hardpoints, and it is documented in the CMP export plugin that the ship's mesh HAS to be the first group. Don't worry though... We will change the name later in Milkshape.

Step 10: Open Surface Editor, and select the "a_shipname" surface. Add a new color texture, and set it's projection type to UV. Select out UV Map, and for the image, load the baked image we just rendered. Click "Use Texture", and close Surface Editor. Your model should now look like a rendered version of your other ship model.

Step 11: Now size your ship so that for a somewhat small ship, the total length is 1km. Why so big? This is the way it is in Freelancer. I don't know why, but it is. For a good sized ship, I'd say no smaller than 1.5km. You might have to play with size later.

Step 12: Once it is properly sized, center your mouse at 0, 0, 0, and in the front (or back) view, hit the E or R button twice. This will rotate the model 180 degrees so that it is upside down. Also, make sure that from the top view, the front of the ship is pointing down. These are requirements by Freelancer. We're almost done prepareing the mesh for Freelancer. All we have to do now is in the front, back or side views, lower the ship vertically. I'd reccomend that the uppermost part of the ship be no higher than -100m. This will keep the ship from looking like it's going through the floor.

Edited by - Admiral Alex on 24-04-2003 02:12:15

Edited by - Stinger on 2/14/2004 7:51:27 AM

Post Thu Apr 24, 2003 1:07 am

Adding Hardpoints

Step 13: Select Layer 2 and in the top view, create a flat, square box that is even on all 4 sides. Now Select two of the points, and either weld them together in the middle of their shared line, or scale them in the middle of the distance between them, and merge them together. You should have a perfect Triangle. Now hit F2, and it should be centered in at 0, 0, 0. This is your basic hardpoint model. Select it, and give it a surface of "Hp/Fixed/HpMount". I have yet to figure out why we need this, but we do.

Step 14: Bring your ship into the background layer, then copy our hardpoint. Move the hardpoint to the middle (inside) of the ship, then hit paste, restoring our original HpMount hardpoint. Give the current hardpoint a new surface of "Hp/Fixed/Engine01". It is important to note that hardpoints will automatically orient themselves to the Poly surface nearest the center of our harpoint poly. (The average of the 3 points that make up the hardpoint poly.) Follow this procedure until you have created new hardpoints for your engine, thruster(s), shield, and tractor beam. If needed, add them also for your mines, counter measure dropper, contrails (those lines that come off your ship while moving), and lights. For your weapons, follow the same procedure, but you'll want to name them "Hp/Revolute/HpWeapon01". (Notice the "Revolute" where the "Fixed" used to be.) When you are all done, save the model, and close Modeler.

Converting to CMP

Step 15: Make sure that you've added the CMP exporter into the Milkshape directory, then Open Milkshape. Click File, Import, and then select the LOWEST "Lightwave LWO..." option. (The one higher up is the built-in Lightwave plugin, and that's not what we want.) Select your "shipname-game.lwo" model and hit "Open". The Defaults are all fine, so hit "OK".

Step 16: Under the Groups tab, rename your "a_shipname" group to simply "shipname". Copy this name, click the Materials tab, scroll to the top, and rename your material to the same name. Next, delete all the materials that start with Hp. This will make our hardpoints texture-less, which is good.

Step 16.5: (Optional) You can add your texture to your model, and save this as a Milkshape mode, if you wish to edit it in Milkshape later. If you need to edited it, I recommend editing it in Lightwave, then follow the Converting to CMP section of this tutorial again.

Step 17: Click File, Export, then select "Freelancer CMP...". The best place to save this would be in your Lightwave directory, near your source materials, then copy it to your Freelancer directory later. Use a distinct filename, like "group_shipname.cmp" where "group" is the name of your faction. After you hit "Save" a pop up will appear. Ignore this, and hit "Continue". You can Close Milkshape now.

Making the Ship's MAT file

Step 18: Open Photoshop and load both your "shipname-commodity.tga", and your "shipname_baked.tga" files. Resave the "shipname-commodity.tga" file as a 24-bit, uncompressed TGA file, then close it. Now for the "shipname_baked.tga", first click Image, Rotate Canvas, and select "Flip Canvas Vertically". This will make your textures "upside down". For some reason, not doing this will make your UV Maps appear to be upside down... Save this modified image as "shipname_baked2.tga", again as a 24-bit uncompressed TGA file.

Step 19: Open the UTF Editor, and hit the "New Tree" Button. Hit the "Add Node" Button twice. Double-click (slowly) the first node to activate the renaming function. Rename the first node "material library", and the 2nd node "texture library".

Step 20: Select the "material library" node, and add 2 more nodes. Rename these to "Type" and "group_shipname", respectivly. For my example, my 2nd node is "stf_assassin". Click on Type, and where it says "interpret data as", scrol up to "string" and hit the "Edit" button. Type in "DcDt", and hit "Update". Select the "group_shipname" node, and add 2 more nodes. (Lots of nodes, huh? Well, there's a lot more to do...) Name the first of these new Nodes "Dt_name", and the second one "Type". As with our previous Type node, edit it's string to say "DcDt". For our "Dt_name" node, edit it as a string, and type a unique name for our texture. "group_shipname.tga" would work.

Step 21: Select the "texture library" node, and add a new node. Rename this node to the "group_shipname.tga" name we used for the "Dt_name" node, then add a new node under that one. Rename this node to "MIP0". (That's a 0 (Zero), not O.) Now select our MIP0 node, and hit the "Import..." button. Select our "shipname_baked2.tga" file, and hit "Open".

Step 22: This is the most important step of this section: Hit the "Save File..." button, and save it as "group_shipname.mat".

Making the Ship's Commodity Button

Step 23: In the UTF Editor, hit the "Open File..." button. Go to your "Freelancer\DATA\EQUIPMENT\MODELS\COMMODITIES\NN_ICONS" directory. Now open the "bh_elite.3db" file. This file is the file that is used for the icons when purchasing your ship. Expand the tree, and go to the "material library" node. This seems to be optional, but I highly recommend it anyways; Rename the "SHIP_bh_elite" node to "SHIP_group_shipname". Underneath it, edit the "Dt_name" node in string mode. I recomend replacing the text with "group_shipname_icon.tga", as it will be unique.

Step 24: Open the Texutre Library Node and rename the node beneath it to "group_shipname_icon.tga". As with the MAT file, select the "MIP0" node, and hit import. This time, however, load the "shipname-commodity.tga" we made eariler.

Step 25: Save the file in the "Freelancer\DATA\EQUIPMENT\MODELS\COMMODITIES\NN_ICONS" directory as "group_shipname.3db" and close the UTF Editor.

Installing your Ship

Step 26: Open Explorer, or My Computer, and find your "group_shipname.cmp" & "group_shipname.mat" files. Open another window and open your Freelancer directory. Then open your "Freelancer\DATA\SHIPS" directory. Create a new directory for your group, if one does not already exist. Inside there, make a new directory called "group_shipname", and open that. Finally, (Yes, finally) paste your CMP & MAT files into that directory.

Step 27: Head back to your "Freelancer\DATA\SHIPS" directory, and open your shiparch.ini file. (You may have to decompress it if it is not already decompress.) Scroll down to your ship, and find the lines "DA_archetype" & "material_library". NOTE: There may be 2 "material_library" lines. We only need the first one, which should referance the ship directory. Edit these lines so they appear similar to my following example:

DA_archetype = ships\stf\stf_assassin\stf_assassin.cmp
material_library = ships\stf\stf_assassin\stf_assassin.mat

Step 28: Save the file, and close it. Now go to your "Freelancer\DATA\EQUIPMENT" directory and open the "goods.ini" file. Scroll down and find the "hull" section that your ship's "package" referances. Edit the "item_icon" line to appear like this:

item_icon = Equipment\models\commodities\nn_icons\stf_assassin.3db

Step 29: Save the file, and close it. Your editing is now complete.

Step 30: Enjoy flying your new ship!



Edited by - Admiral Alex on 24-04-2003 02:13:58

Post Mon May 05, 2003 5:35 pm

I dont own lightwave but I found this tutorial to be the most handy one in this forum.

Thanks for posting it mate

Giskard

Post Sun May 18, 2003 1:32 am

I want to make a ship but all this is alien to me.. I am a dum dum, there needs to be a "freelancer ship creator" program for dummies like me who can make the shapes of the ship but don't really know how to do all the technical stuff with the special tools in the program (whats a polly? ) and why's it have to be 3000 and what the heck does that mean :p anyway.. I doubt i'll ever get to make my own ship

Post Sun May 18, 2003 4:41 am

OK, I got to the making of hard points and got lost, i was actually pretty lost before but :p anyways, where do I find a second layer? and how do I merge the two points, I tried merging them and it says it does, but it stays a square.. it wont turn into a triangle. I am totally confuzled surely there must be an easy way to make a ship and import it into the game.

Post Tue May 20, 2003 9:04 am

It sounds to me like you need some kind of beginner's guild to Lightwave, and maybe 3D in general. I suggest getting used to Lightwave before trying something complex like making a Freelancer model. This is obvious from your lack of knowing what a poly is.

Simple crash course:

A Poly (short for Polygon) is traditionally 3 points that are connected forming a surface, or Polygon.

Video cards are polygon crunching machines for your computer. Since videocards aren't standard like a console gaming machine, it is suggestion that the highest LOD of ships have 3000 polys or less, so your video card can crunch a lot of them at once.

Start looking up some simple Lightwave tutorials before trying to go much farther.

Good luck!

Post Thu Jun 19, 2003 9:16 pm

Wow, this helps a lot. I don't use Lightwave (not a big fan). I use the simple Milkshape for my gaming modelling. Up till now I hadn't found a good tutorial for importing into Freelancer, this helps clear up sevaral things. Thanks!


Merc for hire...but only if you can afford it.

Post Sat Aug 09, 2003 7:58 am

This is your basic hardpoint model. Select it, and give it a surface of "Hp/Fixed/HpMount". I have yet to figure out why we need this, but we do.

the "Hp/Fixed/HpMount" sets how your ship lands/sits on ground. this hard point should alway be placed at the bottom of your ship or even a bit below.
your ship will be part way in the ground when it lands if you place that hard point higher

Return to Freelancer Editing Tutorial Forum