Garry's Mod Wiki

screenspace general

Description

The shader is a wrapper for providing custom pixel (and in some games vector) shaders.

Unfortunately (at the moment of 2024-12-22), the only way for Garry's Mod to find and mount custom .VCS shaders, is to provide them in root garrysmod folder. For other games this is not required, and you can provide .vcs shaders via BSPZIP for an example. Issue describing this is located here

This shader can be used on brushes, decals, info_overlays, models, etc. More detail information about this is listed on ficool2's screenspace shader sdk

Source engine games use game/shaders/fxc (in gmod case it is garrysmod/shaders/fxc) folder to load .vcs shaders. They can be compiled either via this guide on valve wiki

If you are a Linux/Mac user, you can use Wine/Crossover and SCell555's Shader Compiler in order to build your shaders. Keep in mind, that only 2.0b shaders are properly being translated into OpenGL's shaders via ToGL. Some 3.0 shader specifics are available from 2.0b shaders (like screenspace positions) in some specific vendor drivers. If you encounter SM1 non-float expression, then it means you have to download original d3dcompiler for Wine via winetricks.

Example of custom pixel shader.

Example

Parameters

string pixshader
Your supplied custom shader. Must have _ps20 postfix at the end.
ITexture basetexture
Texture that will can be supplied to your shader.
ITexture texture1
Same as basetexture.
ITexture texture2
Same as basetexture.
ITexture texture3
Same as basetexture.
boolean x360appchoser
Setting this to 1 allows to supply mesh colors, and to multiply meshes to view projection. It's recommended to be set to 1
boolean ignorez
Ignores Z buffer if set to 1
number fix_fb
A custom parameter provided by ficool2's sdk, which is set to 32768. Used to transfer it's value to $flags2. It allows FB texture to show up.
number c0_x
This is a dummy parameter which (alongside with basetexture/texture1/2/3) used for supplying custom values to your shader.
number c0_y
Same as c0_x.
number c0_z
Same as c0_x.
number c0_w
Same as c0_x.
number c1_x
Same as c0_x.
number c1_y
Same as c0_x.
number c1_z
Same as c0_x.
number c1_w
Same as c0_x.
number c2_x
Same as c0_x.
number c2_y
Same as c0_x.
number c2_z
Same as c0_x.
number c2_w
Same as c0_x.
number c3_x
Same as c0_x.
number c3_y
Same as c0_x.
number c3_z
Same as c0_x.
number c3_w
Same as c0_x.