This article's documentation is for anything that uses the Source engine. Click here for more information.

EyeRefract

From Valve Developer Community
Jump to: navigation, search
English (en)Translate (Translate)
Eyerefract.jpg
This article is about the shader. For the preceding shader, see Eyes.  For the QC property of $model, see Eyeball./ For the tool, see qc_eyes.

EyeRefract is a vertex shader available in all Source Source games since Source 2007 Source 2007. This shader is a successor to the Eyes shader from Source 2004. Like it, EyeRefract is used to create life-like eyes, with more realistic shading, cornea parallax, and a wider set of supported effects than Eyes.

Icon-Bug.pngBug:Although this shader has support for $emissiveblend, it is not fully implemented and does not work properly.  [todo tested in?]
Icon-Bug.pngBug:The shader doesn't work in Counter-Strike: Global Offensive Counter-Strike: Global Offensive, where eyes are always directed to the map's center. Standard models use static eyes.  [todo tested in?]
Confirm:is this just CS:GO, or is it all CS:GO engine branch CS:GO engine branch games?
Icon-Bug.pngBug:On Source 2013, it's been observed to cause issues when used in scenes with expensive water, causing flickering and tears or disappearing of the water itself. It is advised to stick to the more stable Eyes shader, unless you're sure you can avoid these issues.  [todo tested in?]

Shader Parameters

The texture used for the iris. The alpha channel masks the iris against the sclera, which makes the iris more prominent. Opaque values mark the sclera, and transparent values mark the iris.
The frame to start an animated $iris on.
A texture to specify the shape of the cornea, similar to a normal map. Influences lighting and dilation. The red and green channels are used for the normal mapping, the blue channel is a mask for parallax mapping (straight multiply), and the alpha channel seems to be a multiplier for lighting. Because the $iris is warped in various ways the normals will not match 1-to-1 with the base texture.
Todo: Requires more testing. Source code: eye_refract_ps2x.fxc - search for "fIrisHighlightMask"
Strength of the $corneatexture.
How much the viewing angle should influence the positioning of the eye. Stronger values cause the iris to be smaller, but also move slower, making it seem "inset further". Default 0.25.
Dilates the pupil using the cornea texture to determine the shape of dilation. Default 0.5.
1-dimensional texture which remaps lighting colors.
Enables cubemap reflections. This shader has a specific cubemap made for it, engine/eye-reflection-cubemap-.vtf, but others can be used, including env_cubemap.
The opacity of the cubemap reflection. Does not affect the eye glint. Default 0.5.
An ambient occlusion texture overlaid onto the entire eye (be sure to adjust the iris scale of the Eyeball in the QC to make it fit) to make it appear darker near the borders. The texture is multiplicative (white changes nothing, black turns the result darker).
Tints the $ambientoccltexture. Default "[0.33 0.33 0.33]".
$ambientocclusion <float> (in all games since Left 4 Dead)
Strength of the dynamic ambient occlusion. Default 1.
Todo: Strength for SSAO?
Enables half-lambertian lighting.
Enables sphere raytracing. Each pixel is raytraced to allow sharper angles to look more accurate.
Requires $raytracesphere 1. Causes pixels which don't hit the raytraced sphere to be transparent, instead of rendering the "non-raytraced" eye behind it.
Requires $raytracesphere 1. Radius of the eyeball. Should be the diameter of the eyeball divided by 2. Default 0.5.

Other Parameters

Eyeball origin. Most likely derived from the QC eyes definition.
U/V projection vector for the iris. Default "[0 1 0 0]" and "[0 0 1 0]", respectively.
Eyes are used on a model in Half-Life 2: Episode One Half-Life 2: Episode One's intro cutscene. Adds another shader pass.
Requires $intro 1. How far into the warp animation we are.
Requires $intro 1. World-space location of the entity, required to correctly animate the warp.
Todo: Include cloak parameters in here?
Todo: Can this shader be used outside of a model with qc eyes, by using proxies (or in SFM override materials) to modify these shader values?