This article's documentation is for anything that uses the Source engine. Click here for more information.

$subd: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
($SubD is a QC command for Source FilmMaker allowing tessellation/subdivision.)
 
No edit summary
 
(9 intermediate revisions by 4 users not shown)
Line 1: Line 1:
[[File:SubD_Sphere_Low.jpg|thumb|An example of a low-poly sphere.]]
[[File:SubD_Sphere_Low.jpg|thumb|right|200px|An example of a low-poly sphere.]]


[[File:SubD_Sphere_High.jpg|thumb|Same model, utilizing '''<code>$subd</code>''' and <code>mat_tessellationlevel 16</code>. Click the image to expand it.]]
[[File:SubD_Sphere_High.jpg|thumb|right|200px|Same model, utilizing '''<code>$subd</code>''' and <code>mat_tessellationlevel 16</code>.<br>Click the image to expand it.]]


The [[QC command]] '''<code>$subd</code>''' is used to mark a model to be tessellated in run-time. This can be used to make models appear smoother than they actually are.
{{This is a|QC command|name=$subd}} It is used to mark a model to be tessellated in run-time. This can be used to make models appear smoother than they actually are.


{{tip|The smoothness can be adjusted using the [[ConVar|console variable]] <code>mat_tessellationlevel <1-16></code>.}}
It also is needed to make [[$displacementmap]] work.


{{confirm|Only works with [[Source Filmmaker]]?}}
{{tip|The smoothness can be adjusted using the [[ConVar|console variable]] <code>mat_tessellationlevel <1-16></code>, with higher values rendering more polygons.}}
 
{{tip|It works only in [[Alien Swarm]] and [[Source Filmmaker]].}}
 
{{confirm|Works in games other than [[Alien Swarm]] and [[Source Filmmaker]]?}}


{{warning|[[Studiomdl]] will crash if any triangles are present in the model. '''<code>$subd</code>''' only works with quads and ''n''-gons with more than 3 edges. This effectively makes the [[Studiomdl Data|SMD]] format unusable, meaning you have to use the [[DMX]] format, as SMD only supports triangles. The SMD format can still be used for animations, though.}}
{{warning|[[Studiomdl]] will crash if any triangles are present in the model. '''<code>$subd</code>''' only works with quads and ''n''-gons with more than 3 edges. This effectively makes the [[Studiomdl Data|SMD]] format unusable, meaning you have to use the [[DMX]] format, as SMD only supports triangles. The SMD format can still be used for animations, though.}}
Line 14: Line 18:


  $subd
  $subd
{{important| $subd must be stated '''''before''''' the $model or $body you want to apply it to}}


== Example ==
== Example ==


  [[$modelname]] "example/subdivison.mdl"
  [[$modelname]] "example/subdivision.mdl"
  [[$cdmaterials]] "example/subdivision"
  [[$cdmaterials]] "example/subdivision"
  '''$subd'''
  '''$subd'''
  [[$body]] test "subdivison.dmx"
  [[$body]] test "subdivison.dmx"
  [[$sequence]] idle "subdivision_idle.smd"
  [[$sequence]] idle "subdivision_idle.smd"

Latest revision as of 17:46, 3 August 2025

An example of a low-poly sphere.
Same model, utilizing $subd and mat_tessellationlevel 16.
Click the image to expand it.

$subd is a QC command available in all Source Source games. It is used to mark a model to be tessellated in run-time. This can be used to make models appear smoother than they actually are.

It also is needed to make $displacementmap work.

Tip.pngTip:The smoothness can be adjusted using the console variable mat_tessellationlevel <1-16>, with higher values rendering more polygons.
Tip.pngTip:It works only in Alien Swarm and Source Filmmaker.
Confirm:Works in games other than Alien Swarm and Source Filmmaker?
Warning.pngWarning:Studiomdl will crash if any triangles are present in the model. $subd only works with quads and n-gons with more than 3 edges. This effectively makes the SMD format unusable, meaning you have to use the DMX format, as SMD only supports triangles. The SMD format can still be used for animations, though.

Syntax

$subd
Icon-Important.pngImportant: $subd must be stated before the $model or $body you want to apply it to

Example

$modelname		"example/subdivision.mdl"
$cdmaterials		"example/subdivision"
$subd
$body		test	"subdivison.dmx"
$sequence	idle	"subdivision_idle.smd"