$flesh: Difference between revisions
(stub) |
(Filled up the page with all shader parameters and basic usage information/limitations.) |
||
Line 1: | Line 1: | ||
[[File:Alyxrevive.png|thumbnail|right|The flesh shader in action.]] | |||
New in the Orange Box: inside-your-body rendering effects! | New in the Orange Box: inside-your-body rendering effects! | ||
While it was only used during the cutscene in Half-Life 2: Episode Two where Alyx is revived, it is pretty versatile due to its amount of parameters. | |||
It displays a second rendering pass on top of the base material which can be blended by adding [[point_flesh_effect_target]] entities. When your model gets close to the sphere of these entities, the flesh will start to appear. | |||
{{note|The flesh effects will only work when using [[VertexLitGeneric]] as your material's shader. Due to this, it only works on models.}} | |||
== Usage == | |||
In addition to specifying the essential shader parameters for a [[VertexLitGeneric]] material, you have to ensure that your material defines a proxy as such: | |||
"Proxies" | |||
{ | |||
"FleshInterior" | |||
{ | |||
} | |||
} | |||
This is required to make the shader work, as it has to interact with the world and needs to also animate and update in real-time. | |||
{{bug|This shader does not get illuminated from dynamic lighting of [[Source Filmmaker]] or [[env_projectedtexture]]. Ensure that the map lighting suffices and the player can not use their flashlight (or the map doesn't use this kind of lighting) when a model with this material is shown.}} | |||
=== Shader Parameters === | |||
The following shader parameters allow you to enable and control the flesh effect: | |||
; <code>$fleshinteriorenabled <[[bool]]></code> | |||
: Enables or disables the flesh effect for the material. | |||
; <code>$fleshinteriortexture <texture></code> | |||
: The texture used as a base for rendering the flesh. Its alpha value functions as a mask, whereas a higher alpha value (visible) result in that part of the texture showing flesh when an effect target comes close. | |||
; <code>$fleshnormaltexture <texture></code> | |||
: Normal map for the flesh effect. | |||
; <code>$fleshbordertexture1d <texture></code> | |||
: A texture similar to those used by <code>[[$lightwarptexture]]</code>. {{todo|Where on the texture is the "inside" or "outside" of the border effect?}} {{note|Even when using a fully white border texture and tint, a black tint can still be seen on the border. This is a limitation of the shader and can not be changed.}} | |||
; <code>$fleshsubsurfacetexture <texture></code> | |||
: A texture which is multiplied with the <code>$fleshinteriortexture</code> texture. Use a fully white texture (e.g. <code>vgui/white</code>) to skip this rendering pass. | |||
; <code>$fleshsubsurfacetint "[<red [[float]]> <green float> <blue float>]"</code> | |||
: Allows tinting the <code>$fleshsubsurfacetexture</code>. Default is <code>"[1 1 1]"</code>. | |||
; <code>$fleshinteriornoisetexture <texture></code> | |||
: Used on the border of the flesh effect, adding a distortion effect on the transition between exterior and interior. Scrolls based on the value of <code>$fleshscrollspeed</code>. | |||
; <code>$fleshscrollspeed <[[float]]></code> | |||
: Determines how fast the <code>$fleshinteriornoisetexture</code> should scroll. | |||
; <code>$fleshbordernoisescale <float></code> | |||
: Changes the scale of the <code>$fleshinteriornoisetexture</code>. | |||
; <code>$fleshborderwidth <float></code> | |||
: Determines the width of the border transition between interior and exterior. May change from which camera angles the effect is visible, as well. Must be greater than 0. | |||
; <code>$fleshbordersoftness <[[normal]]></code> | |||
: Changes how soft the transition between interior and exterior is. Values must be bigger than 0 but no higher than 0.5. | |||
; <code>$fleshbordertint "[<red [[float]]> <green float> <blue float>]"</code> | |||
: Allows tinting the effect border. Default is <code>"[1 1 1]"</code>. | |||
; <code>$fleshcubetexture <texture></code> | |||
: The cubemap texture to use for reflections on the flesh interior. Accepts values similar to <code>[[$envmap]]</code> (including <code>env_cubemap</code>). | |||
; <code>$fleshglossbrightness <float></code> | |||
: Changes the strength or brightness of the cubemap reflection (if <code>$fleshcubetexture</code> is specified). | |||
=== Debugging === | |||
Some shader parameters were included to allow for easier debugging, but don't have much use otherwise: | |||
; <code>$fleshglobalopacity <normal></code> | |||
: Opacity of the entire flesh effect. Essentially a <code>[[$alpha]]</code> for the entire effect. {{note|Since this effect is rendered as a second pass on top of the existing material, you can *not* see through the material when setting this to values less than one. You will instead be seeing the original material behind the flesh effect.}} | |||
; <code>$fleshdebugforcefleshon <bool></code> | |||
: If set to 1, shows the flesh rendering pass on the entire model, regardless of the mask specified on the <code>$fleshinteriortexture</code> or the effect targets. | |||
; <code>$flesheffectcenterradius<1/2/3/4> "[<x float> <y float> <z float> <radius float>]"</code> | |||
: If any of these shader parameters are specified, a flesh effect target is created at the specified location ({{todo|using local or world coordinates?}}) using the specified radius. This functions the same as adding a [[point_flesh_effect_target]] entity. | |||
: {{todo|Can you have more than four [[point_flesh_effect_target]] entities? If not, will these parameters interfere with those entities / override their settings?}} | |||
[[Category:List of Shader Parameters|F]] | [[Category:List of Shader Parameters|F]] |
Revision as of 05:43, 3 March 2018
New in the Orange Box: inside-your-body rendering effects!
While it was only used during the cutscene in Half-Life 2: Episode Two where Alyx is revived, it is pretty versatile due to its amount of parameters.
It displays a second rendering pass on top of the base material which can be blended by adding point_flesh_effect_target entities. When your model gets close to the sphere of these entities, the flesh will start to appear.

Usage
In addition to specifying the essential shader parameters for a VertexLitGeneric material, you have to ensure that your material defines a proxy as such:
"Proxies" { "FleshInterior" { } }
This is required to make the shader work, as it has to interact with the world and needs to also animate and update in real-time.

Shader Parameters
The following shader parameters allow you to enable and control the flesh effect:
$fleshinteriorenabled <bool>
- Enables or disables the flesh effect for the material.
$fleshinteriortexture <texture>
- The texture used as a base for rendering the flesh. Its alpha value functions as a mask, whereas a higher alpha value (visible) result in that part of the texture showing flesh when an effect target comes close.
$fleshnormaltexture <texture>
- Normal map for the flesh effect.
$fleshbordertexture1d <texture>
- A texture similar to those used by
$lightwarptexture
.Todo: Where on the texture is the "inside" or "outside" of the border effect?Note:Even when using a fully white border texture and tint, a black tint can still be seen on the border. This is a limitation of the shader and can not be changed.
$fleshsubsurfacetexture <texture>
- A texture which is multiplied with the
$fleshinteriortexture
texture. Use a fully white texture (e.g.vgui/white
) to skip this rendering pass. $fleshsubsurfacetint "[<red float> <green float> <blue float>]"
- Allows tinting the
$fleshsubsurfacetexture
. Default is"[1 1 1]"
. $fleshinteriornoisetexture <texture>
- Used on the border of the flesh effect, adding a distortion effect on the transition between exterior and interior. Scrolls based on the value of
$fleshscrollspeed
. $fleshscrollspeed <float>
- Determines how fast the
$fleshinteriornoisetexture
should scroll. $fleshbordernoisescale <float>
- Changes the scale of the
$fleshinteriornoisetexture
. $fleshborderwidth <float>
- Determines the width of the border transition between interior and exterior. May change from which camera angles the effect is visible, as well. Must be greater than 0.
$fleshbordersoftness <normal>
- Changes how soft the transition between interior and exterior is. Values must be bigger than 0 but no higher than 0.5.
$fleshbordertint "[<red float> <green float> <blue float>]"
- Allows tinting the effect border. Default is
"[1 1 1]"
. $fleshcubetexture <texture>
- The cubemap texture to use for reflections on the flesh interior. Accepts values similar to
$envmap
(includingenv_cubemap
). $fleshglossbrightness <float>
- Changes the strength or brightness of the cubemap reflection (if
$fleshcubetexture
is specified).
Debugging
Some shader parameters were included to allow for easier debugging, but don't have much use otherwise:
$fleshglobalopacity <normal>
- Opacity of the entire flesh effect. Essentially a
$alpha
for the entire effect.Note:Since this effect is rendered as a second pass on top of the existing material, you can *not* see through the material when setting this to values less than one. You will instead be seeing the original material behind the flesh effect.
$fleshdebugforcefleshon <bool>
- If set to 1, shows the flesh rendering pass on the entire model, regardless of the mask specified on the
$fleshinteriortexture
or the effect targets. $flesheffectcenterradius<1/2/3/4> "[<x float> <y float> <z float> <radius float>]"
- If any of these shader parameters are specified, a flesh effect target is created at the specified location (Todo: using local or world coordinates?) using the specified radius. This functions the same as adding a point_flesh_effect_target entity.
- Todo: Can you have more than four point_flesh_effect_target entities? If not, will these parameters interfere with those entities / override their settings?