A community project aimed at creating the ultimate Homeworld2 mod.
This tutorial belongs to chris80520 and i thought it would be good to have a site that you dont need internet explorer to get 2 so here it is. All credits belong to chris as far as this goes.
Posted by LeviathansWrath on Nov 11th, 2010
Intermediate Starting a mod.
In this section I an going to blueprint the basic way I create a ship from the original Homeworld Universe. First off, we need to decide which ship we want to convert. This page assumes that the reader is familiar with the .big file extension it's compilation / de-compilation procedures & that you have already unpacked your .bigs & are tinkering. Homeworld 1 races inside of the big folder are in folders as follows P1 - Turanic Raiders, P2 - Kadesh, P3 - Timat, R1 - Kushan, R2 - Taiidan. I use 3D Exploration to convert the Homeworld 1 ship geometry file from a .peo extension to the .obj extension required for input in the CFHodEdit program. After opening 3D Exploration browse the ship folders for a ship you wish to convert, once you find one look at it to see if it looks correct, I have noticed that some ships do not have all objects in their proper position, especially ships with multiple identical secondary objects, such as gun turrets, parts on the scaffold, wings & any other secondary mesh type. I will explain how to deal with that particular problem later on in this page, for now we will pick a ship with a single mesh.
The ship I am using for this demonstration is a relatively easy one, I made the Kadesh Multibeam frigate tonight, along with this page. It contains just three textures & is a one piece mesh, additional meshes, can be viewed on or off the ship in the Object List of 3D Exploration, if there are multiple meshes the list will have it's name and & checkbox next to it.
3D Exploration is seemingly the right choice for this conversion as it takes the .lif files & converts them to .tga (other file types for export are supported), and along with that combines adjoining textures into larger ones thereby making the overall conversion faster. A particular downside to that is the .lif format stands for layered image format, and 3D Exploration flattens those images when they are exported, the problem is .lifs were used originally for team colors, as using the Lif2Psd program to convert the textures provides what is the "team color" layer along with the standard texture layer. I have recently figured out how to implement the team colors and here is a short tutorial, both pages should be read for complete understanding. As for the ship I have chosen this downside to the program is irrelevant as Homeworld 1 secondary races were not meant to be played in a multiplayer environment, so there was no addition of team color layers (I do believe).
Back to converting, click file, click save as, make sure the file type is .obj, leave options as default, convert textures to whatever format you are most comfortable editing & save to a folder of your choice. I keep a folder on my computer that has all of my original model textures, created textures & meshes & other stuff like that. I keep the filing system just as the Homeworld 2 filing system, keeping all sub directories with the first three letters of the race & the second half the ship name ala c:\homeworld2\modfolders\kdh_multibeamfrigate, this keeps things neat & clean.
Now that we have our .obj ship mesh file & our .tga texture files we are ready to convert those textures once again, this time to .dds. I use photoshop for this, I have heard the gimp will work as well & also uses photoshop plugins, also you do need to have the NVidia .dds plugin to open/save your files in that format. Ok, let's start by opening all of the texture files.
Step one - go to Image, in the menu bar, go down to Image Size, this will bring up a control box to change the image's size. Change the value for the resolution from 72 to 288. Make sure on a small texture files that photoshop has done it's math correctly, some converted textures are only 16x16 & the like, and photoshop will sometimes give you a 1 instead of a 64 when you erase the 72 and input the 288.
When I was first trying to get this all figured out, I had tried changing the size in inches, did not work for me (probably wasn't using right ratio), I also tried different resolutions including 144 & 576 (all textures must be in these increments, 72, 144, 288, 576 - I will assume larger but not recommended). In the end what really changes is the amount of pixels, this textures original size was 256x256 and is now 1024x1024. When we hit ok here the image will be blown up four times it's original size and then when we save it the resolution will be converted back to 72 but the inches will be increased by a factor of four so that the number of pixels, width & height, do not change.
We will save this image right now to the .dds format, this is texture that will be displayed when a starlight is bright on a ship's hull. Following the format described in the CFHodEdit manual it is probably a good idea to save the individual textures with definitive export names, I use as also suggested, adding a _EXPORT for a base ship texture and _EXPORT for a ships shaded texture, etc I would save this file as kdh_multibeamfrigate\page1_EXPORT.dds, this is relatively important as you almost always have two textures per shader when you create your .hod file. Back to work, the next window that opens will have a multitude of options for the NVidia plugin, you do need to change the save format to DXT5 & select No Mip Maps.
Now that we have the standard texture saved, we need to move onto the more difficult texture, the shaded one. First off we need to select the entire image with the rectangular marquee & copy & paste in photoshop, thereby creating an additional layer. What I do then is adjust the contrast of the image to 50% using the Brightness/Contract Tool under the Image/Adjustments in the top menu's. I am very precise with this, none of my ships are at 48%, none are at 52%, I'm just that way. Now that we have a nice contrasted picture, we need to again go to Image/Adjustments & go to the Channel Mixer option. For the Red & Green channels we need to zero them out, leave the blue at 100%, your file should look some thing like this.
The next step is to create an additional blank layer, go to Layer/New Layer names are irrelevant as there will be no more than three usually (background, layer 1 - blue), layer 2 for glowing). In this blank layer we will spot out the area's that we want to "glow", any ship hull lights, or bridge sections must be made green for them to show up brightly when there is no light source from the direction you are viewing the ship. I usually start by making the blue layer invisible, uncheck the little eyeball next to the layer you want to not have visible (layer 1 for us). Next grab your brush and get to work, I will use the brush to do a small batch of lights, or sometimes the bridge section, you must use a neonish green such as the samples in these pictures. I will use the rectangular marquee to mask an area that I wish to fill such as an engine area, or an area that has light cast on it from the engine, in some cases I will vary the Feather px between 2 and 20 to create light fading outwards away from the source.
I was thinking of marking off the red marks on the hull, but I do not believe they are all lights, we'll see how it looks in the original & HW2 later to make a final decision. You can always re-edit your textures & re-import them into the CFHodEd program if you find that you have made mistakes or your glow section is too far onto an area that shouldn't glow. The middle glow area shown above was made using the elliptical marquee tool, accessible if you hold the rectangular marquee button for a few seconds. Using a feather value of 20 px I defined the area I wished to fill & as you can see produced a nice fading ellipse, the same was done for the engines, only using the rectangular marquee at 10 px, you may have to click fill a few times to get the desired thickness for the shading. The solid square area was where one of the original engine textures is behind, the area around the texture is a solid grey which generally indicates that that part of the texture is hidden behind a bend, we can then safely cover that entire area with the green. As I reference the original model in 3D Exploration I found that this center area is in fact colored wrong for this ship. What I need to do is create a new oval at 20 px feather, and fill the area over the engine's cast light, see example picture, note how much smaller the marquee is vs the filled area. Then I need to marquee the ovals area with a square marquee a bit larger than the green oval as to not miss any of the fade & rotate & scale the oval as necessary. I created another layer for this after I erased the section in the picture above, in this way I could then create a duplicate layer & use the Transform to flip and then to the move tool to nudge over by arrow keys to keep the mask on the same pixel height. We now have a v-shaped mask, by using the duplicated level we have overcome the problem of trying to use the feathered marquee twice in a close proximity as the fill will stop when it gets to a very lightly feathered area. I like to merge those additional green layers down to one green layer, after doing that I trim the area where no glow effect should be from Pic 3 to Pic 4, edges out side of glow area are clean.
Next I'll make another ellipse on a new layer to go from the center of these glows out towards the rear of the ship, the portion above and in the center is the area where there is a gap between the ships two engines. Then I'll fill the ellipse and trim the edges once again, and merge the layer down. Now we've got a pretty sweet looking glow section, we'll see how it looks in the game, hopefully good. Next we need to make every layer visible and then save first as a .psd (I use the _EXPORT behind the file name even on the photoshop document. You should keep a copy of the layered file so you can edit as/if necessary. Then save as described above, this is the glow texture so I name it page1_EXPORT.dds
I will then repeat this process for each texture. As for ship lights, although there were none in this example many ships do have a bridge section where small lights need to be hand brushed in, do in a similar fashion as above. The brush supports many different features but be sure to use the right amount of feather. To little and the light may not show, to much and there will be too much surrounding hull light up without enough light source. When finished there will then be two .dds files for each texture, one for regular shading, and one for the glow shading. Then on to importing textures & meshes into CFHodEd.
We'll start that by adding the six textures to the list and then importing the textures for this ship, 1 at a time. Add texture, select texture, import texture, move on. It's nice to have already opened the material list with notepad. This file is exported with the texture files and lists the materials in order of their use (sometimes a texture is used more than once). You will need it for the next step as the materials must be added as they are listed, otherwise your ship won't be textured correctly.
Add the appropriate number of materials then select the first one, you can then change it's name and pick the shader. The shader used for ships is ship.st, and can be found in the shaders folder in your decompiled original Homeworld 2 .big file. After selecting the shader you will be presented with the $diffuse & $glow selections under the Shader Parameters, select one and select the appropriate texture to be used, $diffuse is for the EXPORT files, $glow for the EXPORT textures. Do the rest of the materials, and again, in order of the material list. When a texture is used multiple times I change it's name from say page1 to page1_1 etc. for each subsequent use. Also, when there is a blank entry in the material list, I title these blank & do not select a shader, this works fine, there are seemingly a few ships that have certain edges not textured.
Now onto geometry, add a mesh and name it. I always name my first mesh as root_mesh, seems appropriate as that is what the original manufacturers did. Once your mesh is added add some levels of detail. You need additional levels of detail for smaller ships such as fighters, they need 4, frigates use three. Click on the replace button once you have a LOD selected, this is where you actually import the mesh. Once you have selected the converted mesh it will ask you two questions, to weld verticies & to reverse UVs, although I have an idea of what these mean, I am unsure, I answer no to both questions. Trials conducted saying yes to one or both of these questions have resulted in ships not being able to be selected properly, or ships not texturing correctly. The next step for me is to transform the first LOD, Homeworld one ships require a rotation of 90 degrees on the Z axis to be upright (found that out early). I also use the transform function to scale the ships to 40%, which is input as .4 It seems to me that in this program only the first texture shows up on a ship when in the preview mode, usually that texture is one of the large ones, so you can get a picture of what is going on, although they can be full of holes like this one.
Once you have transformed the mesh, export it and mark it distinctly so you know which is your rotated & scaled mesh, I just add a -40-90 behind the name, also say no to the question asked at that time. Then select your remaining LODs and replace each mesh as described above with the new file. Finally you need to select on the BSRM tab at the bottom of CFHodEdit, select the mesh and click on both auto calculate, I was having an issue with ships being too small, figured it out, I had set the scale options in 3D Exploration to 25%, so CFHodEd was taking 25% of that 25%, ha. Next go to the collision mesh or CM tab and add a new collision mesh, select it and then attach it to the root using the drop down box. Once selected and attached click replace and select the modified mesh file that was used in making the LODs, once imported click on both auto calculates. Now go to the Boundary Verticies tab and import the mesh once again, and again click auto-calculate.
Now save and that's it, well again kind of. You will need to decompile an appropriate frigate .ship file and remark out any hardpoints until you can either add new ones or modify your .hod as necessary. Be sure to save a .ship & .events file with your .hod in an appropriately named folder, add your ship to a custom map and you can then view it for the first time.
One might say, no one is perfect. I reflect back to mentioning any grey area's around the engine may be colored to glow as they are wrapped around, to my dismay as this is not the case for this multi-beam frigate. One can clearly see those area's on the outside of the engine that should be darkened more. The texture to the left is the revised glow and fixes both portions, above and below center engine and around outside engine piece.
Below: A few screen shots from the original game (Karos). The line where the engine parts meet shows even there. Homeworld 1 had it all, the music, the sound, the backgrounds, ah reminiscing.
How To Convert Homeworld & Homeworld Cataclysm ships for use in Homeworld2
(with detailed $glow texture creation for use with shader.st in Homeworld2,
team color overview, and basic Homeworld2 .hod creation guide)
By: chris80502 - originally for: