Fr/Water (shader)

From Valve Developer Community
< Fr
Revision as of 09:56, 22 November 2008 by Anarkia777 (talk | contribs)
Jump to navigation Jump to search
A custom Water material from Resistance And Liberation.
Real-time reflection of entities in Episode Two.

Water est le shader le plus complexe du moteur Source. Il necessite deux VMT. Et n'a pas de texture de base contrairement aux autres, le rendue est obtenue avec des effets et la normal maps.


Above and below (Au dessus et en Dessous)

Water requière deux matériaux : Un pour le dessus de la surface de l'eau, et un pour le dessous. Ces deux matériaux sont indépendants, mais i lest necessaire de tenir conte l'un de l'autre pour obtenir un rendu de qualité.

Shader parameters

Textures

$abovewater <bool>
Indique si ce matériaux est utilisé au dessus ou en dessous de la surface.
$bottommaterial <material>
Chemin vers le second VMT utilisé pour le dessous de la surface de l'eau. Ce second VMT doit avoir $reflecttexture et $abovewater desactiver.
$bumpmap <texture>
Du/dv map utilisé pour le Bump et la réfractions sur les GPU inférieur à DX9.
$normalmap <texture>
Utilisé pour le Bump et a réfractions sur les GPU DX9 et supérieurs.


A Du/dv map for DirectX 8 rendering ($bumpmap), and a bump map for DirectX 9 and above ($normalmap). These should be animated unless the water is to be perfectly still.
Note.pngNote:$normalmap is unique to Water. Everywhere else, $bumpmap is used and there are no du/dv maps.
$dudvframe <int>
$bumpframe <int>
Frame to start the animated du/dv map and bump map on, respectively. Somewhat confusingly, $bumpframe affects $normalmap, which should be pointing to a bump map.

Fog

$fogcolor <RGB matrix>
This is the color of the water’s volumetric fog. Generally this value should match the color used in the bottom material.
$fogenable <bool>
Enable volumetric fog for the water.
$fogend <float>
This is the distance in inches from the eye at which water fog ends.
$fogstart <float>
This is the distance in inches from the eye at which water fog starts.
Warning.pngAttention:This must be 0 for edge fading to work properly.

Reflection/Refraction

$envmap <env_cubemap / texture>
Provides reflections for cheap water. See $envmap
$forcecheap <bool>
Make this water cheap regardless of the water_lod_control entity's or user's settings. This will disable real-time reflection and instead use $envmap. Refraction is assumed to be opaquely the water fog color.
$forceexpensive <bool>
This forces the water to render itself as expensive, regardless of the map's water_lod_control or the user's settings.
$reflectamount <float>
This is the amount of warp for the reflection. Higher values produce more visible reflections.
$reflectentities <bool>
Make the water reflect entities. By default, no entities are reflected.
$reflecttexture <texture>
Texture to use for reflection. For real-time reflections, use _rt_WaterReflection.
Tip.pngAstuce:Specify $refracttexture without $reflecttexture to get real-time refraction on $envmap reflections.
$reflecttint <RGB matrix>
This is the color tint for the real-time reflection and environment map.
$refractamount <float>
This is the amount of warp for the refraction. Higher values produce more warping.
$refracttexture <texture>
Texture to use for refraction. For real-time refractions, use _rt_WaterRefraction.
Tip.pngAstuce:Specify $refracttexture without $reflecttexture to get real-time refraction on $envmap reflections.
$refracttint <RGB matrix>
This is the color of the refraction.
Warning.pngAttention:It is recommended that you set this to white or something close to white so that edge transitions work properly on DX9.

Other

%compilewater <bool>
This is needed to make a map using the material compile properly.
$surfaceprop water
Used by the physics system to define the surface as being water.
%tooltexture <texture>
Defines the texture Hammer will display in the material browser.
WaterLOD proxy
This connects the water_lod_control entity in a level to the water’s internal parameters. This must be declared in the material for the LOD mechanisms to work properly.

See also