Custom Shaders
Custom Shaders
What is a Shader?
Shaders are programs written in the HLSL language that run on a computer's graphics card and determine the color of pixels and the position of model vertices.
Shader Example
This is a Shader that affects the color of every pixel on the screen to produce a pixelated retro effect.

How do I make a Shader?
For information about the Shader that is used to create custom Shaders, see: Shaders/screenspace_general
For more information on creating your own Shaders, see:
- Shader Authoring - Valve Developer Community for the Shader authoring process.
- SDK Screenspace Shaders - ficool2 GitHub for more information on screenspace_general.
- SCell555's Shader Compiler for standalone Shader compilation which is useful for Linux/Mac users through Wine/Crossover, or for CI/CD processes. If you encounter
SM1 non-float expression
, it means you have to download the original d3dcompiler for Wine via winetricks. - Srlions's RDNX library a Shader example which draws rounded shapes.
- EthanTheGreat's gm_universe shaders a shader example which draws planets.
- EthanTheGreat's gm_shaderbuild utility a utility that allows you to hotload Shaders for easy development.
- Meetric's shader guide a comprehensive guide to Garry's Mod Shaders.
Notes:
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).