$emissiveblend: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Added time proxy requirement, found in comments of Alien Swarm code, seems to apply to OB+SFM as well)
(Rewritten, added information, added example and see also sections, changed category from Material System to List of Shader Parameters)
Line 1: Line 1:
'''<code>$emissiveblend</code>''' is a material effect. You need all of the parameters in order for the effect to work.
{{screenshot}}
{{Note|The only example of this is in <code>episodic/materials/models/vortigaunt/vortigaunt_blue.vmt</code> found in the 'source2007 shared.gcf'.}}
{{Shaderparam|$emissiveblend|since=Source 2007|shader1=VertexLitGeneric}} It provides advanced self-illumination that can be flowed using a flowmap. It used on the Vortigaunts in {{Game link|Half-Life 2: Episode Two}} and succeeds the {{ent|VortWarp}} shader from {{Game link|Half-Life 2: Episode One}}.
{{Note|All parameters must be specified except for <code>$emissiveblendstrength</code> in order for the effect to work properly.}}
{{Note|<code>$emissiveblend</code> is additive, and does not read from the material's [[albedo]].}}
{{Note|<code>$emissiveblend</code> parameters are X+ and Y-, for both flowmap and scroll. (e.g. Giving X a positive scroll vector will have it go left and giving Y a positive scroll vector will have it go up)}}
{{Note|The effect does not need to use a flowmap, and can be used like a simple emissive map. Use dummy textures (<code>dev/null</code> or a pure white texture with a pure black alpha channel) for <code>$emissiveblendtexture</code> and <code>$emissiveblendflowtexture</code>, and use a value of <code>"[0 0]"</code> for <code>$emissiveblendscrollvector</code>. In this instance, illumination is provided by the <code>$emissiveblendbasetexture</code>, and the time proxy is not required.}}


==Parameters==
{{MatParam|$emissiveblendenabled|bool|Enables the effect.}}
{{MatParam|$emissiveblendtexture|texture|The texture that the flowmap scrolls. Not mapped to a UV.}}
{{MatParam|$emissiveblendbasetexture|texture|The texture used for the self-illumination. Can be colored or grayscale. Does not adopt the base texture's color.
: {{Todo|Does the alpha channel of this texture do anything? The one Valve uses has a specific alpha channel defined.}}}}
{{MatParam|$emissiveblendflowtexture|texture|Flowmap used for the <code>$emissiveblendtexture</code>.}}
{{MatParam|$emissiveblendtint|RGB matrix|Color tint of the effect. Default <code>"[1 1 1]"</code>.}}
{{MatParam|$emissiveblendstrength|normal|Strength of the effect.{{clarify}} Default 1.}}
{{MatParam|$emissiveblendscrollvector|vector2|A matrix that controls the direction and speed the <code>$emissiveblendtexture</code> scrolls. X (horizontal) and Y (vertical) respectively. A setting of 1 results in the texture tiling every 1 second, 0.1 every 10 seconds. 0 is no scroll. Default <code>"[1 1]"</code>.}}
{{TimeProxy}}
== Example ==
The only known material using this shader parameter, found in {{Game link|Half-Life 2: Episode Two}}, <code>materials/models/vortigaunt/vortigaunt_blue.vmt</code>
"VertexLitGeneric"
  {
  {
        $emissiveBlendEnabled    <[[bool]]> // Enables effect
"$surfaceprop" "default"
        $emissiveBlendTexture    <[[texture]]> // Texture the flowmap scrolls. Not mapped to a UV.
"$basetexture" "Models/vortigaunt/vortigaunt_base"
        $emissiveBlendBaseTexture <[[texture]]> // Texture used for the selfillumination. Can be colored or black and white. Does not adopt the base texture's color.
"$bumpmap" "Models/vortigaunt/vortigaunt_normal"
        $emissiveBlendFlowTexture <[[texture]]> //A flowmap texture. The same kind used for L4D2's flowing water.
"$phong" "1"
        $emissiveBlendTint        <[[RGB]]> //RGB color. Default [1 1 1].
"$phongboost" "10"
        $emissiveBlendStrength    <[[normal]]> // Strength of the effect. Default 1.
"$phongexponenttexture" "Models/vortigaunt/vortigaunt_exponent"
        $emissiveBlendScrollVector <[[float]] [[float]]> //Direction and speed the texture scrolls. X and Y respectively. A setting of 1 results in the texture tiling every 1 second. Default [1 1].
"$phongalbedotint" "1"
<source lang=php>
"$phongfresnelranges" "[.18 .4 1]"
"Proxies"
"$halflambert" "1"
{
"$nodecal" "1"
"CurrentTime"
{
// Rim lighting parameters
"resultVar" "$time" //Requires the CurrentTime proxy for the flow to work.
"$rimlight" "1" // To enable rim lighting (requires phong)
}
"$rimlightexponent" "10" // Exponent for phong component of rim lighting
}
"$rimlightboost" "3" // Boost for ambient cube component of rim lighting
</source>
// Blend between color textures
"$detail" "Models/Vortigaunt/vortigaunt_blue"
"$detailblendmode" "3"
"$detailblendfactor" "0.0"
"$detailScale" "1.0"
// Emissive Scroll Pass
"$emissiveBlendEnabled"    "1" // Enables effect
"$emissiveBlendTexture"    "models/vortigaunt/vortigaunt_illum"
"$emissiveBlendBaseTexture" "Models/Vortigaunt/vortigaunt_blue"
"$emissiveBlendFlowTexture" "models/vortigaunt/vortigaunt_flow"
"$emissiveBlendTint"        "[1 1 1]"
"$emissiveBlendScrollVector" "[0.11 0.124]"
"$time" "0"
"Proxies"
{
"VortEmissive"
{
}
"MaterialModify"
{
}
"CurrentTime"
{
"resultVar" "$time"
}
}
}
 
== See Also ==
* {{ent|$selfillum}}
* {{ent|VortWarp}}


[[Category:Material System]]
[[Category:List of Shader Parameters|E]]

Revision as of 11:38, 27 June 2019

Nuvola apps ksnapshot.png
This article or section needs a screenshot to help visually convey the subject.
You can upload screenshots at Special:Upload. For help, see Help:Images.

Template:Shaderparam It provides advanced self-illumination that can be flowed using a flowmap. It used on the Vortigaunts in Half-Life 2: Episode Two Half-Life 2: Episode Two and succeeds the VortWarp shader from Half-Life 2: Episode One Half-Life 2: Episode One .

Note.pngNote:All parameters must be specified except for $emissiveblendstrength in order for the effect to work properly.
Note.pngNote:$emissiveblend is additive, and does not read from the material's albedo.
Note.pngNote:$emissiveblend parameters are X+ and Y-, for both flowmap and scroll. (e.g. Giving X a positive scroll vector will have it go left and giving Y a positive scroll vector will have it go up)
Note.pngNote:The effect does not need to use a flowmap, and can be used like a simple emissive map. Use dummy textures (dev/null or a pure white texture with a pure black alpha channel) for $emissiveblendtexture and $emissiveblendflowtexture, and use a value of "[0 0]" for $emissiveblendscrollvector. In this instance, illumination is provided by the $emissiveblendbasetexture, and the time proxy is not required.

Parameters

$emissiveblendenabled $emissiveblendtexture $emissiveblendbasetexture $emissiveblendflowtexture $emissiveblendtint $emissiveblendstrength $emissiveblendscrollvector

Time Proxy

For any reason, you may want to modulate time by scale it. The below material proxy is a simple sample to work properly.

Note.pngNote: you don't need to declare "CurrentTime" Proxie in cases where you don't need to relative modify time scale.
	"$time" "0.0"
	"$CurrentTime" "0.0" // declare a custom VMT Parameter to "CurrentTime" Proxie output
	"$timeMult" "0.5"    // declare a custom VMT Parameter to use at "Multiply" Proxie

	"Proxies"
	{
		"CurrentTime"
		{
			// It pass CurrentTime Proxie to "$CurrentTime" variable to scale materials effects such $emissiveblendscrollvector.
			"resultVar" "$CurrentTime" 
		}
		"Multiply"
		{
			"srcVar1" "$CurrentTime" // get $CurrentTime VMT parameter to multiply with srcVar2
			"srcVar2" "$timeMult"    // get $timeMult VMT parameter to multiply with srcVar1
			"resultVar" "$time"      // writes multiplication product into $time, scaling "CurrentTime" 
		}
	}

Example

The only known material using this shader parameter, found in Half-Life 2: Episode Two Half-Life 2: Episode Two , materials/models/vortigaunt/vortigaunt_blue.vmt

"VertexLitGeneric"
{
	"$surfaceprop" "default"
	"$basetexture" "Models/vortigaunt/vortigaunt_base"
	"$bumpmap" "Models/vortigaunt/vortigaunt_normal"
	"$phong" "1"
	"$phongboost" "10"
	"$phongexponenttexture" "Models/vortigaunt/vortigaunt_exponent"
	"$phongalbedotint" "1"
	"$phongfresnelranges" "[.18 .4 1]"
	"$halflambert" "1"
	"$nodecal" "1"

	// Rim lighting parameters
	"$rimlight" "1"												// To enable rim lighting (requires phong)
	"$rimlightexponent" "10"										// Exponent for phong component of rim lighting	
	"$rimlightboost" "3"										// Boost for ambient cube component of rim lighting


	// Blend between color textures
	"$detail" "Models/Vortigaunt/vortigaunt_blue"
	"$detailblendmode" "3"
	"$detailblendfactor" "0.0"
	"$detailScale" "1.0"

	// Emissive Scroll Pass
	"$emissiveBlendEnabled"     "1" // Enables effect
	"$emissiveBlendTexture"     "models/vortigaunt/vortigaunt_illum"
	"$emissiveBlendBaseTexture" "Models/Vortigaunt/vortigaunt_blue"
	"$emissiveBlendFlowTexture" "models/vortigaunt/vortigaunt_flow"
	"$emissiveBlendTint"        "[1 1 1]"
	"$emissiveBlendScrollVector" "[0.11 0.124]"
	"$time" "0"
	"Proxies"
	{
		"VortEmissive"
		{
		}
		"MaterialModify"
		{
		}
		"CurrentTime"
		{
			"resultVar" "$time"
		}
	}
}

See Also