Tutorial: Modelling for goldsrc with Blender - Part 1 Last edited 1 year ago2023-11-25 12:10:20 UTC

Part 1: Creating a static prop

This tutorial offers mostly just an introduction to modelling for goldsrc.
It's highly recommended to supplement this tutorial with general modelling guides for Blender, such as Blender's own documentation, and look up concepts such as topology and UV mapping.
We'll be using Blender 3.5 for this tutorial but all of this should apply to any 3.x version.

This is the first part in a series of tutorials I'm planning to write on this topic.
We will being by making a simple mesh, texture it and export it to a .smd which we can use to compile a static prop model.

Section 1: Setup

Start out by opening Blender and creating a new general file. Select all in the scene (hotkey: A) and either hit X or the Delete key. It's a Blender tradition to kill poor ol' Default Cube, and we're not going to need the Light or Camera anyway.
User posted image
Now let us adjust the grid and units to something more appropriate for goldsrc. Hit Viewport Overlays and under Guides set Scale to 8.0 and Subdivisions to 4. This places a line on the main grid on every 8 units and thinner subdivision lines on ever 4 units.
You may choose to use a subdivision of 8 instead, then these will be placed on every unit instead.
User posted image
You may notice Subdivisions is greyed-out but that's because the scene's Unit System is set to either Metric or Imperial. We'll want to change that to None so find the Scene Properties menu, open the Units tab and change Unit System to None.
(You might or might not have noticed the search bar at the top of this pane. It can be used to search for any property you're looking for.)
User posted image
Great! Now we're done with setting up our scene and we're ready to make our first goldsrc model in Blender!

Section 2: The Mesh

When making a model from scratch it often helps to start with a primitive shape roughly similar to what you want to create. If you want to make a pipe, start with a cylinder. A stone or pebble, then start with an ico sphere. In this tutorial we're going to make a detailed version of a crate from Half-Life, so we'll start with a cube.
User posted image
Since we made those preparations in the previous section, our units will correspond 1:1 with game units. The crate will be 64x64x64 units, so we can input that directly. Click Add in the toolbar at the top of the viewport, followed by Mesh and finally Cube.
Before you do anything else there's now a dialogue at the bottom-left of the viewport. It's often collapsed by default so it's easy to miss it. Expand it and change Size to 64.0. We may also set Location Z to 32.0 so our crate is now resting on the "floor" (this places the origin at the bottom of the model which makes it easier to place in a level editor later).
User posted image
Of course, this is modelling and so we're not required to stay on-grid like in a level editor, but this can be useful to, for example, set up references to get the scale right. If you want to create something roughly the height of a human, then make a reference cube with size 72 and offset Z by 36 units.

Now that we have our primitive ready, we can start to shape it. As this tutorial is not about teaching you how to model, this is the part where you either look up general modelling guides or just play around and experiment for yourself. If you choose to do the latter, select the cube and change interaction mode from Object Mode to Edit Mode.
User posted image
From here you're able to manipulate the various vertices, edges and faces of your mesh.

Section 3: Materials

No model is complete without its textures. I assume you're aware of the goldsrc texture format and limitations. If not, the short version is that they need to be 8bpp .bmp files, dimensions must be multiples of 16 (although powers-of-two is preferred) up to a maximum of 512x512, there's no soft transparencies but you can use additive rendermode to get something similar, hard transparency can be used by marking transparent areas with the index #255 colour of the palette and using the masked rendermode, and chrome rendermode enables matcap rendering.

In Object Mode, select your mesh object and find the Material Properties menu. Add a new material and name it exactly the same as the texture file you will be using, including the extention. Here we're using crate03.bmp extracted from halflife.wad. Expand the Surface tab and find Base Color. Click the little yellow circle and hit Image Texture. Now directly underneath Base Color you will have the option to Open a file, so click that and find your texture file.
User posted image
User posted image
To preview your model with its shiny new texture change the Viewport Shading to Material Preview Mode near the top-right of the viewport. It may be a bit too shiny even, so while still in the Surface tab find the Specular property and turn it all the way down to zero.
User posted image
Sometimes the texture may end up looking offset, rotated or distorted. In these cases you will need to unwrap the UV for those faces. In a simple case you can just select those faces in Edit Mode and hit U to open the UV Mapping context menu. Either try out the various options and see what they do or read up on them. For more advanced cases you might have to change to the UV Editing layout and manually edit the UV mapping, but how to do that is outside the scope of this tutorial.
If you want to apply different textures to different faces, change to Edit Mode and select the faces. With the faces selected, find the Material Properties menu and create a new material just like above. Then hit Assign to assign that material to the selected faces.
User posted image
NiceNice

Section 4: Export

While working on the model you may have done various transformations to the object. We need to apply these as otherwise those transformations will be undone in the exported model. Select all, go to Object, Apply and All Transforms, or use the handy hotkey combination: A -> Ctrl+A -> A.

All that remains now is to get it into a format that can be compiled into a goldsrc studio model.
For that we will be using Blender Source Tools, a free addon for Blender (don't let the name fool you, it has goldsrc support).

Make sure the model is within the limits (I doubt you've surpassed them already but always good to make sure).
From Viewport Overlays enable Statistics and it should show up in the top-left of the viewport.
User posted image
In goldsrc you're limited to 2048 vertices (or 4080 triangles) and a limit of 2048 vertex normals per .smd file. There's also a limit of 128 bones, but we'll worry about that in the next part of the tutorial.
If you somehow go above the limits you will have to reduce the number of triangles somehow. The Decimate Modifier is an easy way to let Blender do it for you although it might mess up your topology. As the above limit is just per .smd file, you may also cut up your mesh into multiple submodels that each are less than 4080 triangles. A single goldsrc studio model may contain a maximum of 32 such submodels.

Alright so with that out of the way find the Scene Properties menu. With Blender Source Tools installed there should be a new tab in there, Source Engine Export. Expand it and set the Export Path where you want the .smd file to end up. Make sure the Export Format is set to SMD, Target Up Axis is Z and Target Engine is set to GoldSrc. No need to worry about Engine Path.
Now hit Export and it will ask you which collection to export or if to export the whole Scene. If you only have the one collection it won't matter which you choose. If you have several then either pick one of them or choose Scene to export each collection as its own .smd (this is how you can set up submodels in Blender, by the way).
User posted image

Aaaand we're done! All that remains now is to make a .qc file and compile it and for that The303 has written an excellent guide for.

In the next part we will look into creating a skeleton for our model (coming soon).

3 Comments

Commented 1 year ago2023-05-24 11:10:48 UTC Comment #105287
You don't need to set to subdivsions to 4, you could use 8 (then first level subdivision is 1 unit each) but I will recommend using powers-of-two for the subdivisions if you want to have some relation to ingame units. Or you can choose to not use subdivisions at all, up to you.

The grid scale has nothing to do with unit scale, so using the $scale 8.0 .qc option will make your model 8 times larger than intended.
Commented 3 months ago2024-09-10 16:12:19 UTC Comment #106383
Thank Erty and the Almighty for map2prop, one can now make prop models entirely in jack/hammer and never have to touch Blender :)
Commented 3 months ago2024-09-10 19:29:57 UTC Comment #106385
One might think I wrote Map2Prop just to avoid writing Part 2 of this tutorial, BUT actually
a) it's been a very busy year since I wrote this tutorial
b) I'm tired
c) Part 2 is going to be about rigging and basic animations and M2P can't do that, so I'll have to write that at some point anyway 😔

(Also that previous comment from me above was in response to a now-deleted user, sorry for any confusion it might have caused) :p

You must log in to post a comment. You can login or register a new account.