Refract

From Valve Developer Community
Revision as of 16:10, 24 March 2013 by JorisCeoen (talk | contribs)
Jump to: navigation, search
Deutsch Français
A refracting func_brush.

The Refract shaders distorts objects behind it. It is similar to Water, but does not reflect and so is not restricted to flat surfaces. Can be used to create distorting glass windows etc.

Note.png Note: Will not work when applied to world brushes (including func_detail).

Keep in mind that refraction is expensive to render. Multiple surfaces or models with refraction at the same time can result in a significant lower performance!

Syntax

Refract
{
	$normalmap ...
	$dudvmap ...
	$refracttint "[1 1 1]"
	$refractamount .2
}
$normalmap <string>
$dudvmap <string>
The pattern of refraction is defined by a bump map (DX9+) or DUDV map (DX8-). May be animated.
$refracttint <color>
$refracttinttexture <string>
Tints the colour of the refraction either uniformly or per-texel.
$refractamount <float>
$bluramount <float>
Strength of the effect. Use low values.
$forcerefract
Confirm:Override for users running with low detail settings?
$vertexcolormodulate
To do: See $vertexcolor.

Caveats

  • Currently it is not possible to define an overall alpha mask to indicate where to fall-off refract. This however only applies to the brush based and model geometry, and not particles. To get alpha on brush or model based geometry you can create a normalmap with an alpha channel, and define that as the first $normalmap. Using another normal of your choice you can then define a normalmap for $normalmap2. $normalmap2 will inherit the alpha of the first normalmap, and will act accordingly. This is extremely useful for faking effects like scrolling water of a surface. Where the first normalmap can provide the alpha, and the second normalmap can move along that alpha.

See also