$distancealpha: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
{{stub}}
Another new OB feature: outlining. [http://www.valvesoftware.com/publications/2007/SIGGRAPH2007_AlphaTestedMagnification.pdf See this PDF] for a high-level explanation of what all this stuff does.
Another new OB feature: outlining. [http://www.valvesoftware.com/publications/2007/SIGGRAPH2007_AlphaTestedMagnification.pdf See this PDF] for a high-level explanation of what all this stuff does.


''// give it a slight outer soft edge''
== class_spy_outline ==
  $softedges 1
 
  $edgesoftnessstart 0.5
[[Image:Class spy outline.png|frame|The material's [[$basetexture]] (100% zoom).]]
  $edgesoftnessend 0.4
[[Image:Class spy outline ingame.jpg|thumb|256px|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
  $scaleedgesoftnessbasedonscreenres 1
$glow 1
$glowcolor "[0 0 0]"
$glowalpha .4
$glowstart .1
$glowend .5
   
   
  ''// give it a white outline''
  [[$distancealpha]] 1
$outline 1
  [[$vertexcolor]] 1
  $outlinecolor "[0.7 0.7 0.5]"
  [[$vertexalpha]] 1
  $outlinestart0 0.41
  [[$no_fullbright]] 1
  $outlinestart1 0.49
  [[$ignorez]] 1
  $outlineend0 0.57
  }
$outlineend1 0.65
 
$scaleoutlinesoftnessbasedonscreenres 1
Note in the above material how <code>$edgesoftnessstart</code> has the same value as <code>$glowend</code>. the glow effect is used for parts of the material above 50% opacity, while soft edges are created for parts below.
   
 
''// and a drop shadow''
== Advantages ==
$glow 1
 
$glowcolor "[0 0 0]"
* Cheaper than a vector, presumably?
$glowalpha 0.45
* Allows cheap per-pixel details
$glowstart 0.1
* Takes advantage of 3D acceleration
$glowend 0.5
$glowx -0.001
$glowy -0.001


[[Category:List of Shader Parameters|O]]
[[Category:List of Shader Parameters|O]]

Revision as of 15:33, 13 July 2008

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

The material's $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