IntroductionWhat do I mean by "sculpting prefabs"? Well let's look at each word individually. Sculpting is when you take a material, and manipulate it, so that it may form a desired shape. A prefab is a term used for a brush / group of brushes in VHE, which are saved in a library with a name and description. The default "prefabs", which can be found when going to brush creating mode:
and selecting a desired brush category in the drop down box:
Categories include computers, crates and more. You can now probably deduce, that "sculpting prefabs" is about taking a single brush and dividing / plus clipping it until you have molded it into your desired shape. Then, saving it in your list of prefabs for usage in your maps. Sound interesting? Then read on!
ContentsThis tutorial has four different parts to it:
- Attaining template textures - setting up textures as a base outline for your prefabs
- Sculpting in a single 2D view - using one view in VHE to mould the side view of your prefab
- Sculpting in all 2D views
- turning it 3D by moulding the prefab in all views
- Optimisation - making sure the prefab keeps compile times and r_speeds to a minimum
- Finishing off
- filing your prefab and conclusion to this tutorial
1. Attaining template texturesSo our first step in this tutorial is to attain the textures we would like to use for our prefab. We will be moulding our prefab according to each texture, so it is important that you use entire images for each side of your prefab. Here is an image of my textures to show you what I mean:
As you can see, I'm going to mould out a truck. All the images that I need are there. The important ones are the side, front and back views. The top and bottom ones aren't so important unless you'll obviously be able to see the tops and bottoms of your prefab when they're placed in your maps. Cylinders are an exception, which are a waste of time to mould out. You can just create a standard cylinder shape, by setting your brush type to "Primitives -> cylinder". Note I: I got all the above textures from a brilliant website called CG Textures. Check it out! Note II: If you're wondering how to get textures of your own into Hammer, I made a tutorial about this which you can find here:
2. Sculpting in a single 2D viewNow that you have attained your textures, we can begin sculpting our prefab. First, draw out a single block with the correct scaling and dimensions of your desired prefab. Apply the SIDES of your brush with the side view texture in your library, and fit the texture onto the side to check if the scaling is correct. It's also a good idea to add a player spawn and compile the map, just to make sure that the prefab won't end up too large or too small.
Now, use the clipping tool, and divide up the brushes where there are any concave shapes (A shape which "caves-into" the original brush, like the space for a set of wheels in a car).
The final outcome of mine looks like this:
You can see that the initial block shape is still there, but now, it's been divided up into segments according to the concave corners of the texture (vehicle). The next step is to get rid of unneeded block segments, and clip the segments according to the convex shapes of the truck. Convex is exactly the opposite of concave, and includes all the extruding points. After doing this, you should get something along the lines of this:
It's taking shape now, although only in the side view. Once we're happy with our prefab in the side view, we can move on to:
3. Sculpting in all 2D viewsWe'll begin this chapter by setting our focus on the front view of our prefab. In my case, it's the front cabin of the truck. Get your front texture and fit it on all the frontal sides of your prefab. Remember to put a tick in "treat as one", or else the texture will be fitted in each individual segment. You want the texture to fit accross your selection of sides. Doing this will produce something like this:
Now, use vertex manipulation in the front view to fit your shape into the frontal texture. Remember that "invalid solid structures" are created when a single brush has a concave corner. Simply split the brush into 2 seperate brushes to fix this, like how we did when splitting the concave shapes in the side view. I did a fair amount of vertex manipulation, and even had to create additional brushes - don't be scared to add extra brushes and move around existing ones to get a realistic mould. It's important to make the object as realistic as possible.
Now that we've done the front side, lets now work on the rear side of our prefab. Again, use vertex manipulation, and create additional brushes if necessary until you're happy with the result. It can be hard to texturise every single side, so try to find some plain, generic textures that are of similar colour and material. Here's the backside complete now:
Now, just make sure everything looks okay in the 3D view and add any details you would like with new brushes. With vehicles, it's good to leave the wheels until this stage, as they aren't difficult to texture, and can be made with a single cylindrical brush. Next, align your textures up, and try to get them to touch as seamlessly as possible. If you think the dimensions of your prefab aren't nice, you can scale the model by going "Tools -> Transform" and select "Scale". Remember to turn "texture lock" on to keep the textures aligned. Here's the final prefab of mine:
4. OptimisationOptimisation can mean many things can't it? In this case, I'm talking mostly about the usage of the texture "null". It's an essential part of mapping with VHE, so if you don't know about null, I'll tell you about it now. Otherwise, read on to the paragraph after. Null is a texture which can be painted on brushwork like any other.
It has no display image, but when it is applied to a face, the face will turn black and have a blue repeating pattern of the letter "N" all over it. Any face that is painted with the null texture will not be rendered by all of Hammer's compiling tools. The compiler will still set it as a solid face, and the player may not pass through it, but it won't be drawn. This is the main reason for using it. Simply put, it's an invisible texture. Any faces that won't be seen at any point in the map should be "nulled". Not only does this improve on r_speeds, but it also quickens compile time.
So what we're going to do now is select every part of our prefab, then go to the textures library and find the texture named "null". Apply it to every single brush. Don't leave any faces untouched! They all must be nulled!!!!! MUHAHAHHA! Now, simply select all the faces of one side of your prefab, and set them back to their original texture. Make sure not to edit the scale, rotation or position of the texure, or else the texture will go out of alignment.
Repeat this for all sides of your prefab until you cannot see anymore null textures. By doing this, all the unseen faces of your prefab will not be rendered as 3D shapes. You can verify this by moving the 3D camera inside your prefab. When you're inside, you'll see all the hidden faces that have now been nulled.
That's the basics of optimisation. There are a few other techniques, but this one makes the largest difference. It'll be very noticeable, especially when you're using multiple prefabs.
5. Finishing offSo your prefab is ready! But wait... you can't just copy and paste it into your map! The final step is to save your prefab in a library. First, go "Tools -> Prefab Factory". A pop-up box should appear looking like this:
Now, simply click "Add Library", and name it "Myprefabs". Close the interface and select all the brushes in your prefab. Go to "Tools -> Create prefab" and give your piece a name and description. Use the drop down box and select your "Myprefabs" folder. (You don't have to create your own folder, but I've noticed that prefabs created in the default folders tend to "disappear" or be removed, and if you haven't saved them as RMFs then you've lost it forever.)
And, this concludes the tutorial! This method may be a little sloppy at times, but it's very easy to do, and can act as a base for you to make realistically proportioned prefabs. I hope you found it of some use, and that it will aid you in your future prefab making tasks. Chow! And here's the final product in-game: