$lod
Jump to navigation
Jump to search
Each $lod QC command begins a block of commands describing how to perform LOD (Level of Detail) on the model. Each block specifies a single threshold parameter which represents a distance between the Model and the Viewer. When the Model is rendered beyond this distance that block of LOD commands are executed. The commands allow the LOD system to remove or replace various "expensive" parts of the Model so it can be rendered more efficiently.


- See LOD Models for in-depth information on generating LOD models
- See LOD system for a better overview.
- See also $shadowlod for cheaper Dynamic Shadows.
Syntax
$lod <int|threshhold> { <options> }
where
<int|threshhold>
: The LOD threshhold number is based on an inverse of the screen space. The smaller the model is on-screen, the larger the LOD threshhold will become.

<options>
: See below.
Options

replacemodel <original_mesh>.smd <lod_mesh>.smd [reverse]
- Causes the lod_mesh to be rendered instead of the original_mesh.
- The original_mesh can be any named SMD used by $body, $bodygroup or $model.
- The lod_mesh should be a lower polygon-count version of the reference_model. If no lod_model is specified the reference_model is not rendered at all.
- The reverse command is used only to correct reversed normals on the lod_model, caused by SMD export problems.
removemodel <original_mesh>.smd
- The specified Mesh or Sub-mesh will not be rendered at this LOD.
replacematerial <original_material>.vmt <lod_material>.vmt
- Replaces all instances of the original_material with the lod_material.
- Useful for removing expensive shaders like Normal Maps or the Eye Shader from LOD Skins.
Confirm:The Skin's $basetexture, etc will be mipmapped automatically - you don't need to do it manually.
Confirm:If lod1_mesh.smd was UV mapped to an lod1_skin.bmp, the lod1_skin.vmt will automatically be rendered on the lod1_mesh and doesn't need to be specified with "replacematerial" ?
removemesh <original_material>.vmt
- Removes all the triangles attached to the named material at this LOD.
nofacial
- Disables facial animation at this LOD.
bonetreecollapse <original_bonename>
- Causes all child bones of the specified bone to use the specified bone instead of whatever they currently are attached to.
- Deletes all children of the given bone, disabling movement on the client. The envelopes return to their reference position. Commonly used on fingers.
replacebone <original_bonename> <lod_bonename>
- The precursor of
bonetreecollapse
. Accepting a replacement bone makes it slightly less user-friendly, but allows all kinds of unusual bone optimisations that a simple collapse wouldn't achieve.
Example
$lod 12 { replacemodel Police_reference "lod1_Police_reference.smd" replacemodel Manhack_reference "lod1_Manhack_reference.smd" } $lod 18 { replacemodel Police_reference "lod2_Police_reference.smd" replacemodel Manhack_reference "lod2_Manhack_reference.smd" bonetreecollapse ValveBiped.Bip01_R_Hand bonetreecollapse ValveBiped.Bip01_L_Hand } $lod 42 { replacemodel Police_reference "lod3_Police_reference.smd" replacemodel Manhack_reference "lod3_Manhack_reference.smd" bonetreecollapse ValveBiped.Bip01_R_Hand bonetreecollapse ValveBiped.Bip01_L_Hand }