Garry's Mod Wiki

screenspace_general

Description

This shader is a wrapper for providing custom pixel and vertex shaders, while it is named screenspace_general there is nothing inherently screenspace only about this shader, it is merely the name that was chosen before it received extra functionality that allowed it to do more than just screenspace work, as such this is a general shader that can be used on brushes, decals, info_overlays, models, and more.

The following content paths are supported: MOD, BSP, THIRDPARTY

Source Engine games use the game/shaders/fxc (GMod uses the garrysmod/shaders/fxc) folder to load .vcs shaders.

For Linux/Mac users who rely on the ToGL translation layer for their graphics they might run into issues because of lacking SM3.0 support. Running the game through compatibility tools like Proton which make use of DXVK will bypass this issue.
If you are trying to make UI shaders, use constant colors, or use textures in UI, and do not want them to be gamma-corrected (see issue 2807, issue 2241), then set $linearwrite to 1 (and linearread_basetexture/etc in case if you are using textures in your shader).

Example of custom pixel shader

pix_shader_example.png

See Also

Parameters

string PIXSHADER
Your supplied custom pixel shader. Must have _ps20 postfix at the end. If you want to use SM3.0 pixel shaders you must also pass a SM3.0 vertex shader, otherwise you are limited to SM2.0b.

Default: ""

string VERTEXSHADER
Your supplied custom vertex shader. Must have _vs20 or _vs30 postfix at the end.

Default: ""

boolean ALPHA_BLEND

Default: false

ITexture BASETEXTURE
Texture that will be supplied to your shader.
ITexture TEXTURE1
Texture that will be available in slot 1 to your shader.
ITexture TEXTURE2
Texture that will be available in slot 2 to your shader.
ITexture TEXTURE3
Texture that will be available in slot 3 to your shader.
boolean LINEARREAD_BASETEXTURE
Whether to linearly read the textures color or to apply gamma correction.

Default: false

boolean LINEARREAD_TEXTURE1
Whether to linearly read the textures color or to apply gamma correction.

Default: false

boolean LINEARREAD_TEXTURE2
Whether to linearly read the textures color or to apply gamma correction.

Default: false

boolean LINEARREAD_TEXTURE3
Whether to linearly read the textures color or to apply gamma correction.

Default: false

boolean LINEARWRITE
Whether to linearly write the textures color or to apply gamma correction.

Default: false

boolean VERTEXTRANSFORM
Verts are in world space.

Default: false

boolean VERTEXNORMAL
Specify vertex normal (compressed) in material format.

Default: false

boolean ALPHABLEND
Whether or not to enable alpha blend.

Default: false

boolean MULTIPLYCOLOR
Whether or not to multiply src and dest color.

Default: false

boolean WRITEALPHA
Whether or not to enable alpha write.

Default: false

boolean WRITEDEPTH
Whether or not to enable depth write.

Default: false

integer TCSIZE0
Number of components in texture coord0.

Default: 2

integer TCSIZE1
Number of components in texture coord1.

Default: 0

integer TCSIZE2
Number of components in texture coord2.

Default: 0

integer TCSIZE3
Number of components in texture coord3.

Default: 0

integer TCSIZE4
Number of components in texture coord4.

Default: 0

integer TCSIZE5
Number of components in texture coord5.

Default: 0

integer TCSIZE6
Number of components in texture coord6.

Default: 0

integer TCSIZE7
Number of components in texture coord7.

Default: 0

boolean CULL
Culling control - 0 = nocull, 1 = do cull.

Default: 0

boolean DEPTHTEST
Enable depth test.

Default: 0

boolean X360APPCHOOSER
Setting this to 1 allows to supply mesh colors, and to multiply meshes to view projection. It's recommended to be set to 1.
This was a workaround added by Valve for the x360, you should now use $VERTEXCOLOR instead.
boolean IGNOREZ
Whether or not to ignore the ZBuffer.

Default: false

float C0_X
Dummy parameter you can utilise for your custom shader.

Default: 0

float C0_Y
Dummy parameter you can utilise for your custom shader.

Default: 0

float C0_Z
Dummy parameter you can utilise for your custom shader.

Default: 0

float C0_W
Dummy parameter you can utilise for your custom shader.

Default: 0

float C1_X
Dummy parameter you can utilise for your custom shader.

Default: 0

float C1_Y
Dummy parameter you can utilise for your custom shader.

Default: 0

float C1_Z
Dummy parameter you can utilise for your custom shader.

Default: 0

float C1_W
Dummy parameter you can utilise for your custom shader.

Default: 0

float C2_X
Dummy parameter you can utilise for your custom shader.

Default: 0

float C2_Y
Dummy parameter you can utilise for your custom shader.

Default: 0

float C2_Z
Dummy parameter you can utilise for your custom shader.

Default: 0

float C2_W
Dummy parameter you can utilise for your custom shader.

Default: 0

float C3_X
Dummy parameter you can utilise for your custom shader.

Default: 0

float C3_Y
Dummy parameter you can utilise for your custom shader.

Default: 0

float C3_Z
Dummy parameter you can utilise for your custom shader.

Default: 0

float C3_W
Dummy parameter you can utilise for your custom shader.

Default: 0