Aftershock: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Category rename)
(Rewritten, added all parameters from code, added example, added requirement of the time proxy, added maintenance templates, needs testing)
Line 1: Line 1:
'''<code>Aftershock</code>''' {{EP2 add}}
{{stub}}
This shader draws animated and scrolling refraction. It is able to smoothly fade out with alpha blending depending on its distance to the ground (per vertex; calculated with the [[Material|material]] parameters <code>$GroundMin</code> and <code>$GroundMax</code>) and the dot product of the per vertex geometry normal and world view vector (scaled by <code>$SilhouetteThickness</code>). Furthermore this shader does solely support the vertexformat that [[model|studiomodels]] use.
{{cleanup}}
{{Note|So far the only material that uses this shader is <code>materials/models/props_combine/sphere.vmt</code>. It can be found in ''episode two materials.gcf''.}}
{{screenshot}}
{{Shader|Aftershock|since=Source 2007|dx9=1}} It draws animated and scrolling refraction. It is able to smoothly fade out with alpha blending depending on its distance to the ground (per vertex; calculated with the [[Material|material]] parameters <code>$GroundMin</code> and <code>$GroundMax</code>) and the dot product of the per vertex geometry normal and world view vector (scaled by <code>$SilhouetteThickness</code>). Furthermore this shader does solely support the vertexformat that [[model|studiomodels]] use.


== Shader specific parameters ==
== Parameters ==
; <code>$refractamount</code>
{{MatParam|$normalmap|texture|Normal map for the refraction.}}
; <code>$bluramount</code>
{{MatParam|$bumpframe|int|The frame to start an animated bumpmap on.}}
: Used to tweak the refraction effect.
{{MatParam|$bumptransform|matrix|Transforms the bump map texture.
{{VMT UVtransform}}}}
{{MatParam|$refractamount|float|Controls the strength of the refraction by multiplying the normal map intensity.}}
{{MatParam|$colortint|RGB matrix|{{Todo|Color tint of the refraction?}}}}
{{MatParam|$bluramount|float|Adds a blur effect. Valid values are 0, 1 and 2.}}
{{MatParam|$groundmin|float|}}
{{MatParam|$groundmax|float|Both describe an interval used to fade out the shader.}}
{{MatParam|$silhouettecolor|RGB matrix|Silhouette color tint.}}
{{MatParam|$silhouettethickness|float|Scales the generic fade amount along the models edge.}}
{{TimeProxy}}


; <code>$SilhouetteColor</code>
== Example ==
; <code>$SilhouetteThickness</code>
The only known material using this shader, found in {{Game link|Half-Life 2: Episode Two}}, <code>materials/models/props_combine/sphere.vmt</code>
: Scales the generic fade amount along the models edge.
"Aftershock"
{
"<dx90"
{
"$fallbackmaterial" "models\props_combine\sphere_dx8"
}
"$normalmap" "models/props_combine/aftershock-normal"
"$refractamount" "0.02"
"$colortint" "[1.0 1.3 1.6]"
"$SilhouetteThickness" "0.2"
"$SilhouetteColor" "[0.3 0.3 0.5]"
"$GroundMin" "-0.3"
"$GroundMax" "-0.1"
"$BlurAmount" "0.01"
"$time" "0.0"
"Proxies"
{
"CurrentTime"
{
"resultVar" "$time"
}
}
}


; <code>$GroundMin</code>
== See Also ==
; <code>$GroundMax</code>
* {{ent|Refract}}
: Both describe an interval used to fade out the shader. Supposedly requires a custom [[material_proxies|material proxy]] to work correctly on non-stationary models.
 
 
== Supported effects ==
 
*<code>[[$normalmap]]</code>
*<code>[[$colortint]]</code>


[[Category:Shaders]]
[[Category:Shaders]]
[[Category:Stubs]]
[[Category:Stubs]]

Revision as of 10:11, 27 June 2019

Stub

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

Broom icon.png
This article or section needs to be cleaned up to conform to a higher standard of quality.
For help, see the VDC Editing Help and Wikipedia cleanup process. Also, remember to check for any notes left by the tagger at this article's talk page.
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.

Shader-ball.png Aftershock It draws animated and scrolling refraction. It is able to smoothly fade out with alpha blending depending on its distance to the ground (per vertex; calculated with the material parameters $GroundMin and $GroundMax) and the dot product of the per vertex geometry normal and world view vector (scaled by $SilhouetteThickness). Furthermore this shader does solely support the vertexformat that studiomodels use.

Parameters

$normalmap $bumpframe $bumptransform $refractamount $colortint $bluramount $groundmin $groundmax $silhouettecolor $silhouettethickness

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, found in Half-Life 2: Episode Two Half-Life 2: Episode Two , materials/models/props_combine/sphere.vmt

"Aftershock"
{
	"<dx90"
	{
		"$fallbackmaterial" "models\props_combine\sphere_dx8"
	}

	"$normalmap" "models/props_combine/aftershock-normal"

	"$refractamount" "0.02"
	"$colortint" "[1.0 1.3 1.6]"

	"$SilhouetteThickness" "0.2"
	"$SilhouetteColor" "[0.3 0.3 0.5]"
	"$GroundMin" "-0.3"
	"$GroundMax" "-0.1"
	"$BlurAmount" "0.01"

	"$time" "0.0"
	"Proxies"
	{
		"CurrentTime"
		{
			"resultVar" "$time"
		}
	}
}

See Also