Overview: shaders.properties
The shaders.properties
is a text file placed in the shaders
folder that allows for configuring many options of a shaderpack. This file has two main purposes:
- Configuring and displaying user accessible shader options
- Configuring internal shader settings
Internal Shader Settings
The file can contain any of the properties described in this section, in any order. These properties control both aspects of the shader itself, and allow for defining user accessible shader options. For example:
Preprocessor directives can be used inside this file based on shader option macros, which are defined automatically. However, you cannot use #define
or #include
in shaders.properties
.
Shader Options
Iris lets you use preprocessor directives to define user options. These macros should be defined in the shader files using #define
. The value of an option can be checked in shader files with #ifdef
, #ifndef
, #if
, etc. The option must be defined in all files which it is used in, and if it is defined in multiple files it must be defined identically in all files. Lastly, add the option name to screen
list to add the shader option to the “Shader Pack Settings” screen. sliders
and profile
can further be used to control the layout of these options.
Boolean Option
A boolean option can be defined and checked in shader code with like the following:
The option will be “on” (defined) by default, however commenting out the #define line will keep the option but make the default value “off” (not defined).
Optionally, a comment after the macro can be used to add a description to the option, shown when hovering over the option in the “Shader Pack Settings” screen.
#if defined
can be used to check multiple options in one line (for example see below). However for Iris/Optifine to recognize a boolean option, it must be checked at least once using #ifdef
or #ifndef
.
Numerical/Other Option
Any non-boolean option, such as a float or int, can be defined by specifying a value with the define:
A comment should be placed after the macro, and the possible values for the option should be placed square brackets directly after the comment starts. The values should be separated by spaces only. Any text after the values list will be treated as a description for the option, shown when hovering over the option in the “Shader Pack Settings” screen.
These options can be used directly in shader code like a variable, and will be replaced with the option’s value before compilation. Additionally, int options only can be checked using #if
.
Constants
Iris/Optifine define numerous constants to control certain settings (see the Constants section). If a value list is added in a comment after the declaration of a numeric const, it can be added to the shaders screen like a shader define option. For example: