Hosted Projects - Non-FreeSpace > StarShatter Open Source Project

Converting Freespace Models for Starshatter Tutorial

(1/2) > >>

Converting Freespace Models Tutorial

As requested here's a tutorial on how to convert models from Freespace to Starshatter. I'm using 3ds Max 2012 and Photoshop CS4 and this tutorial assumes a certain amout of knowledge of both programs. Like most things it's mainly about organization. So you want to set up all of your folders beforehand. If you think all this is really basic just skip ahead. I can't remember who it was but someone very wise on these boards said you need to write a tutorial like you're talking to a five year old.

First set up your convertion folders. Here I have folders for all the different types for the GTA and UEF.

Inside these folders you create a folder for the ship you are working on and inside this create the following folders, DAE, Magic, OBJ, and POF. To speed things up in the future you can create these folders somewhere, like I did in the zBlank folder, and just keep them empty so you can copy and paste when you start a new ship.

Now create a folder for your mod. I call the mod I use for converting and testing ships Shipyard but you can call yours anything you want. Inside this folder create another folder named Mods and put the createmod.bat and Datafile.exe described in this thread.

Inside the Mods folder create folders for Missions, Ships, and Weapons. In the Ships folder create a folder for the ship you are working on. In the Weapons folder I have the GTA and UEF weapons seperated but all the weapon effects are in the same folder.

Now it's time to grab the model. In this case the Karuna Mk1 from the bp2-visuals1.vp. Extract the model pof and all of it's textures to some location(I just use a New Folder on my desktop). Open up the pof and save to dae. Now move the pof to the POF folder, the dae file to the DAE folder and all of the textures to the Magic folder.

Open up the Magic folder and open the main textures ( and with Photoshop and save them to tga. Drop the tga files into "C:\Program Files\Common Files\Autodesk Shared\Materials\2012\assetlibrary_base.fbm". I keep a shortcut to this file on my desktop to save time. This will have the textures show up on the model when you open it up in Max.

As a side note concerning textures I found that the Karuna's textures are just to big for Starshatter, even as dds. The tile mapped ships perform better with dds files but I ended up converting the Karuna's textures to jpg and it performed much better. It might just be my system but keep this in mind.

Fire up Max and import the dae. Hit "Select by Name" and turn off "Geometry" and turn on "Helpers". Select all of the helpers and delete them (I always feel bad about that part).

Turn on "Angle Snap Toggle", select everything from the Top viewport, and rotate everything 180 degrees. Sometimes you have to get the centerpoint back but the Karuna rotates right on it.

Starshatter bases the size of the hullfire graphics to the scale of the ship model. This is the reason that hullfires seem to engulf the entire ship in the vanilla game. To fix this select everything and scale up everything up quite a bit. About five times or so. Trial and error comes into play here but IMHO it makes a big difference. This step is only really important for capital ships.

Hit "Select by Name" again and turn "Geometry" back on and select detail 0. Right click and hit hide unselected. Under the Modify tab select polygons and select one of the nameplate polies. Skroll down to "Materials" on the rollout and hit "Select ID". Hit delete. Now go backup to "Editable Mesh".

I didn't figure it out until I tried converting the Orion but either Max or Magic mirrors the ship when you convert it. This isn't noticable with symetrical ships like the Karuna (except the "Stand Clear" in the fighter bay). In order to fix this you need to hit "Mirror". With the Orion I was able to select everything and mirror it but with the Karuna doing that messes up the debris. So just mirror the pieces that are going to be part of detail 0.

Magic can only handle models with 16k and fewer polies so for very detailed models we have to save them in levels. Select everything and right click and hit hide selected. Get the "Poligon Counter" out which is found under the "Utilities" tab under "More". Right click and hit "Unhide by Name" and chose all of the elements that you would see at detail 0 in game except the rotator and the multipart turrets.

Select everything and you can see by the counter we are way above our 16k budget. Open up "Select by Name" and start ctrl clicking parts until you get below 16k.

Once you have it click on the Autodesk symbol at the top left and choose "Export" and then "Export Selected". Navigate to your OBJ folder and save the file as something like Karuna0_0.obj. Once it's saved right click and choose "Hide Selected". Select what's left and it's still too much, so again, deslect some parts untill you are below 16k. Looks like all we have to lose is the fighterbay detail. "Export Selected" again and save the file as Karuna0_1.obj. "Hide Selected" again and select the remaining piece and "Export Selected" it and save it as Karuna0_2.obj.

"Unhide by Name" and select rotatora. "Export Selected" it and save it as Karuna_rotator.obj.

The proccess for detail 1 and 2 is the same except you won't be keeping the rotator as a seperate piece.

Starshatter can't handle more than ten pieces of debris and you'll probably want to have two of those slots go towards the little debris that go flying everywhere when a ship expolodes. That means we have to reduce the Karunas 32 pieces of debris to 8.

Hide everything and "Unhide by Name" selecting all of the debris. Now just go through and make logical choices of how you want the debris to look. When you have a selection set together you are happy with "Export Selected" it and save it as Karuna_debris01.obj. Repeat until you have all of your debris. When you're done select everything and hide.

For the turrets start out by unhiding all the mutipart turrets. If you want, rotate all the barrles down 90 degrees. Select them all and export them as turret_detail.obj. You can use this to help you position and scale all of the turrets.

You only need to export one of each of the different turrets (base and arm seperate) and an inverted version with their barrels rotated down 90 degrees. When I first started converting models for SS I would select a base and move it to (0,0,0) where it has to be. I found that this can cause the model to become unscalable in SS. I tried resetting the xform but it would still happen. So I started exporting the turret right where it was and then repositioned it in Magic. Just be sure and get (0,0,0) in the center of the model.   

The next step can be skipped for the turret_detail.obj. I find it's easier to use if it doesn't have a texture.

Now go to your OBJ folder and select all of the mtl files. Right click and select "Edit with Notepad ++" (If you don't use Notepad ++ you're doing it wrong).
Go through each line and remove "C:\Program Files\Common Files\Autodesk Shared\Materials\2012\assetlibrary_base.fbm\\" so that all that remains is "map_Ka krnasubs.tga".

Highlight one of the tga and go up to "Search", choose "Find", and choose "Replace". Tga should already be in the "Find" box, all you need to do is put dds (or jpg if you converted the textures) in the "Replace with" box and hit "Replace All in All Opened documents". Save All and close out.

Time to fire up Magic. Right now there are two progams for Magic, 1.5 and 2.0. Magic 1.5 is used to convert from OBJ to MAG and to scale or move anything you need to. Magic 2.0 is used for textures and finding positions on the model. I believe that The E is working on these programs so someday they might be consolodated.

So open Magic 1.5, I like to maximize and move the center line all the way to the right, the blue 3d view can cause problems. Click on "Open" and navigate to your OBJ folder. Change the file type to "All Files" and open up your Karuna0_0.obj. Go up to "File" and choose "Save As". Navigate to your Magic folder. Even though the box says "Save as type: Magic Files" you need to remove the .obj from the file name box or it will just save as obj. Do this for all of your obj files.

Open up your Magic folder and select all of the files (it should just be the MAG files and the textures). Copy these files and paste them in the ship's folder in your Shipyard mod. From here it's all about creating a def file and there's more than enough documentation for that stuff. I'm just going to point out two key points.

Starshatter does it's detail levels backwards so the lowest detail level is 0 and the highest is 2 in this case. Notice how all of the detail 2 models are listed and that the rotator is third on the list. Just below is the spin for the rotator and it's spot is third in that list too. The number defines the speed.

--- Code: ---detail_0:   "Karuna2_2.mag"
feature_0:  100

detail_1:   "Karuna1_1.mag"
feature_1:  40

detail_2:   "Karuna0_0.mag"
detail_2:   "Karuna0_01.mag"
detail_2:   "Karuna0_0rotator.mag"
detail_2:   "Karuna0_02.mag"
feature_2:  25

spin: (0,0,0)
spin: (0,0,0)
spin: (0,0.3,0)
spin: (0,0,0)
--- End code ---

That's about it, other than creating the def file. You can search the stock files or mods for similar ships and use their def files as a starting point. As you cut and paste be careful. Starshatter hates extra commas and if you find the game crashing as you load your ship that's probably the reason. Use /* and */ to systematically block out parts of the def to find the offensive code.

Map and Hud Pictures Tutorial

You should probably make a set of folders for the HUD and MAP picture files. For the MAP pictures you want a folder for Capital ships and one for Fighters.

For the Map and Hud pictures you want to unhide everything that you would see on detail 0 in the game including the rotator. First the Hud pic. Position the the ship so it looks cool and make a render. I render to 2048x2048 and I just use the scanline. Save the picture as KarunaHUD.tga.

Open up the picture in Photoshop and convert it to black and white. I like to bump up the white levels a bit so that it's easier to see. Change the image size to 128x128 and save the file as KarunaHUD.pcx.

For the map picture create a plane in top view and change the color to white. Move the plane below the ship and select the ship and "Zoom Extents Selected" it. You'll probably have to move the camera around but you want it drop dead center of the render. Save the picture as KarunaMAP.tga.

Open up the picture in Photoshop and unlock the layer by double clicking on the background layer. Add a layer below Layer 0 and fill with black. Reselect Layer 0 and under "Select" choose "Color Range" and eyedropper anywhere in the white of the picture.

Click "OK". Back under "Select" choose "Inverse" and then choose "Modify" and then "Expand". Put ten pixels into the field and hit "OK". Back under "Select" again and hit "Inverse" one more time. Hit delete and then "Deselect", then hit "Reselect" and hit delete again. I do this step about four times to make sure that there aren't any pixels that survived. If there are there with be a square around your map picture in the game.

Convert the picture to black and white and adjust the levels. At this point it's a good idea to save a PSD of your picture just in case we mess up the next step.

For this part you are going to want to record a few Actions. If you don't know how just Google it but it makes doing this for other ships so much easier. You want an action for (Capital 0,2,4,6),(Capital 1,3,5,7),(Fighter 0,2,4,6), and (Fighter 1,3,5,7). The reason for having Capital and Fighter seperate is Capital ship map pics are 64x64 and fighters are 32x32.

The breakdown for the map pictures are:

   0 =  9 oclock
   1 = 10 oclock
   2 = 12 oclock
   3 =  2 oclock
   4 =  3 oclock
   5 =  4 oclock
   6 =  6 oclock
   7 =  8 oclock

Starting out our picture is ready for the six oclock. Under "Layer" hit "Flatten Image". Now resize the image to 64x64 and save as 6.pcx in your Capital folder. Under "Edit" hit "Step Backward" twice. You should be back to having a layer 1 and 0.

Under "Edit" go to "Transform" and choose "Flip Vertical". There's our 12 oclock position. Do exactly as you did before but save as 2.pcx. Remember to step backwards twice.

Under "Edit" go to "Transform" and choose "Rotate" and rotate the ship to the 9 oclock position. After you have done as before and saved as 0.pcx flip the ship to 3 oclock and save 4.pcx. Continue until you have all of the clock positions saved as thier number. Navigate to your Capital folder and add "KarunaMAP" to each file name keeping the number at the end. So file 0.pcx becomes KarunaMAP0.pcx.

Copy all the map.pcx's and the hud.pcx into the ship's folder in your Shipyard mod.

Good tutorial. Though I wish there was one that used a free modeling program. Photoshop steps can be easily done in GIMP, but I'm not sure about whether Max ones can be easily translated to Wings. A tutorial for Wings 3D or Blender and GIMP could be very helpful.

I wish I could help there. I know that wdboyd over at the old site said that he used Wings 3d, so I know it's possible. Maybe with a little experimentation you can figure it out.

Edit: I just added a note to the OP concerning rescaling the ship. It's important to scale the ship way up to make the fire and explosion graphics look right. If you don't scale up the hullfires will look like they engulf the entire ship.

"Explosion_scale"  on ship def also scales the explosions and fire on the ship, it may save you some time with the model rescaling. I recommend scaling all models to its correct size relative to each other, so you only have to apply the same "explosion_scale correction factor" to all of them on def files.

Awesome tutorial btw  :D


[0] Message Index

[#] Next page

Go to full version