$distancealpha

From Valve Developer Community
Revision as of 02:02, 14 July 2008 by TomEdwards (talk | contribs)
Jump to navigation Jump to search

Stub

This article or section is a stub. You can help by expanding it.

Another new OB feature: outlining. See this PDF for a high-level explanation of what all this stuff does.

class_spy_outline

Alpha channel of $basetexture (100% zoom).
The material in-game (50% zoom).

This material is displayed by Team Fortress 2 when a spy player gains or loses a disguise. Despite the fact that it fills the entire screen at any resolution, its texture (right) is only 256 pixels square.

It can scale to high resolutions thanks to the Valve's new method of alpha testing, wherein threshold alpha values are used to construct smooth lines on the video card regardless of resolution.

UnlitGeneric
{
	$basetexture	hud\class_spy_outline
	$translucent	1
	
	$softedges		1
	$edgesoftnessstart	.5
	$edgesoftnessend	.46
	$scaleedgesoftnessbasedonscreenres 1
	
	$glow		1
	$glowcolor	"[0 0 0]"
	$glowalpha	.4
	$glowstart	.1
	$glowend	.5

	$distancealpha	1
	$vertexcolor	1
	$vertexalpha	1
	$no_fullbright	1
	$ignorez	1
}

Note in the above material how $edgesoftnessstart has the same value as $glowend. the glow effect is used for parts of the material above 50% opacity, while soft edges are created for parts below.

Advantages

  • Cheaper than a vector, presumably?
  • Allows cheap per-pixel details
  • Takes advantage of 3D acceleration