Garry's Mod Wiki

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.

pix_shader_example.png

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:

Notes:

Shaders can be included in the following content paths: 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).