Revision Difference
Shaders/screenspace_general#563122
<cat>shader</cat>⤶
<shader>⤶
<description>The shader is a wrapper for providing custom pixel (and in some games vector) shaders.⤶
<bug> 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](https://github.com/Facepunch/garrysmod-requests/issues/2564)</bug>⤶
⤶
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](https://github.com/ficool2/sdk_screenspace_shaders)⤶
⤶
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](https://developer.valvesoftware.com/wiki/Shader_Authoring)⤶
<note>If you are a Linux/Mac user, you can use Wine/Crossover and [SCell555's Shader Compiler](https://github.com/SCell555/ShaderCompile) 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.</note>⤶
⤶
## Example of custom pixel shader.⤶
![Example](https://camo.githubusercontent.com/a748a0904e911587b070babc9ced720995f8e413725d2d35302aa9d52909ba54/68747470733a2f2f692e696d6775722e636f6d2f706237485132542e706e67)⤶
</description>⤶
<parameters>⤶
<item name="pixshader" type="string">Your supplied custom shader. Must have _ps20 postfix at the end.</item>⤶
⤶
<item name="basetexture" type="ITexture">Texture that will can be supplied to your shader.</item>⤶
<item name="texture1" type="ITexture">Same as ``basetexture``.</item>⤶
<item name="texture2" type="ITexture">Same as ``basetexture``.</item>⤶
<item name="texture3" type="ITexture">Same as ``basetexture``.</item>⤶
⤶
<item name="x360appchoser" type="boolean">Setting this to 1 allows to supply mesh colors, and to multiply meshes to view projection. It's recommended to be set to 1</item>⤶
<item name="ignorez" type="boolean">Ignores Z buffer if set to 1</item>⤶
<item name="fix_fb" type="number">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.</item>⤶
<item name="copyalpha" type="boolean"></item>⤶
<item name="alpha_blend_color_overlay" type="boolean"></item>⤶
<item name="alpha_blend" type="boolean"></item>⤶
<item name="linearwrite" type="boolean"></item>⤶
<item name="linearread_basetexture" type="boolean"></item>⤶
<item name="linearread_texture1" type="boolean"></item>⤶
<item name="linearread_texture2" type="boolean"></item>⤶
<item name="linearread_texture3" type="boolean"></item>⤶
⤶
<item name="c0_x" type="number">This is a dummy parameter which (alongside with ``basetexture``/``texture1``/``2``/``3``) used for supplying custom values to your shader.</item>⤶
<item name="c0_y" type="number">Same as ``c0_x``.</item>⤶
<item name="c0_z" type="number">Same as ``c0_x``.</item>⤶
<item name="c0_w" type="number">Same as ``c0_x``.</item>⤶
⤶
<item name="c1_x" type="number">Same as ``c0_x``.</item>⤶
<item name="c1_y" type="number">Same as ``c0_x``.</item>⤶
<item name="c1_z" type="number">Same as ``c0_x``.</item>⤶
<item name="c1_w" type="number">Same as ``c0_x``.</item>⤶
⤶
<item name="c2_x" type="number">Same as ``c0_x``.</item>⤶
<item name="c2_y" type="number">Same as ``c0_x``.</item>⤶
<item name="c2_z" type="number">Same as ``c0_x``.</item>⤶
<item name="c2_w" type="number">Same as ``c0_x``.</item>⤶
⤶
<item name="c3_x" type="number">Same as ``c0_x``.</item>⤶
<item name="c3_y" type="number">Same as ``c0_x``.</item>⤶
<item name="c3_z" type="number">Same as ``c0_x``.</item>⤶
<item name="c3_w" type="number">Same as ``c0_x``.</item>⤶
⤶
</parameters>⤶
⤶
</shader>⤶
⤶