Crazy VMT variables and there functions.

Hi, I found a bunch of material functions in a vmt that are not listed on the developer wiki or google.

The Functions
[release]$texture2 “path”
$gnoise <bool>
$playerdistance <bool/int>
$alpharesult <bool/int>
$smallamount <int>
$alpharesultmin <int>
$alpharesultmax <int>
$hundred <int/100>
$playerdistance2 <bool>
$ten <int>
$frameminusten <bool>
[/release]
None of these shader parameters are listed on the wiki. does anyone know what these do? I think most of them are specific to the “Unlittwotexture” shader type.

Origional VMT: (materials/effects/CombineShield/combineshieldwall.vmt)


"Unlittwotexture"
{
	"$basetexture" "Effects/Combineshield/comshieldwall"
//	"$texture2" "Effects/com_shield002b"
	"$texture2" "Effects/Combineshield/comshieldwall"

	"$translucent" "1"
	"$envmap" "env_cubemap"
	"$envmaptint" "[1 1 1]"
	"$gnoise" "1"
	"$playerdistance" "0"
	"$additive" 1
	"$alpharesult" "1"
	"$smallamount" ".1"
	"$alpharesultmin" "1"
	"$alpharesultmax" "1"
	"$nodecal" 1
	"$hundred" "100"
	"$largeamount" "1"
	"$playerdistance2" "1"
	"$ten" "24"
	"$frameminusten" "1"

	"Proxies"
	{

		"PlayerProximity"
		{
			"resultVar" "$playerdistance2"
			"scale"  .2
		}	
		"Subtract"
		{
			"srcVar1" "$playerdistance2"
			"srcVar2" "$ten"
			"resultVar" "$frameminusten"
		}
		"Clamp"
		{
			"srcVar1"	"$frameminusten"
			"min"		"0"
			"max"		"30"
			"resultVar" "$frame2"
		}
		"Clamp"
		{
			"srcVar1"	"$frameminusten"
			"min"		"0"
			"max"		"30"
			"resultVar" "$frame"
		}

		"PlayerProximity"
		{
			"resultVar" "$playerdistance"
			"scale" 0.0009 
		}	
		"GaussianNoise"
		{
			"minVal" .8
			"maxVal" 1	
 			"mean" .7
			"halfwidth" .3
			"resultVar" "$gnoise"
		}
		"Subtract"
		{
			"srcVar1" "$gnoise"
			"srcVar2" "$playerdistance"
			"resultVar" "$alpharesultmin"
		}
		"Multiply"
		{
			"srcVar1" "$hundred"
			"srcVar2" "$playerdistance"
			"resultVar" "$largeamount"
		}
		"Equals"
		{
			"srcVar1" "$playerdistance"
			"resultVar" "$envmaptint[1]"
		}	
		"Add"
		{
			"srcVar1" "$alpharesultmin"
			"srcVar2" "$smallamount"
			"resultVar" "$alpharesultmax"
		}	
		"Sine"
		{
			"sineperiod"	1.08
			"sinemin"	"$alpharesultmin"
			"sinemax"	"$alpharesultmax"
			"resultVar"	"$alpha"
		}


		"TextureScroll"
		{
			"texturescrollvar" "$texture2transform"
			"texturescrollrate" .1
			"texturescrollangle" -45
		}
	}
}

I also don’t get most of these material proxies’ functions. Anyone know these parameter’s functions

I’ll refer to the VMT you posted while I explain what little I know:

TextureScroll is pretty self-explanatory. It makes the base texture or various other textures you might apply to the VMT (in this case, $texture2 was applied to this proxy) scroll at a defined speed/rate and angle on a surface. It’s used in just about every water texture in Source to make the water look like it’s flowing in a single direction. Textures like waterfalls would rely on this proxy heavily.

Sine is a proxy often used for pulsating effects on textures, but can be used for other things if it fits the situation. You know when Dog tears our that strider’s brain in Episode 2? If you take a close look at it, there’s little spots on it that pulsate slowly. I actually investigated the brain texture like a year or two ago and discovered the sine parameter myself. It’s fun to use.

If I remember correctly, the sine parameter basically oscillates between a min and max value at a given rate (“sineperiod” 1.08). You can define what the min and max values of the sine proxy equal (“sinemin” “$alpharesultmin” , “sinemax” “$alpharesultmax”). You also have to define what $alpharesultmin and $alpharesultmax equal, prior to the sine proxy ("$alpharesultmin" “1” , “$alpharesultmax” “1”). Lastly, you define what the result of the sine proxy should be (“resultVar” “$alpha”). That basically creates your pulsating glow effect.

As for the parameters like $ten and $hundred, I’m going to take a wild guess and say that you first define what $ten and $hundred equal ("$ten" “24” , “$hundred” “100”) and then you use those defined values as scale factors in certain proxies. I could be COMPLETELY wrong about this because I also have no clue, but it’s just a random guess.

I’m going to assume $gnoise adds a layer of gaussian noise to the texture, and it can also be used in various proxies to create neat effects.

$playerproximity is a proxy that uses the player’s distance relative to the texture’s position to create effects. The VMT you posted is for the combine shield texture that Valve littered in HL2. The shield VMT uses all those proxies to make a really cool disappearing/reappearing effect when you move away from and towards the shield wall. It probably does some other things too, but I don’t fully understand it all.

Texture proxies are really tough to wrap your head around. It takes a lot of investigation and experimentation to fully understand them since the developer wiki is so vague when it comes to it.

You can create your own parameter names in order to store the result of a proxy. If you look closely you will see that all of the unrecognised params you posted eventually end up in a shader-standard one (e.g. $gnoise is used to calculate $alpha).

$texture2 is a parameter of UnlitTwoTexture though.

Edit: here is the “vague” wiki doc explaining this subject.