EyeRefract: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
m (added language bar.)
Line 1: Line 1:
{{lang|EyeRefract}}
[[File:Eyerefract.jpg|right|300px]]
[[File:Eyerefract.jpg|right|300px]]
{{For|about=the shader|the preceding shader|{{ent|Eyes}}|the [[QC]] property of [[$model]]|[[Eyeball]]|the tool|[[qc_eyes]]}}
{{For|about=the shader|the preceding shader|{{ent|Eyes}}|the [[QC]] property of {{ent|$model}}|[[Eyeball]]|the tool|[[qc_eyes]]}}
{{Shader|EyeRefract|dx9=1|since=Source 2007}} It is used to create realistic eyes, which are affected by map lighting and dynamic lighting, such as those from flashlights. This shader is a successor to the {{ent|Eyes}} shader from {{Game link|Half-Life 2}}.
{{Shader|EyeRefract|dx9=1|since=Source 2007}} It is used to create realistic eyes, which are affected by map lighting and dynamic lighting, such as those from flashlights. This shader is a successor to the {{ent|Eyes}} shader from {{src04|2}}.
{{Bug|Although this shader has support for {{ent|$emissiveblend}}, it is not fully implemented and does not work properly.}}
{{Bug|Although this shader has support for {{ent|$emissiveblend}}, it is not fully implemented and does not work properly.}}
{{Bug|The shader doesn't work in Counter-Strike: Global Offensive. Eyes always directed to map center. Standard models use static eyes}}
{{Bug|The shader doesn't work in {{csgo|4}}, where eyes are always directed to the map's center. Standard models use static eyes.}} {{confirm|is this just CS:GO, or is it all {{csgobranch|2}} games?}}


== Shader Parameters ==
== Shader Parameters ==
{{MatParam|$iris|texture|The texture for the iris. The alpha channel controls the noisiness of the cornea.}}
{{MatParam|$iris|texture|The texture for the iris. The alpha channel controls the noisiness of the cornea.}}
{{MatParam|$irisframe|int|The frame to start an animated <code>$iris</code> on.}}
{{MatParam|$irisframe|int|The frame to start an animated <code>$iris</code> on.}}
{{MatParam|$corneatexture|texture|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"}}.}}
{{MatParam|$corneatexture|texture|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 <code>$iris</code> 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"}}.}}
{{MatParam|$corneabumpstrength|float|Strength of the <code>$corneatexture.</code>}}
{{MatParam|$corneabumpstrength|float|Strength of the <code>$corneatexture.</code>}}
{{MatParam|$parallaxstrength|float|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 <code>0.25</code>.}}
{{MatParam|$parallaxstrength|float|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 <code>0.25</code>.}}
Line 16: Line 16:
{{MatParam|[[$envmap]]|texture|Enables cubemap reflections. This shader has a specific cubemap made for it, <code>engine/eye-reflection-cubemap-.vtf</code>, but others can be used, including <code>env_cubemap</code>.}}
{{MatParam|[[$envmap]]|texture|Enables cubemap reflections. This shader has a specific cubemap made for it, <code>engine/eye-reflection-cubemap-.vtf</code>, but others can be used, including <code>env_cubemap</code>.}}
{{MatParam|$glossiness|float|The opacity of the cubemap reflection. Does not affect the eye glint. Default <code>0.5</code>.}}
{{MatParam|$glossiness|float|The opacity of the cubemap reflection. Does not affect the eye glint. Default <code>0.5</code>.}}
{{MatParam|$ambientoccltexture|texture|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).}}
{{MatParam|$ambientoccltexture|texture|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).}}
{{MatParam|$ambientocclcolor|RGB matrix|Tints the <code>$ambientoccltexture</code>. Default <code>"[0.33 0.33 0.33]"</code>.}}
{{MatParam|$ambientocclcolor|RGB matrix|Tints the <code>$ambientoccltexture</code>. Default <code>"[0.33 0.33 0.33]"</code>.}}
{{MatParam|[[$ambientocclusion]]|float|Strength of the dynamic ambient occlusion. Default <code>1</code>. {{todo|Strength for SSAO?}}|since={{l4d}}}}
{{MatParam|[[$ambientocclusion]]|float|Strength of the dynamic ambient occlusion. Default <code>1</code>. {{todo|Strength for SSAO?}}|since={{l4d}}}}
Line 25: Line 25:


== Other Parameters ==
== Other Parameters ==
 
{{MatParam|$eyeorigin|vector3|Eyeball origin. Most likely derived from the QC eyes definition.}}
{{MatParam|$eyeorigin|vector3|Eyeball origin. Most likely derived from the qc eyes definition.}}
{{MatParam|$irisu|vector4}}  
{{MatParam|$irisu|vector4}}  
{{MatParam|$irisv|vector4|U/V projection vector for the iris. Default <code>"[0 1 0 0]"</code> and <code>"[0 0 1 0]"</code>, respectively.}}
{{MatParam|$irisv|vector4|U/V projection vector for the iris. Default <code>"[0 1 0 0]"</code> and <code>"[0 0 1 0]"</code>, respectively.}}
{{MatParam|$intro|bool|Eyes are used on a model in Episode 1's intro cutscene. Adds another shader pass.}}
{{MatParam|$intro|bool|Eyes are used on a model in {{hl2ep1|2}}'s intro cutscene. Adds another shader pass.}}
{{MatParam|$warpparam|float|Requires <code>$intro 1</code>. How far into the warp animation we are.}}
{{MatParam|$warpparam|float|Requires <code>$intro 1</code>. How far into the warp animation we are.}}
{{MatParam|$entityorigin|vector3|Requires <code>$intro 1</code>. World-space location of the entity, required to correctly animate the warp.}}
{{MatParam|$entityorigin|vector3|Requires <code>$intro 1</code>. World-space location of the entity, required to correctly animate the warp.}}

Revision as of 16:04, 9 May 2022

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.

Shader-ball.png EyeRefract It is used to create realistic eyes, which are affected by map lighting and dynamic lighting, such as those from flashlights. This shader is a successor to the Eyes shader from Source 2004 Source 2004.

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?

Shader Parameters

$iris $irisframe $corneatexture $corneabumpstrength $parallaxstrength $dilation [[$lightwarptexture|$lightwarptexture]] [[$envmap|$envmap]] $glossiness $ambientoccltexture $ambientocclcolor [[$ambientocclusion|$ambientocclusion]] [[$halflambert|$halflambert]] $raytracesphere $spheretexkillcombo $eyeballradius

Other Parameters

$eyeorigin $irisu $irisv $intro $warpparam $entityorigin

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?