Pyro vision (shader)

From Valve Developer Community
Jump to: navigation, search

The pyro_vision shader is used in pyro_vision in the game Team Fortress 2. It is used to replace the normal textures of a map with a simulation similar to the fantasy land shown in the animated short "Meet the Pyro".

To do so it computes the grayscale value of the diffuse color of the original texture and maps it using a special one dimensional texture. It can also project an overlay texture, usually stripes, uniformly in world space.

Recommended Reading: [Dreams of Chronic and Sustained Cruelty]

The Pyro vision shader has 4 effect modes controlled by $EFFECT

0 An R&D stage which is not finished
1 Handles most of the world and model rendering in pyro land
2 Depth of Field blending
3 Pyro vignette drawing

Standard Fields found in other shaders:

$BASETEXTURE "" Your diffuse texture
$BASETEXTURE2 "" Second diffuse texture - For two way blends
$BLENDMODULATETEXTURE "" Optional modulate texture - For two way blends
$BLENDMASKTRANSFORM "center .5 .5 scale 1 1 rotate 0 translate 0 0" The transform parameters for blending

General Fields:

$EFFECT 1 Used to specify the effect type.
$VERTEX_LIT 0 0 if lightmap based, 1 if vertex lit based

Effect #1 Fields

$DIFFUSE_BASE 0.0 Value from 0.0 to 1.0 to blend the diffuse towards solid white
$DIFFUSE_WHITE 0.0 Value from 0.0 to 1.0 to blend the lightmap towards solid white
$GRAY_POWER 1.0 Raises the gray scale result to this value
$GRAY_STEP "[ 0.0 1.0 ]" Peforms a smooth step between the two values supplied. Think of this as the min/max sliders on a histogram chart.
$LIGHTMAP_GRADIENTS 255.0 Values from 1.0 to 255.0. Downscales the result into this many categories. May be provide some cartooning effects if you use low values.
$COLORBAR "" Specifies a 1D Texture. The resultant gray scale is used as a texture coordinate into this image to get the final color. We generally used the image as a color gradient, but try different patterns or smoothness of gradients for different results.
$SELFILLUMTINT "[ 1.0 1.0 1.0 ]" If self illumination is specified, this is the tint color for the self illumination.

Optional Stripes

$STRIPETEXTURE "" The texture used to specify the stripe or any other pattern. It uses standard alpha translucency to blend this texture.
$STRIPE_SCALE "[ 0.002 0.002 0.2 ]" Specifies the x y z world scaling to compute the seamless texture coordinate of the stripe texture.
$STRIPE_COLOR "[ 1.0 1.0 1.0 ]" The color modulated against the strip texture’s RGB. If you make your strip texture as gray scale, then you can have greater color control by using this field, as well as only needing one texture to create many colors.
$STRIPE_LM_SCALE 0.0 Interpolates between the lighting intensity of the pixel to full bright based upon this value.