Static Prop Combine
Static Prop Combine, or informally speaking "autocombine", is a feature in Counter-Strike: Global Offensive's VBSP. It allows VBSP to merge together multiple static props into a single static prop, either automatically or with user-defined rules. This has the effect of both reducing the overall number of static props in the map, while also reducing the number of performance-eating draw calls. To enable it, run VBSP with -staticpropcombine
.
- Note:Due to the fickle nature of VBSP's prop combination feature, it may be better to use TeamSpen's Hammer Addons. Alternatively, static prop models can be combined manually.
Contents
Operation
Static prop combine performs the following operations:
- Identify props to be combined.
- It either does this according to the rules specified in
spcombinerules.txt
or automatically based off of model use. - Note:
-staticpropcombine_considervis
is a useful command which makes it take into account visclusters when combining. - Scan the QC source for each model it's combining, and extract certain info.
- This includes the names and locations of reference and physics meshes, the model's upaxis, the model's scale, and whether it's concave or not.
- It locates the QC by reading the
qc_path
keyvalue from the model, which is always considered relative to the game's content directory - even if it's an absolute path! - Note:There are many restrictions relating to this step, see Usage for details.
- Use that info, plus a stub QC, to generate its own QC.
- $contentrootrelative, $appendsource, and $addconvexsrc are all new commands designed specifically for static prop combine, the latter two being ways to "add" geometry to a model with an arbitrary offset, rotation, and scale.
- Call studiomdl to compile this generated QC into a combined model.
- Combined models will always contain
_autocombine_
in their name. - BSPZIP all combined models into the BSP's pack.
- Tip:Running with -keepsources will stop static prop combine from deleting its generated QCs and unpacked model files.
Usage
VBSP Options
See VBSP.
Hammer Options
Props that differ in the below keyvalues will NOT be combined, unless manually overriden with the appropriate VBSP option:
- Render in Fast Reflections (
-combineignore_fastreflection
) - Ignore Normals (
-combineignore_normals
) - Disable Shadows (
-combineignore_noshadows
) - Disable Vertex lighting (
-combineignore_novertexlighting
) - Disable Flashlight (
-combineignore_noflashlight
) - Disable Self-Shadowing (
-combineignore_noselfshadowing
) - Disable ShadowDepth (
-combineignore_disableshadowdepth
)
In addition, you can manually disable static prop combine for individual props with the Disable Prop Combine keyvalue.
Prop Setup
In order to use a prop with static prop combine, you MUST have the source files for the prop!
The QC for the prop must be compiled from the game's content folder. For Counter-Strike: Global Offensive, this should be SteamApps/common/content/csgo/
.
../../content/[-game name]
, relative to the bin folder. This can be useful to modders to know.
There are quite a few restrictions that are put in place. These include:
- Only the first
$body
is recognized. $model
is not recognized.$appendsource
and$addconvexsrc
are not recognized.- You can only use
$upaxis
Z or Y.
Rules Setup
Rules for static prop combine are defined in scripts/hammer/spcombinerules/spcombinerules.txt
. It is a standard KeyValues-formatted text file. Each entry follows this format:
"example_combined" //name of the combine group, used for the final model name in the level
{
// this is a stub qc that will be used to generate combined models
"qc_template_path" "scripts/hammer/spcombinerules/qc_templates/example.qc"
// max models per cluster using these peers
"cluster_limit" 8
// don't cluster models greater than this far apart
"distance_limit" 12
// these are models that can combine with each other
"peers"
{
"models/examples/example_A.mdl" ""
"models/examples/example_B.mdl" ""
"models/examples/example_C.mdl" ""
}
}
If you don't want to bother with creating rules, you can run -staticpropcombine_autocombine
. However, this can cause issues if you do not have the source files for the models VBSP tries to combine.
Stub QCs
Stub QCs are QCs or QCIs which contain a base template for the QCs which static prop combine generates. Generally, they should only include:
- $cdmaterials
- $surfaceprop
- $staticprop
- Any $texturegroups used by the models.
- Static prop combine knows not to combine models using different skins.
- Since combined props cannot be listed in lights.rad, $casttextureshadows can be applied to let this model cast Texture Shadows.
Stub QC Example
$cdmaterials models\props\de_venice\venice_window_3
$staticprop
$surfaceprop "Plaster"
$texturegroup venice_window_3 {
{ "venice_window_3" }
{ "venice_window_3_lit" }
}