Custom Props: Part 1
by ReNo (view all articles)
for Half-Life 2 » Modelling
updated Fri Apr 8th 2005 at 7:45pm
by ReNo (view all articles)
for Half-Life 2 » Modelling
updated Fri Apr 8th 2005 at 7:45pm
Introduction
Props are a hugely important part of source engine level design, and make up a significant proportion of the detail found in most maps. While Valve have provided a large number of useful models with which to populate your levels, sticking with the stock props alone is sure to restrict your choice of themes as well as making it more difficult for your map to stand out from the crowd. Learning to create your own might seem a daunting prospect, but I hope with this set of tutorials you will see that it is well within your grasp.
As a disclaimer of sorts, I would like to mention that I am learning while I write these tutorials. I have not been modelling for long, and as such the techniques and approaches I use in creating props might not be the most efficient or effective. If you are reading these tutorials and notice any areas that could be improved, or would like to offer alternative approaches, please do so in the comments section.
Part 1: Modelling in Milkshape
The first step in creating a prop is to build your model. There are many programs out there that can be used for this, including 3D Studio Max, Maya, XSI, and Blender. My package of choice is Milkshape, which is a simple to use program that is ideal for prop building. The trial version, which is fully featured and lasts for 30 days, can be downloaded from their website (http://www.milkshape3d.com/) . If you decide you like it, you can then buy it for only $25, which is really a token charge if you plan on using it frequently.
As Milkshape is the only 3D modelling package I am proficient in, I will discuss the process of building a model in it only. Most other modelling packages will have comparable facilities and it may be possible to use the same techniques I discuss if you are using one of them. It is also quite likely there will be faster ways to create the same model using these other programs, but it is on your own head to research these. I am not going to claim that this tutorial will cover all there is to know about modelling in Milkshape either, I am simply going to go through some examples which should help teach you what can be done. If you are serious about gaining skill in 3D modelling, I suggest you read up on dedicated modelling tutorials, and most of all - practice practice practice!
Before you attempt this tutorial I suggest you familiarise yourself with the complete basics such as camera movement, primitive creation, object selection and the like, as I won?t be covering these in much, if any, detail.
The model we are going to build is a simple security camera you might see in any number of scenarios. It is always a good idea to find some reference pictures before placing any polygons, so go visit your friend and mine, Google image search, and find a suitable picture. After a little searching I found this image, which will serve as our design reference.

Now?s the time to crack open milkshape! I?ve decided to begin by modelling the frame of the camera, and the first step will be to place the vertices that shape the wall bracket. We could do this by simply placing a box object and scaling it, but this would not give us the bevelled corners. Instead select the vertex tool (F5) and place them in a bevelled rectangle shape on the front view, in a similar fashion to the reference image. Think of vertices (the plural of vertex) as the corner points of a 3D object. If you set the 3D viewport to ?Flat Shaded? and ?Wireframe Overlay? mode, you should have something similar to the image below?

At this point you may be somewhat perturbed by the fact you aren?t working to a grid in quite the same way you would with hammer. Instead we align our vertices with one another on each of the axis. To do this, select however many vertices you wish to align and collapse them on an axis by pressing ?ctrl -> shift? and the corresponding letter. For example, select the two vertices making up the left hand side of the object, and press ?ctrl -> shift -> x? to align their X coordinates. Now select the two top vertices and align them on the Y axis by pressing ?ctrl -> shift -> y?. Do this for all the vertices that should be aligned, and if you feel any of the vertices need to be moved on one axis, then you can do so without hurting the alignment of another axis by deselecting that axis in the move tool?s (F2) options. You can toggle each axis being turned on or off by using 1, 2, and 3, which correspond to the X, Y, and Z axis respectively.
Once you are happy with the way the vertices are arranged, select the face tool (F6). This lets us create a face (polygon) by selecting three vertices to link up. On the front view, begin by clicking the bottom left vertex, then click the bottom right, then the top right. This should result in a polygon being drawn. Next click the top right, then top left, then bottom left, and it should give you another polygon, completing a square. Note that you created these faces by selecting the vertices in a counter clockwise direction, while selecting them in a clockwise order would mean the face would be pointing backwards ? a useful feature, but not one we care to make use of just now. Continue by adding faces between the remaining vertices, and you should end up with something like the image below?

Now we have the basic shape, but we need to give the fixture depth. To do this we will make use of the extrude tool, but before we can use this we need to select the faces we have just created. We can do this by going to the select tool (F1) and changing from Vertex (1) to Face (2). You may also want to select the ?by vertex? option, which means you can select vertices and all the faces which use those vertices will be selected. After selecting all the faces, switch to the extrude tool (F7), and uncheck all the axis options except for Z. Now on the side view, drag the faces to the right and you will see that new faces are created along the sides of the extruded faces. If you dragged left, then your original faces would be behind the new side faces, which isn?t what we want. You should now have roughly what is shown here?

Moving on to the main support arm, we can see that a box would be a fitting primitive to use. Using primitives such as the box saves us the time of placing all the vertices and creating faces manually, though they do often require tweaking in order to make them suitable. With the box tool selected, draw a square on the front view that relates to the support arm in our reference image. Once this is as you want it (you may need to move some vertices or use the scale tool (F4) to get it the right size), move the vertices on the Z axis using the side view to get it roughly the right length. Align the start of the support arm with the vertices that make up the front of the wall plate by collapsing on the Z axis with ?ctrl -> shift -> z?. Hopefully you should now have something like below?

If you rotate the 3D view around to behind the wall plate, you will see that the support arm has 2 polygons facing into it which will never be seen. These still contribute to the polycount however, so for performance reasons it is in our best interests to delete these. To do so, use the selection tool (F1) on face mode (2) with ?by vertex? turned on. On the side view, select the two vertices on the left of the support arm, and then hold shift and right drag a selection box on the right hand vertices. This will leave you with only the two hidden faces selected, and you can then get rid of them by simply pressing delete. Remember to do this whenever you have faces that aren?t going to be visible, and it will ensure your models are more efficient in their polycount.
Next we will move onto the camera itself, but before you dive in and throw down some polygons you should be aware that the reference picture is not going to be a precise guide. In it, the camera is facing in a tricky direction and this would be both difficult to model and harder to animate. We will instead be building the camera as if it were facing straight along the support arm.
If we take a look at our reference, we can see that it is essentially a rectangular box with some curvy metal in front of the lens. To begin with then, we shall build another box primitive to stand in for the majority of the camera. After doing this, delete the front two faces of the camera, as we will be adding further detail to this area. The result should be something along these lines?

Now we will build the front of the camera, beginning with the lens. First of all place 4 vertices around the inside of the current rectangle on the front view. The bottom two of these new vertices should line up with the bottom of the rectangle, while the others should all be slightly inside. All 4 of these vertices should be flush with the front faces we deleted. I?ve probably not explained this particularly well, so here is another screenshot showing the new vertices selected (i.e. In red).

Place another set of four vertices in a square on the front view, again inside the ones you just created. Link these up with the previous four and you should have a square with a hole in the middle of it, sat slightly inside the outer shell of the camera that we created with the box primitive but resting on its bottom line.

Do one more inner square and link it up with the one further out, and then close this one off by creating two faces within the square. If you indent this a little on the z-axis, and you should have a reasonable looking front lens to the camera. After playing around with the vertex placement a bit (and remember to collapse vertices on the various axis to keep things aligned), I ended up with this?

Next up we need to build the lens guard, which is probably best done by manually placing some polygons due to its non-primitive shape. I will take this opportunity however to show you a useful tool you may not otherwise notice ? extrude edges. We will use this tool to get the faces at the top of our lens guard, so select the top two vertices you can see on the side view at the FRONT of the camera only. This should select the top four vertices that you can see on the front view of the camera. Now go the vertex menu and select ?Extrude Edges? from the drop down list. Ensure you have ?Manual Offset? selected?, and set all the ?Man Offset? settings to 0 except for the Z axis, which you should set to something like 10. Feel free to experiment with the other settings, but for now this is all that we need. Click ok, and you should have four new polygons created for you, extruded from the edges that the vertices you had selected lay on.

Link up the front of these new faces with a couple of polygons on the front view, and we will then shape the lens guard. To do this simply place a few vertices down the side view in a suitable curve, linking the top of the lens guard up with the bottom of the camera. Move these vertices to line up with the left hand edge of the camera on the front view, and join up the corners of the camera, the top of the guard, and the curve of vertices, with more polygons. My efforts resulted in the following?

Select the new faces you just made from this curve and duplicate them by going to ?edit -> duplicate selection?. Being sure not to deselect these duplicated faces, move them on the X-axis so they are in line with the left of our lens faces, as these will serve the purpose of being the inside faces of the guard. Unfortunately you will notice that these polygons are facing the wrong way and so invisible from the perspective that we want them visible. This is easily fixed by going to ?face -> reverse vertex order? while they are selected. You will also have to move the top vertices of these duplicated faces down a little in order to line up with the inside of the top of the guard. Use the face tool to link up the inside and outside of the guard on the front view, and you should have complete one side of the guard, as below?

We will now clone this and flip it in order to use it on the opposite side of the camera. Switch to the face mode of the select tool (F1 -> 2) and select all the vertices in the middle of your guard curve. This should leave you with only the faces we wish to duplicate being selected. Duplicate these (ctrl -> d) and use ?vertex -> mirror left to right?. This should put the new side of your guard in pretty much the correct location, but use your axis alignment shortcuts to ensure everything is correctly placed. With this done, the last step in building the actual camera is to weld all the vertices that lie in exactly the same location together. If you have aligned everything properly (and this HAS to be exact, not just roughly the right location) then select all the vertices on your camera and go to ?vertex -> weld together? or press ?ctrl -> w? If you switch to smooth shaded view before doing this, you can ensure it has worked by watching your camera?s smoothing change. With a little tweaking you should now have quite a reasonable looking camera, kind of like mine?

We?re now going to create the bracket that holds the camera onto the support arm. Begin by placing a simple box near the end of the support arm, and on the front view, move the vertices sideways so that the top two are horizontally lined up with the width of the camera, and the bottom two are extended out a little further. Select the faces that make up these newly bevelled edges, and switch to the extrude tool (F7). Ensure only the Y axis is enabled in the tool?s options, and drag the faces up vertically until they are just below half way up the main body of the camera. Now flatten all these vertices on the Y axis (ctrl -> shift -> y), as well as horizontally aligning all the inside vertices of the bracket with the outside vertices of the camera, and you should have a rather primitive, but ultimately good enough, bracket.

The bracket doesn?t look wonderful in its current guise, so to improve it we can easily add in a couple of screw style fixtures to make it look more connected. The simplest way to do this would be to make use of the cylinder primitive. Select it and you will be given 3 tool options ? stacks, slices, and close cylinder. More information on these options can be found in the Milkshape help file, but suffice to say that stacks are the number of vertical sections in the cylinder, while slices are the number of cuts that determine how ?round? the cylinder is. Close cylinder lets you chose if you want extra faces created to seal the cylinder at the ends. For our needs, we will want a single stack, with only 6 slices, and closed. This will allow our ?screws? to look quite industrial and bolt like, as well as keep our polycount to a minimum. On the side view, drag a cylinder from slightly above the top of the bracket base, diagonally down the slightly below the bottom of the support arm. This will create a nice cylinder of equal proportions. Move it to position as you like and vertically scale it to look as ?right? as you can manage.

Duplicate the cylinder by selecting its faces (be sure to select the faces at BOTH ends!) and pressing ?ctrl -> d? as before. Now use the rotate tool (F3), and enter 90 into the Z axis option. Now press the rotate button to the side of the options and your cylinder should be rotated. Switch to the move tool and shift the new cylinder on the Y-axis to line up with the part of the bracket that touches the camera. Move the closed ends of this cylinder outwards on the front view so they protrude from the sides of the bracket, and you should have a reasonable looking security camera?

The only thing missing now is the wire, but the one from the reference image is really rather complex and while possible to model, would be hell to animate. Instead we will create a far more basic wire that curves from its actual location on the wall frame, to a central location on the underside of the camera. Change the cylinder tool?s options to 6 stacks, 8 slices, and not closed, and place it running from the wall plate to underneath the centre of the camera. Now select the vertices make up the cross sectional circle nearest to the wall plate. Using the scale tool, increase the size of this circle uniformly on the X and Y axis. If you then move the next cross sectional circle closer to it, then you will have a connector of sorts between the wire and the wall plate.

Move the other circular segments vertically, and rotate them on the side view, so that your wire takes on a reasonably natural looking curve. With the final section, move the circles so that they are INSIDE the main camera (around the area of the screw that passes through it), as when we get on to animating the camera this will reduce the deformation visible in the wire.

As a final touch, I added some more simple 6 sided, single stack cylinders against the wall plate to act as some fixtures, remembering to delete the polygons facing the wall plate itself. As a further optimisation, select all the vertices of your model and go to ?Vertex -> Weld Together? or press ?ctrl -> w?, and this will ensure any duplicate vertices that lie in exactly the same place are welded into one.

And there you have it - a reasonable looking security camera, using a respectable 344 polygons. It doesn?t look exactly like the reference image, but given that people playing your level don?t know where the design came from, all that matters is that it looks good enough, not that it is accurate.
In future tutorials I will use this model to demonstrate animation, unwrapping and skinning, and compiling for use in a source engine game. For the time being, I hope this has given you some insight into how to use Milkshape to create some simple props. Feel free to leave comments, questions and suggestions below.
If you would like to take a look at my version of the model in ms3d format, you can download it here...
http://www.snarkpit.net/pits/reno/tutorials/props1/security_camera.zip