Difference between revisions of "Refract"

From Valve Developer Community
Jump to: navigation, search
m
(added the fact that it must specify the $model command to use it effectivly on a model or it won't work)
Line 6: Line 6:
  
 
{{note|Will not work when applied to [[world brush]]es (including [[func_detail]]).}}
 
{{note|Will not work when applied to [[world brush]]es (including [[func_detail]]).}}
 +
{{note|When being used on a model, you must specify [[$model|$model "1"]].}}
  
 
Keep in mind that refraction is expensive to render when sorted. Multiple layers of refraction can cause immense overdraw. Avoid having large amounts of particle sheets, or multiple surfaces with refract that render above each other.
 
Keep in mind that refraction is expensive to render when sorted. Multiple layers of refraction can cause immense overdraw. Avoid having large amounts of particle sheets, or multiple surfaces with refract that render above each other.

Revision as of 05:11, 5 September 2013

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).
Note.png Note: When being used on a model, you must specify $model "1".

Keep in mind that refraction is expensive to render when sorted. Multiple layers of refraction can cause immense overdraw. Avoid having large amounts of particle sheets, or multiple surfaces with refract that render above each other.

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