$flesh
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?