$lod: Difference between revisions
Jump to navigation
Jump to search

Fix:Use replacematerial instead.
m (swapped templates for modern counterparts) |
m (Noticed the entire page looked a bit weird because a <code> block should have been a </code>.) |
||
Line 12: | Line 12: | ||
{{ModernWarning|{{csgo|4}} currently does not support level of detail. $lod will be ignored, but the model will still work. Try to avoid using this command in {{csgo}}.}} | {{ModernWarning|{{csgo|4}} currently does not support level of detail. $lod will be ignored, but the model will still work. Try to avoid using this command in {{csgo}}.}} | ||
{{ModernWarning|Edges that end up split or merged in a LOD, while it has not been like that in the original mesh, will cause the edge to disappear in the LOD.<br>In other words, Adding sharp edges to fix a smoothing issue on a LOD will cause that edge to not show up.}} | {{ModernWarning|Edges that end up split or merged in a LOD, while it has not been like that in the original mesh, will cause the edge to disappear in the LOD.<br>In other words, Adding sharp edges to fix a smoothing issue on a LOD will cause that edge to not show up.}} | ||
{{ModernWarning|Each LOD will have its own model, even if it does not use <code>$replacemodel<code>. Those models add to the total polycount. If your model has very high polycount and you add a LOD just to collapse bones, it will double the overall polycount.<br> | {{ModernWarning|Each LOD will have its own model, even if it does not use <code>$replacemodel</code>. Those models add to the total polycount. If your model has very high polycount and you add a LOD just to collapse bones, it will double the overall polycount.<br> | ||
Therefore it might be best to either not have any LOD at all, or using a '''highly''' decimated version of the model.}} | Therefore it might be best to either not have any LOD at all, or using a '''highly''' decimated version of the model.}} | ||
Revision as of 07:35, 22 May 2023


$lod is a QC command describing how to reduce the level of detail when rendering the model at a given size. It handles the removal or replacement of expensive parts of the model so it can be rendered more efficiently. There can be up to 8 levels.
Limitations

Template:ModernWarning Template:ModernWarning Template:ModernWarning
Syntax
$lod <threshold>
{
<options>
}
$shadowlod // Used to generate cheap render-to-texture shadows (not shadow maps)
{
<options>
}
threshold
- Defines when the LOD takes effect. Its value is (100 / screen pixels per unit) [1], which means that distance at which the transition happens depends on the size of the user's monitor and their FOV, not simply the model's distance from the camera. Someone with a truly massive screen may never see an LOD!
- The threshold formula makes it difficult to determine what values to use, however. The best way of working things out is to load your model into HLMV, switch to the Model tab, enable Auto LOD, and use
to zoom in and out.
Options
replacemodel <Reference smd> <LOD smd> [reverse]
- Replaces the given reference SMD (can by anything from
$body
,$bodygroup
or$model
) with an LOD version. Reverse
is used to correct reversed normals on the LOD, which can be caused by SMD export problems. Template:ModernBugremovemodel <Reference smd>
- The specified SMD will not be rendered at all at this level of detail.
Template:ModernBug replacematerial <Reference material> <LOD material>
- Replaces all instances of the reference material with another. Useful for removing expensive processes like $bumpmap and disabling the Eye shader. Paths are relative to
$cdmaterials
.Template:ModernBug removemesh <Reference material>
- Removes all triangles attached to the named material. Unlike in
replacematerial
, paths are relative to the root materials folder. Template:ModernBug nofacial
- Disables facial animation.
bonetreecollapse <Reference bone>
- Causes children of the specified bone to be removed. Their attached vertices return to the reference position. This is commonly used on fingers. Remember that it only applies to clients!Template:ModernNote
replacebone <Reference bone> <LOD bone>
- The precursor of
bonetreecollapse
. Replacing bones is much more complex, but allows all kinds of unusual bone optimisations that a simple collapse wouldn't achieve.
Example
$lod 12
{
replacemodel "Police_reference.smd" "lod1_Police_reference.smd"
replacemodel "Manhack_reference.smd" "lod1_Manhack_reference.smd"
}
$lod 18
{
replacemodel "Police_reference.smd" "lod2_Police_reference.smd"
replacemodel "Manhack_reference.smd" "lod2_Manhack_reference.smd"
bonetreecollapse "ValveBiped.Bip01_R_Hand"
bonetreecollapse "ValveBiped.Bip01_L_Hand"
}
$lod 42
{
replacemodel "Police_reference.smd" "lod3_Police_reference.smd"
replacemodel "Manhack_reference.smd" "lod3_Manhack_reference.smd"
bonetreecollapse "ValveBiped.Bip01_R_Hand"
bonetreecollapse "ValveBiped.Bip01_L_Hand"
}