|
Configs /
ShadersWhat are the shaders?Shaders are basically small programs which are run on your videocard for every vertex and pixel rendered. What are shaders used for in Boson?In Boson, shaders can be used for:
Shader filenamesIn Boson, shaders are specified by names. Such names might be unit or ground-default. Note that the names do not have any extensions. This is because Boson supports different quality levels for shaders and filename is composed of the shader name, quality suffix and .shader extension. <shader name><quality suffix>.shader
Quality suffix can be one of -vhi, -hi, -med and -low. When Boson is running, user can select a quality level and a list of allowed suffixes is composed. For example, when user selects "Medium" as shader quality level, then the suffix list would be -med,-low. When looking for a shader with name unit, Boson would then first look for a file unit-med.shader, then for unit-low.shader and finally for file without any quality suffix - unit.shader. Of those, first file which actually exists is used. Preprocessor and #includeBoson's shader preprocessor supports #include directive, so you can easily break your shader into multiple reusable files and then #include them into the main shader. #include "unit.shader"
#include "unit"
You can use <unit> instead of "unit" if you like, there is no difference between them. Vertex and fragment shaderBoson doesn't use different files for vertex and fragment shaders (because by nature they belong together and thus I've found it easier to have both shaders in the same file when editing them). Instead, it uses special markers to let you specify which part of the shader file should be used for vertex shader and which for the fragment shader. |