Submitted by
pepper on Sun, 2004-08-08 05:29.
Milkshape
Making and texturing your first Model - Pepper
Making and texturing your model
This tutorial will show you the basics of modelling and if you follow everything right in this tutorial you will be able to produce a splendid looking Half-Life model that represents a Car.
We will need a few things for making a model. Obviously we need a modelling program, a picture editing program and some patience.
For the Modelling Program, I suggest Milkshape
You can get a 30 day free trial of Milkshape here: Chumbalum-soft
For the Picture editing program, the choice is large.
You can use programs like Adobe Photoshop or Paint Shop Pro for the textures but you have to pay for them so I recommend: TheGimp and IrfanView for re-scaling and changing the format of images.
Once you have your Editing Suite we are ready to go.
Don't forget to save your work regular
Open up milkshape and you see a 4 lovely viewports just sitting there doing nothing.
First we will need to change some things, go to window, click on it once, then go to show viewport captation.
You should have a bar above all viewports with information about the grid size and the view axis.
I will explain what each function does.
select:
With this function you can select the vertexes, faces groups and joints. One of the most used functions. This is all self explanatory.
move:
With this function you can move the faces vertexes groups and joints. First you have to select them.
rotate:
With this tool you can rotate a face, group of vertex's joints or groups on the all the axis.
scale:
With this you can scale groups faces and groups of joints.
vertex:
This will create a vertex if you click in one of the views (viewports). One of the important things to know is that you can not select anything in 3d view.
face:
This function will create a face between 3 specified vertexes. ALWAYS make those counter-clockwise. (turning a circle to the left)
sphere, geosphere, box, cylinder:
These are all the basic objects. We will not use this much. I personally prefer working with plane vertexes but some people model a whole weapon from one box.
extrude:
This will extrude the selected face. Its pushing out a new face of an already existing one.
joint:
This will create the so called joint. Each and every model needs to have at least one joint, this joint defines the centre of the model. This is the point that the Model will be aligned in Hammer. These joints are also used to define the animation of a model.
Now we have the tools we need to get started.
I took the liberty of extracting the textures from the Half-Life wad. If you want to do it yourself, search for textures with trk2 in the name.
I converted all textures to a texture format which Milkshape uses to compile the models and are used by the Half-Life engine.
The format you need is an 8 bit bmp, you can convert these with Irfanview to the right format. I am not going to cover texture conversion in this tutorial since most of you know how to convert a image to the right format and scale. If you still don't get it, I have already made the textures and they are available in the download. I also included one .jpg file and it's called: trk2_side.jpg
Next, open up Milkshape. And go to the upper-right viewport. Right mouse click in the view port and choose background image. Go to the .jpg image I included in the zip.
Now we have our viewport set-up we can start adding the vertexes. Go to the model tab and select vertex.
Look at the picture below, it shows you how it added the vertexes. Although it's a smart thing to do it on your own way to develop your own style.
Use this picture as a reference image for the model.
Once you have outlined your reference picture with the vertexes you can make the faces between them.
ALWAYS MAKE A FACE COUNTER-CLOCKWISE. If you don't you will get a backfaces which are not shown in-game and which will look as if there is a hole in you model.
A face always consists of 3 vertexes, go to the face tool in the models tab and select 1 vertex to start with, then move to the second one counter-clockwise.
Select the last and third vertex and you should have a face. If you did it right it should show up in the 3d view as a grey coloured face and the other side should be black.
Finish the total model with faces, as shown in the image above. Then select all of the faces with the select tool.
Make sure you set it on face, and then you need to extrude the model. I do this because I believe there are not enough good views of the car we are making.
So you now have a flat looking model but its getting the shape of a car?? good.
Select the upper vertexes which forms the side of the roof, I have included a picture of it below.
To select on the front vertexes and those behind it you need to de-select them, hold shift and draw a box around those vertexes you want to de-select with the right mouse button.
Now you have done this you should be able to move the upper-roof vertexes back so you get a angled side of the car. Do the same with the hood and the bottom of the car, don't be afraid to experiment, you can always undo any mistakes you make.
Now for the wheel cases. Select the faces from ABOVE wheelcases. Go to extrude again, but now drag it back and delete the faces from the bottom of the car which would block the wheels.
We will need to make a few faces on the under side of the model to make sure it is all closed, because when we extrude the wheels back we created a new gap.
Select all the faces of the models and go to edit/duplicate selection. Then go to vertexes/mirror left< >right
Hey, look at that we got a real car!!
A real car without wheels, that's ok, because we first need to texture it. Before we do that we need to divide the models in useful groups.
Select the whole model from the side.
Then de-select all the things in a front-back view which do not belong to the side of the car but to the roof or windshield.
Then go to the groups tab with the model selected. Now press regroup, and go down to the rename tab and fill in: side and press rename. Now your group is renamed and regrouped.
Press the hide button a little bit above the rename button and voila, your sides are hidden. Now you can easily select the roof, back, windshield, front, hood, and the bottom.
In the bottom group I included the wheelcases because there also black so why should we give them a different group??.
The next bit is the bit I really like, we are going to give our model a really nice paint job. As you can see in the groups tab there are no materials assigned.
Go to the materials tab and click on new.
Do this 6 times.
Rename all those materials into logical names like side, hood, top ,etc. Then you can assign a texture to your material by clicking on the new button, the upper one because you should see 2 of them. Now for the side you pick the trk2_side.bmp its important to pick the bmp version because that one is supported by the Half-Life game engine.
materials are the textured used on a model
Next, you need to assign all the materials to a group, this can be used as much as you want you can use a material for more then 1 group
First press control+shift+h to unhide all of your faces and groups.
Select the side group by going to the groups tab. When your there go to select. Now we have our side selected.
Go back to the materials tab and select the side material, at the bottom of the tab you will find a button to assign
a material, click it. Your material is assigned. Do this with all the groups. As you can see the textures are not aligned at all and do not look good yet. To solve this we will need to align the textures.
Select your group, in my case the side group and press control+t.
A new window opens with the name: texture coordinate editor. Woa, there is our texture again. At the right side you see several tabs again, all self explanatory.
At the first drop down menu select the group side. At the second select the remap side, that is in this case left or our right, but when you do a front of a car it is obviously the front.
With the Group selected and remap site press the remap button.
OOOOH, our model is getting placed into the texture.
You will need to match up your model with the texture show in the picture. When you switch back to the 3d view and click your right mouse button in it and select textured then you should see your model with a texture!!!
Repeat this step to all the groups. When you have done this the only thing we need are wheels.
We will make them by making a cylinder in the model tabs with 1 stack and 12 or 8 sides, pick for yourself.
You need to rotate it, Use the rotate button in the models tab and rotate it 90 degree on the x axis.
Now duplicate your wheel with the duplicate selection tool and move it to the other wheelcase. Then select your first wheel, it should be in the groups tab as cylinder1.
Duplicate it again, and select mirror left right. The materials for the side of the wheel is the trk2_side texture and for the tread of the wheel it is trk2_tread. You should be able to group it by yourself now.
The very lasy thing to do is to make a 'bone' for the model.
Go to the tab models and select joint. Make it at the most bottom point of the wheel. We only need one.
We need to assign all of our vertexes to our bone/joint so select all the vertexes and go to the joint tab. Then select assign because it should be automatically on the joint you created.
Now all of your vertexes/groups/faces are assigned to the bone/joint.
To compile our model we should place all the textures in the same map. I always keep it together so that is not a problem.
Go to file/export/half-life smd and save it as hlcar_reference.smd.
Then it will ask you to save it as a sequence or a reference, pick reference.
The final thing to do is to save it as a sequence. repeat the last steps and save it as idle.smd and a sequence.
The model should be ready to be compiled. Save your work.
Now go to tools/half-life/generate qc file.
The qc file will be used to grab the animations and textures for your model.
To set it up I will place the 2 qc files I used in the download. It should make it clear how to set it up.
To edit the qc file go to:tools/half-life edit qc file.
original qc file:
// Output .MDL
$modelname "C:\Mijn documenten\Mijn afbeeldingen\hl car\hlcar2.mdl"
// Directory of .SMD
$cd "\Mijn documenten\Mijn afbeeldingen\hl car\"
// Directory of .BMP
$cdtexture "\Mijn documenten\Mijn afbeeldingen\hl car\"
$cliptotextures
// Write textures into a ???T.mdl
//$externaltextures
$scale 1.0
// bodygroups: use relative path from $cd
$bodygroup body
{
studio "./reference"
}
// sequences: all sequences are in $cd
$sequence seq-name "sequence" loop fps 30 ACT_IDLE 1
My qc file to compile the model
:
// Output .MDL
$modelname "C:\Mijn documenten\Mijn afbeeldingen\hl car\hlcar.mdl"
// Directory of .SMD
$cd "\Mijn documenten\Mijn afbeeldingen\hl car\"
// Directory of .BMP
$cdtexture "\Mijn documenten\Mijn afbeeldingen\hl car\"
$cliptotextures
// Write textures into a ???T.mdl
//$externaltextures
$scale 1.0
// bodygroups: use relative path from $cd
$bodygroup body
{
studio "hlcar_reference"
}
// sequences: all sequences are in $cd
$sequence seq-name "idle" loop fps 30 ACT_IDLE 1
This should be self explanatory. When your done editing your qc file you need to save it.
When everything is set up right and ALL your files are in the same folder you should compile your model.
Do this by going to tools/half-life/compile qc file. When you have done everything right it should generate a .mdl file in the selected map. When your texture size/format is not good milkshape WILL crash.
This should cover most of the basic things of compiling a Half-Life model and texturing it.
If you have questions feel free to ask them in the forums.
The textures are copyrighted by Valve. 1998-2004 feel free to look at the model and mess with it I included in the Modeling Zip. It should give you some direction how to make it all.
How To: Cut up blueprints for use in Milkshape
Softimage: XSI