Creating Custom Props


Published 09.03.2019 в 06:00 | Guide rating: 91



Introduction

Welcome! The world of gaming has changed.
Thanks to Valve, amateur developers can now get paid for making custom content.
Isn't that awesome? For those hoping to jump on that opportunity, it's not too late to get started.
My goal for this guide is to teach the basics of creating custom models, or props, for Counter-Strike: Global Offensive (CSGO) by covering the steps necessary to get your content working like it should.
To appeal to the largest demographic, this guide focuses on two things: Preference towards free, easy to use programs.
A minimalistic approach -- why use three programs when you could be using one?I encourage that, after you complete this tutorial, you expand and seek out others to continue your education.
Or, if you're an established developer (amateur or professional), feel free to comment or message me your own tips and tricks of the trade -- I like to learn too! Who is this guide for? Are you at all interested in creating custom props for CSGO? Or looking for relevant information that might apply to other Source games? If so, this guide is for you.
If not, I would question why you're here but your business is your business.
Whether you're a beginner or an experienced developer, I like to think that everyone can learn something from the information provided.
Do I have to read your tutorial? No, of course you don't have to read my tutorial.
There are others on the internet that you can follow and learn from.
Many people, including me, did.
However, none that I found gave the whole picture.
It required quite a bit digging, testing, and plain old question asking to learn what I know.
My goal for this guide is to collect much of this information into one resource that can be followed from beginning to end.
So, basically, your techniques should be the best? Who's to say which method is better than the other? Once you learn the basics, you'll discover that there are many different tools that will do the job.
Different modeling programs, different graphic design programs, different ways of compiling the prop -- it's all up to personal preference.
Are you a professional? To be clear, in no way am I a: Video game developer - Please question my techniques and procedures.
Computer technician - Don't trust that I know what's best for your computer.
Lawyer - Any legal advice should not be assumed accurate.
Doctor - This isn't the place for medical advice.
In short, use your common sense and follow this guide at your own risk.

Getting Started

Basics Before we begin with the details, it's important that you understand what creating a prop actually entails.
All props are created using two basic entities: Models and Shaders.
Both are comprised of different files and both play an important role.
Models Models create the 3D prop.
Reference Mesh: The model that players see in-game.
Collision Mesh: A low poly version of the reference mesh that the Source Engine uses to calculation physic collisions.
Sequence Mesh: The animation, or lack of, used by a prop.
Static props still require a sequence.
QC Script: A text document containing a very simple script specifying where the Source Engine can find the necessary prop files.
Shaders Shaders affect the look of the 3D prop.
Texture: An image used to add color to the prop.
Material: A text document containing a very simple script specifying where the Source Engine can find the texture and how the model reacts to light.
Compilation In order for the Source Engine to recognize the all the model information, it must be converted using a compiler.
Then, after adding the shader, you can play with your custom prop in new maps created with the CSGO SDK! One way to look at all this is with a basic equation: 1) reference mesh + collision mesh + sequence mesh + qc script = model 2) texture + material = shader 3) (model * compiler) + shader = prop available in SDK

Programs

Essentials My goal for this tutorial is to include as few programs as possible.
Those that I do recommend should be both free and user-friendly.
Finally, if you're hoping to make money off of your work then we should find programs with licenses that may allow for that! There are five essential types of programs required to create a prop: A 3D modeling program equipped to export .
SMD files.
An image editing program equipped to export .
VTF files.
A text editor to create .
QC and .
VMT files.
A compiler that converts .
SMD to formats readable by the Source Engine.
An SDK to create a custom map in which to place the prop.
Generally speaking, any program that meets those criteria is a valid option.
If you prefer one over the other then why not use the program you're familiar with? Just follow the tutorial and take my advice where applicable.
After all, this guide is meant to serve you -- you are not to serve the guide! But, if you do choose a different program, can we just agree that you will not send me angry troubleshooting emails? Otherwise, if you want my recommendations then I would suggest the following: 3D Modeling Blender[www.
blender.
org] : Developed by the Blender Foundation, Blender is a popular 3D modeling program because it is both free and open source.
Tutorials are plentiful and it holds a GNU General Public License.
Blender Source Tools: A required plug-in that allows users to export using the .
SMD extension.
Image Editor Gimp[www.
gimp.
org] : Developed by The GIMP Development Team, GNU Image Manipulation Program is a graphics editor that is also both free and open source.
Like Blender, GIMP holds a GNU General Public License.
A necessary plug-in to export .
VTF files can be found on the Valve Developer Community Wiki.
Text Editor Notepad++[notepad-plus-plus.
org] : An extremely easy-to-use, free source-code editor that holds a GNU General Public License.
If you prefer not to download this then know that any text editor should work, including those that come with Windows like Notepad and Wordpad.
Compiler You can avoid downloading an extra program by creating a batch file.
To do this, simply create a text document and paste in the following code: "C:\Program Files\Steam\SteamApps\common\Counter-Strike Global Offensive\bin\studiomdl" -game "C:\Program Files\Steam\SteamApps\common\Counter-Strike Global Offensive\csgo" %1 pause After correcting the paths, if necessary, save the document as "studiomdl" and then manually change the extension to .
BAT.
You may get a warning that the file will become corrupt -- change it anyway.
Additional information about the batch file can be found on the Valve Developer Community Wiki.
Alternatively, Crowbar is a community developed Source Engine modding tool that can be used to compile .
SMD and .
QC files automatically.
SDK Last but not least, the Counter-Strike: Global Offensive - SDK contains the official map making and model viewing tools from Valve.
The specific program to create custom maps for all current Source games is called Hammer.
To install, open Steam, click Library > Tools and download the SDK.
Summary Are things starting to get confusing? Recognizing all these file types can initially be quite overwhelming.
I've created to chart to help make this easier to understand: NameEditorExampleReference MeshBlendermodel.
smdCollision MeshBlendermodel_ref.
smdSequence MeshBlendermodel_seq.
smdQC ScriptNotepad++qcscript.
qcTextureGIMPmodel.
vtfMaterialNotepad++model.
vmt

Creating the Model

Setup Now that you understand what we're doing, it's time for you to learn how to do it.
For that, we'll start in Blender to create the reference and collision meshes, then I'll tell you a shortcut for creating a sequence mesh.
Open Blender and begin setup: You can work in either Blender Render or Cycles Render.
Delete the Sun and the Camera.
They aren't needed when creating props and can cause issues when importing .
SMD files.
From the Scene tab, set units to metric.
One meter in Blender is equal to one unit in Hammer.
Under the same tab, find the "Source Engine Export" panel to confirm that you correctly installed the plug-in.
Configure it accordingly: Export Path: Set it to desktop or wherever preferred Export Format: SMD Export Up Axis: Z Engine Path (modify if necessary): C:\Program Files\Steam\steamapps\common\Counter-Strike Global Offensive\bin\With Blender prepped, you're ready to begin modeling your meshes! Reference Mesh The reference mesh is the most crucial component of a prop.
It contains information about the UV map and skeleton, but most importantly it consists of the prop's rendered geometry.
This is, in large part, what people will see when they play your map.
This guide assumes that you're already familiar with Blender, or at least that you're able to follow outside tutorials.
So, rather than walking you through the basics of creating a model, I will only going explain the aspects most important for our purpose: porting the mesh into the Source engine.
As you build your model, keep the following in mind: Organize your topology.
Don't make LODs -- CSGO does not use them.
Use smooth/flat shading where applicable.
The creases are visible in game.
Subdivide extremely large polygons to enhance per vertex lighting.
In the Outliner panel, rename your mesh.
This name should be unique to the model and will be used throughout the guide.
Ultimately, the amount of detail that you include in the model depends on what it will be used for.
It's your responsibility to choose a balance between optimization with aesthetics.
To add some perspective, Valve's props tend to be approximately 1000-3000 triangles.
Weapon and character models are 4x as much, however, so you have some room to expand if necessary.
In total, the bell contains 1,042 triangles.
I want to emphasize scale.
Remember, one meter in Blender equals one unit in Hammer.
But just how small is a single Hammer unit? Object Hammer Units Player Height (Standing) 73 Player Height (Crouching) 55 Jump Height (Standing) 55 Jump Height (Crouching) 64 Player Width 33 Average Wall Height 128 Average Door Height 108 Average Door Width 48 This means that, for your prop to be as tall as a character in CSGO, a prop would to be 73 meters in Blender.
Wow! Understanding this relationship between Blender units and Hammer units is especially important when creating props that will fit precisely along Hammer's brushes.
If that is the case: To avoid gaps or overlap you will want to make sure that the vertices placed along brushes are snapped to the one meter grid before exporting from Blender.
In addition, you will also want to move the origin of the model to the center of the 3D field in Blender to ensure that it's on grid as well.
The origin is used as the prop's point of reference in Hammer.
After building the model you will need to texture it.
This requires two steps: Unwrap the model on a UV map.
In the Material tab, create a new material and give it the same name as the mesh.
The Source Engine will search for a material matching this same name.
When you're happy with the model export it as a .
SMD from the Scenes tab.
Collision Mesh If your prop does not have a collision mesh then players can walk right through it! Assuming this is not desired, we'll have to add one.
Ideally it should match the reference mesh as closely as possible, but calculating physics can get costly so the collision mesh must be simplified.
Luckily, this is typically easier than creating the reference but there are some rules that make it tricky: The Source engine registers collisions as a group of 3D blocks.
These blocks must all be part of the same object but, to allow for concave shapes, should not be merged.
Collision models that are too complex won't compile correctly and will give you an error.
CSGO supports a max of 40 parts, or blocks, in the collision.
Reduce polygons where possible, especially along curves.
The blocks don't have to be cubes -- any 3D shapes are available.
Collision models in Blender and their in game counterpart in red.
Left: All vertices are merged.
This method is incorrect.
Center: Each block is separate.
Right: The separate blocks are staggered to enhance the effect.
To create the collision, it's typically easiest to duplicate your existing reference mesh as a new model.
This ensures that the collision will not be off center.
Then, rename it by adding “_ref” as the suffix.
Next, optimize the collision through the removal of nonessential vertices.
Plan ahead and decide how you will design the blocks to best match the object model.
Make sure each block has all its faces filled and finish by applying smooth shading to the entire model.
When you're happy with the collision export it as an .
SMD.
Sequence Mesh Remember that every prop, even one that is static, requires an animation.
Luckily, it's very easy to create a nonanimated animation (yes, you read that correctly.
) We're simply going to reuse the reference mesh during the compilation step.
This means that, if you're keeping on track with this tutorial, we're ready to continue! Complex models like a flag blowing in the wind or a wooden chair that breaks when you shoot it are beyond the scope of this guide.
But, for the simple static prop, this should be sufficient.
Summary Congratulations, the most difficult part is now over! Throughout this chapter I helped you create three essential components of a prop: the reference mesh, the collision mesh, and the sequence mesh.
Next I'll show you how to create the shader and then we'll complete the prop by compiling it! Cinque TerreCinque Terre

Creating the Shader

Setup With the model completed, we get to work on the shader! This requires a .
VTF image and a .
VMT text document to get working.
We'll be using GIMP and Notepad++ respectively to create them.
Texture The texture, also known as a defuse map, is an image used to add color detail to a model.
It can be created using real life photographs to capture realistic subtleties, calculated using the 3D model as a reference, or drawn in image editing programs for complete control.
The most convincing textures typically use a bit of all.
Start by creating a new image in GIMP.
Most textures in CSGO are 256x256, 512x512, or 1024x1024.
The sizes vary based on the scale of the prop and how detailed it needs to be, but try not to go larger than what is necessary.
One helpful feature of GIMP is the ability to separate the image into layers that can be edited individually.
It's common for textures to be made up of several layers that are flatted when exporting.
The individual layers of a texture.
From left to right: UV layout, AO, shading, detail, photograph, and color.
UV Layout: Exported from Blender as a reference to align the texture.
This is the only layer not included in the final export.
Ambient Occlusion (AO): Calculated in Blender and configured so whites are transparent.
Shading: Drawn in GIMP and added to create depth and hide the inside of the bell.
Configured so that whites are transparent.
Detail: Adds color and detail, e.
g.
dirt, scratches, highlights, etc.
Drawn in GIMP.
Photograph: An image of real wood makes the texture look more realistic.
Color: The bottom layer, drawn in GIMP, establishes overall color and provides additional detail.
The end result.
You should know that Blender can calculate normal maps, ambient occlusion, highlights, shadows, and more.
Don't be afraid to play around and learn because these features can add detail in a way that other techniques can't.
To test the texture, export it as a .
PNG and apply it to your model in Blender.
Check that UV map is well aligned and that the colors and detail look good.
When you're happy with the texture return to GIMP, flatten the layers and export it as a .
VTF, reusing the meshes's name from the previous chapter.
You'll be presented with several options.
The default options should suffice in most cases.
Compress the image using DXT1 pixel format.
Only add alpha if the texture includes a layer mask (used for more advanced features).
Include mipmaps and use the highest resolution available.
Ultimately, the model's texture should be created with your map's color themes in mind.
Using your artistic creativity you can come up with something really neat! Material The material is a .
VMT text document that instructs the Source Engine how to display the texture and lighting properties of the prop.
Optional effects like phong lighting, normal maps, and reflectivity can polish your prop.
But, for now, let's keep this as simple as possible.
Create a new text document using Notepad++ and paste the following code: VertexLitGeneric { $basetexture "models\props_map\model" } Replace "map" with the name of your map (any generic keyword will do fine) and "model" with the name of your .
VTF.
Save the document using the same model name and then manually change the extension to .
VMT.
You may get a warning that the file will become corrupt -- change it anyway.
Summary In this chapter, you created a .
VTF image and a .
VMT text file.
These two files combined make up the shader.
In the following chapter, I'll help you compile the models into a prop that can be loaded in game! Cinque TerreCinque Terre

Compiling the Model

Checkpoint At this point you should have nearly all the components of the prop completed.
Here's an updated chart: NameEditorExampleCompletedReference MeshBlendermodel.
smdYesCollision MeshBlendermodel_ref.
smdYesSequence MeshBlendermodel_seq.
smdNot applicableQC ScriptNotepad++qcscript.
qcNoTextureGIMPmodel.
vtfYesMaterialNotepad++model.
vmtYes As you can see, there's one necessary piece missing.
Let's work on that now and finish the prop! Models There's one last document to create: the QC script.
This is a text document that instructs the Source Engine to compile the models that we created earlier.
There's also some cool other stuff you can do in here too but for now we'll keep it simple.
Open a new text document in Notepad++ and paste in the following code: $modelname "props_map\model.
mdl" $model "Body" "model.
smd" $staticprop $cdmaterials "models\props_map" $surfaceprop "brass_bell_large" $sequence "idle" "model.
smd" $collisionmodel "model_ref.
smd" { $concave } Carefully scan within the quotation marks and replace the words "map" and "model" with your already established counterparts.
When you finish, save this document under the name of "qcscript" and then manually change the extension to .
QC.
You may get a warning that the file will become corrupt -- change it anyway.
To begin the compilation process, simply click and drag this file's icon over the studiomdl.
bat icon and release.
The compiler should run for a short moment before completing.
Press any key to exit.
Your compiled model files should have been automatically extracted to this path: Steam\steamapps\common\Counter-Strike Global Offensive\csgo\models\props_map Though you're not required to check, the new folder should contain these four file types: .
DX90.
VTX, .
MDL, .
PHY, and .
VVD.
The model files that you created previously, i.
e.
the .
SMDs and .
QC, can now be deleted if you wish.
I recommend keeping at least the .
QC, however, in case you later want to update the prop.
Shaders Unlike the models, the shaders don't need to be compiled per se.
You already have the .
VMT and .
VTF files and those are all you need.
Simply move them into the following path: Steam\steamapps\common\Counter-Strike Global Offensive\csgo\materials\models\props_map If you're missing the models folder then go ahead and create it.
Then create a new folder specific for the map, as shown.
Remember, replace "map" with the keyword you chose earlier.
Summary In this chapter you compiled the models into a format readable by the Source engine and placed the shader files in the CSGO directory.
Guess what? You're finished! Assuming everything went well, you're ready to load up Hammer and test your prop in a new map! The next chapter includes a section for troubleshooting and another for learning more about each step of this guide!

Conclusion

Congratulations! If all went well, you just created a custom prop! Imagine all the unique CSGO maps that you can make with this new skill.
Troubleshooting Sorry you're having trouble with the prop.
I'll write a quick list of some of the most common mistakes and questions; perhaps it'll help.
NameEditorExamplePathReference MeshBlendermodel.
smdNot applicableCollision MeshBlendermodel_ref.
smdNot applicableSequence MeshBlendermodel_seq.
smdNot applicableQC ScriptNotepad++qcscript.
qcDrag into studiomdl.
bat to compileTextureGIMPmodel.
vtfSteam\steamapps\common\Counter-Strike Global Offensive\csgo\materials\models\props_mapMaterialNotepad++model.
vmtSteam\steamapps\common\Counter-Strike Global Offensive\csgo\materials\models\props_map My prop is completely black in Hammer and in game.
The Source Engine isn't able to find your texture, likely due to a typo or misplacing of your shader files.
Open Blender and check that the reference mesh's material and the .
VMT share the same name, and that the latter correctly references the .
VTF.
Lastly, the .
QC should provide the correct path to the .
VMT.
My .
QC refuses to compile.
Scan through the log for any errors and correct as necessary.
Make sure you have all three .
SMDs present in the same folder as the .
QC before compiling and that they're being referenced without typos.
Open the studiomdl.
bat and ensure the paths are accurate.
I received "WARNING: AppFramework : Unable to load module p4lib.
dll!" when compiling the model! This warning is normal and can be ignored.
Your model should still compile correctly.
I'm confused about naming my files/scripts/folders! Throughout the process there are two names that you should be using consistently: The model name is unique and should only be used for a single prop.
The map name can be a general keyword associated with your project and can be referenced by several custom props.
How does the Source Engine load the prop? When a model is loaded by the Source Engine, it begins searching for the shader.
The name of which is defined by the reference mesh and path was specified by the.
QC.
When the .
VMT is found, the engine branches to the .
VTF.
Note that with this approach, multiple models can reference the same .
VMT, and multiple .
VMTs can reference a single .
VTF.
This can be used to decrease your map's file size when multiple models share the same shader.
Going Further The Valve Developer Wiki is a great resource to learn more about creating props: Creating a Custom Prop Reference Mesh Collision Mesh Sequence Mesh SQ Script .
QC Commands Texture Material .
VMT Commands Hammer Level DesignRemember, your prop can only be as good as you are.
Learn the process and your tools.
Keep reading tutorials and always try something new.
Summary Hopefully you found this guide informative! Creating custom props is a time consuming and sometimes frustrating process, but rewarding nonetheless.
The ability to include any prop you'd like into your custom map allows you to maximize your creativity.
Now there's practically no limit to the theme and scale of your map! See the completed prop in game: De_Legacy Feel free to post input, suggestions, and questions in the comments.
Cinque Terre