Aftershock

From Valve Developer Community
Jump to: navigation, search

Aftershock (DX9+) is a material shader available in all Source games since <Source> Source 2007. 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 <texture>
Normal map for the refraction.
$bumpframe <integer>
The frame to start an animated bumpmap on.
$bumptransform <matrix>
Transforms the bump map texture.
The default position is "center .5 .5 scale 1 1 rotate 0 translate 0 0".
  1. center defines the point of rotation. Only useful if rotate is being used.
  2. scale fits the texture into the material the given number of times. '2 1' is a 50% scale in the X axis.
  3. rotate rotates the texture counter-clockwise in degrees. Accepts any number, including negatives.
  4. translate shifts the texture by the given numbers. '.5' will shift it half-way.
Note:All values must be included!
Bug: Scaling the texture may cause odd issues where the Texture Lock tool in Hammer will not actually lock the texture in place.
Bug: Rotating textures applied on brushes will rotate around the map origin (confirm: Orangebox engine only?). A fix for this is to change the center position in the VMT to the brush's origin.
$refractamount <float>
Controls the strength of the refraction by multiplying the normal map intensity.
$colortint <RGB matrix>
To do: Color tint of the refraction?
$bluramount <float>
Adds a blur effect. Valid values are 0, 1 and 2.
$groundmin <float>
$groundmax <float>
Both describe an interval used to fade out the shader.
$silhouettecolor <RGB matrix>
Silhouette color tint.
$silhouettethickness <float>
Scales the generic fade amount along the models edge.

Time Proxy

This shader or material parameter requires the below material proxy as specified to work properly.

	"$time" "0.0"
	"Proxies"
	{
		"CurrentTime"
		{
			"resultVar" "$time" //Needs the CurrentTime material proxy to work properly.
		}
	}

Example

The only known material using this shader, found in <Half-Life 2> 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