Screenspace_General
Screenspace_General is a Vertex shader available in all
Source games since
Source 2007.[confirm] It is most commonly used to draw generic screenspace effects.
Unlike other shaders using screenspaceeffect as its vertex shader, screenspace_general allows developers to easily access and modify its pixel shader, 4 texture samplers and 4 shader register constants.[Clarify]
This can be useful for quickly iterating and testing screen effects, without having to reload all shaders, or recompile stdshaders to define/modify parameters.
Notable usage
dev/halo_add_to_screen
Used by the TF2 Glow Effect (2013 SDK) to help create an outline around models using stencils.
It uses the haloaddoutline_ps20 pixel shader to apply cheap blur. $C0_X controls the glow fade value (restricted to 1.0f in code.)
$C0_X actually does what it says it is supposed to do.Parameters
- $PIXSHADER <string>
- Name of the pixel shader to use. Can be loaded from any directory. In
Portal 2 and
Counter-Strike: Global Offensive, shaders can only be loaded from the platformdirectory. In
Garry's Mod, they can only be loaded from the mod directory, packed BSP, or a workshop addon.
- $VERTEXSHADER <string>
- Name of the vertex shader to use. (in all games since
)
Custom shader inputs
Other parameters
- $X360APPCHOOSER <integer>
- Dictates if vertex color should be used and if they should be transformed from world space. In later games, this is replaced by the usage of $vertexcolor material flag and
$vertextransform. (removed since
)
- $VERTEXTRANSFORM <integer>
- verts are in world space (in all games since
)
- $VERTEXNORMAL <integer>
- specify vertex normal (compressed) in material format (in all games since
)
- $ALPHABLEND <integer>
- whether or not to enable alpha blend (in all games since
)
- $MULTIPLYCOLOR <integer>
- whether or not to multiply src and dest color (in all games since
)
- $WRITEALPHA <integer>
- whether or not to enable alpha write (in all games since
)
- $WRITEDEPTH <integer>
- whether or not to enable depth write (in all games since
)
- $POINTSAMPLE_BASETEXTURE <integer>
- (in all games since
)(not in
)
- $POINTSAMPLE_TEXTURE1 <integer>
- (in all games since
)(not in
)
- $POINTSAMPLE_TEXTURE2 <integer>
- (in all games since
)(not in
)
- $POINTSAMPLE_TEXTURE3 <integer>
- (in all games since
)(not in
)
- $DEPTHTEST <integer>
- Enable Depthtest (in all games since
)
- $VIEWPROJMAT <matrix>
- (in all games since
)
- $INVVIEWPROJMAT <matrix>
- (in all games since
)
- $BlendOpMin <integer>
- (in all games since
)
Tools
An SDK to easily create custom pixel shaders for any Source game is available here: ficool2/sdk_screenspace_shaders.