PaintBlob

From Valve Developer Community
Jump to navigation Jump to search
An ice surface using the PaintBlob shader

Stub

This article or section is a stub. You can help by expanding it.

PaintBlob is a Pixel shader available in Counter-Strike: Global Offensive Counter-Strike: Global Offensive. Despite the odd name, its purpose is to create realistic hollow ice surfaces by piercing light through it using normal mapping, and calculating light reflection from its inner layer(backface) onto the outer layer (front face). The final output color of the surface is computed by combining various lighting terms. Also supports fresnel translucency when viewing the surface through itself, creating the illusion of a hollow ice material. Furthermore, a bounding box min and max value can be set to define how "hollow" or "thick" the material surface should be.

Note.pngNote:$nocull is not needed for this shader to function properly, however, can be used to visualize the $interior effects on the backface.
Todo: Report anomalies and bugs
Icon-Bug.pngBug:Non-functional in Source Filmmaker  [todo tested in ?]

Ice Interior Shading Algorithm

Sphere on the left has $interiorlayer 0. Sphere on the right has $interiorlayer 1

The code implements an ice interior shading algorithm to simulate the appearance of ice as a translucent material. The algorithm takes inputs such as the world normal, eye direction, and screen position and uses them to create the illusion of light passing through the surface. The final result is a composite of the blurred enviroment map, the interior color and ambient lighting.

Todo: Add images displaying screen position based fresnel refraction, can't seem to get this to work anymore.

Supported Parameters

Textures & Masks

$basetexture
Diffuse texture.
$normalmap
Normal map.
$envmap
Specular reflection.
$lightwarptexture
1D ramp texture for tinting scalar diffuse term.
Specify that this is the back surface of the ice.
Icon-Bug.pngBug:Results in a pixel shader crash if true.  [todo tested in ?]
Mask texture for specular reflection.
1D ramp texture for controlling fresnel falloff
Typically, a grayscale texture that defines the opaque and translucent parts of the texture.
Tip.pngTip:Extremely useful in creating realistic scratches on an ice surface.

Outer Layer Parameters

Scales the output color.
Tip.pngTip:Can be used to brighten the textures.
Specular exponent values.
Specular boost values.
Rim light exponent.
Rim light boost.
Base texture tint.
Todo: Figure out why this doesn't work.

Interior Volume Parameters

$interior <boolean>
Todo: This material shader parameter has not been described.
Enable interior layer.
$interiorfogstrength <float>
Todo: This material shader parameter has not been described.
Fog strength (scales with thickness of the interior volume).
$interiorbackgroundboost <float>
Todo: This material shader parameter has not been described.
Boosts the brightness of bright background pixels.
$interiorambientscale <float>
Todo: This material shader parameter has not been described.
Scales the ambient light in the interior volume.
$interiorbacklightscale <float>
Todo: This material shader parameter has not been described.
Scales backlighting in the interior volume.
$interiorrefractstrength <float>
Todo: This material shader parameter has not been described.
Strength of bumped refract of the background seen through the interior.

Additional Parameters

$uvscale <float>
Todo: This material shader parameter has not been described.
UV projection scale. Default: 0.02.
$bumpstrength <float>
Todo: This material shader parameter has not been described.
Bump map strength.
$fresnelbumpstrength <float>
Todo: This material shader parameter has not been described.
Bump map strength for the fresnel term.
$translucentfresnelminmaxexp <vector3>
Todo: This material shader parameter has not been described.
Fresnel range parameters for the opacity texture.
$uvprojoffset <vector3>
Todo: This material shader parameter has not been described.
Center for UV projection.
$bbmin and $bbmax <vector3>
Todo: This material shader parameter has not been described.
Todo: Functional?
$contactshadows <boolean>
Todo: This material shader parameter has not been described.
Darkens the shading of the ice region in areas where it is in contact with a surface.
$bumpframe
Bump frame.
$alphatest
Tip.pngTip:Has no effect on the alpha, but effects shadow casting
$translucent
Tip.pngTip:Has no effect on the alpha, but effects shadow casting
$surfaceprop
$nocull