If you add this file and nothing looks different, that's great news.
This is a direct port of the internal hardcode shaders into an addon. This is for reference to anyone who wants to explore making custom shaders.
Hopefully this can act as a guide to experiment with your own shaders, and can also be used as a starting point.
The contents are explained as follows:
The SHADERS.cfg file and the Shaders folder are required. Everything else is not mandatory, and should be used as necessary, based on what shaders you want to include or modify.
The SHADERS.cfg file only needs to include the targets you want to replace. The shaders can be named however you want, but in a pk3, they must start with sh_, and must match the name in the SHADERS.cfg file.
If you want to learn more about shaders, I suggest researching GLSL. This is the shader language used here, and more info can be found in resources such as https://www.khronos.org/opengl/wiki/OpenGL_Shading_Language
Here is a good guide by Hannu_Hanhi that goes into more detail about shaders in SRB2.
https://git.do.srb2.org/Hannu_Hanhi/SRB2/wikis/SRB2-Shader-Guide
I have a script I use to assist in my workflow.
This is a windows bat script that assumes you have 7zip installed in the default directory.
If you use this, you can use it as follows:
As these are shaders, it's for opengl only.
The shaders are up to date as of the 2.2.9 pre-release.
Have fun exploring the world of shaders!
This is a direct port of the internal hardcode shaders into an addon. This is for reference to anyone who wants to explore making custom shaders.
Hopefully this can act as a guide to experiment with your own shaders, and can also be used as a starting point.
The contents are explained as follows:
SHADERS.cfg | The config that maps the shaders to their targets |
Ref.txt | A file that has some hardcode references and some more info |
Shaders | A folder that contains the actual shader code |
sh_DefaultFS.glsl | Default Fragment shader, unused |
sh_DefaultVS.glsl | Default Vertex shader, used by most targets |
sh_FogFS.glsl | The fragment shader for fog |
sh_ModelLightingFS.glsl | The fragment shader for model lighting |
sh_ModelLightingVS.glsl | The vertex shader for model lighting |
sh_SkyFS.glsl | The sky dome fragment shader |
sh_SoftwareFS.glsl | The standard fragment shader used by most targets |
sh_WaterRippleFS.glsl | The fragment shader used by liquids |
The SHADERS.cfg file and the Shaders folder are required. Everything else is not mandatory, and should be used as necessary, based on what shaders you want to include or modify.
The SHADERS.cfg file only needs to include the targets you want to replace. The shaders can be named however you want, but in a pk3, they must start with sh_, and must match the name in the SHADERS.cfg file.
If you want to learn more about shaders, I suggest researching GLSL. This is the shader language used here, and more info can be found in resources such as https://www.khronos.org/opengl/wiki/OpenGL_Shading_Language
Here is a good guide by Hannu_Hanhi that goes into more detail about shaders in SRB2.
https://git.do.srb2.org/Hannu_Hanhi/SRB2/wikis/SRB2-Shader-Guide
I have a script I use to assist in my workflow.
Compile.bat:
for %%I in (.) do set CurrDirName=%%~nxI
set fileName=%CurrDirName%.pk3
"C:\Program Files\7-Zip\7z.exe" a -tzip -x"!%~nx0" -x"!%fileName%" "%fileName%" "*"
If you use this, you can use it as follows:
- Create a named folder for what you want your pk3 to be called.
- Add this bat file into the folder, and add the other parts required for the shader.
- Modify the files freely.
- When you are ready to test your shader, run the bat.
- It will compile the parts in the folder into a pk3 named after the folder that can be added.
- You can re-run the script and it will recreate the pk3 with the latest changes.
As these are shaders, it's for opengl only.
The shaders are up to date as of the 2.2.9 pre-release.
Have fun exploring the world of shaders!