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, or zip into BSP file. 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.If you are trying to make UI shaders, or using constant colors, or if you are using 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.
Parameters
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
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.
boolean linearwrite
Disables gamma-correction on shader's output. If disabled, then gamma-corected output color will be powered to
1/2.2
.boolean linearread_basetexture
If disabled, tries to restore
gamma-corection
on texture, by powering it's color to 2.2. If enabled, it reads raw texture's color.