You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|[`entityColor`](/current/reference/uniforms/rendering#entitycolor)|[`vaUV1`](/current/reference/attributes/vauv1) (not recommended, even in `core`) | entity overlay |
OptiFine/Iris support four different texture types, which are specified in the `<path>` parameter.
19
19
20
-
#### Images from shader files
20
+
#### Textures from shader pack files
21
21
Image files can be loaded from the shader pack files by replacing `<path>` with the file path to the image relative to the `shaders` folder. For example `texture.composite.colortex5 = textures/perlin.png` would load `perlin.png` from the `shaders/textures` folder. Iris supports only `.png` image format, whereas OptiFine supports `.png` and `.jpg` formats.
22
22
23
23
#### Textures from game files / resource packs
@@ -26,7 +26,7 @@ Textures can also be loaded from the resource pack by replacing `<path>` with `m
26
26
#### Atlas and dynamic textures
27
27
Atlas textures (such as the block atlas) can be loaded by passing their file path, starting with `minecraft:textures/atlas/`. For example, `texture.composite.colortex9 = minecraft:textures/atlas/blocks.png` loads the block atlas into `colortex9`. A list of available texture atlases can be found in the [Minecraft Wiki](https://minecraft.wiki/w/Texture_atlas#Navigation) under "Procedurally-generated" in the Navigation table.
28
28
29
-
Additionally, the lightmap dynamic texture can be loaded using either `minecraft:dynamic/lightmap_1` or `minecraft:dynamic/light_map_1`. This texture is equivalent to the `lightmap` sampler used in [gbuffers](/current/reference/programs/gbuffers). For example `texture.prepare.colortex2 = minecraft:dynamic/lightmap_1` loads the lightmap into `colortex2`.
29
+
Additionally, the lightmap dynamic texture can be loaded using either `minecraft:dynamic/lightmap_1` or `minecraft:dynamic/light_map_1`. This texture is equivalent to the `lightmap` sampler used in [gbuffers](/current/reference/programs/gbuffers). For example `texture.prepare.colortex2 = minecraft:dynamic/lightmap_1` loads the lightmap into `colortex2`.
30
30
31
31
#### Raw textures
32
32
Raw textures can be loaded from the shader files, similarly to image files. However raw textures are uncompressed binary files, where the bytes represent the values in the texture directly. Raw files can also encode 3D textures, and the texture format can be directly controlled (images are always loaded as RGBA8). To use a raw texture, add the following parameters to the custom texture directive:
@@ -62,6 +62,10 @@ When using the OptiFine specification, replace `<stage>` with the stage of progr
|`composite`|[`composite`](/current/reference/programs/composite) and [`final`](/current/reference/programs/final) programs |
64
64
65
+
:::caution[Warning]
66
+
On Iris, binding a custom texture to the `composite` stage will also bind it in the `final` program. OptiFine does not do this, and as such in OptiFine there is no way to bind a custom texture to the `final` program.
Iris adds support for the `customTexture` directive, which allows a custom texture to be accessed via a different sampler instead of overriding an existing sampler. This allows creation of a sampler of (mostly) any name, which replaces `<name>` in the directive and is used in the shader code. Otherwise, the syntax of the enhanced custom textures are identical to standard custom textures.
@@ -99,4 +103,4 @@ Hardware bilinear filtering and wrapping/clamping behavior can be controlled wit
99
103
100
104
By default, image files will use nearest neighbor and wrapping, and raw textures will use bilinear filtering and clamping. Shader provided mcmeta files cannot be used for resource pack / atlas textures.
Copy file name to clipboardExpand all lines: src/content/docs/current/Reference/Buffers/depthtex.mdx
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,15 +19,7 @@ These buffers can be read from any program, but will contain garbage data until
19
19
20
20
#### Writing
21
21
22
-
These buffers are automatically written to by [`gbuffers`](/current/reference/programs/gbuffers) programs, and store the screenspace z coordinate at each pixel. You can manually write to this buffer by setting the `gl_FragDepth` variable in any `gbuffers` fragment shader. If `gl_FragDepth` is used in a shader, the automatic writing will be disabled and the shader is responsible for writing all depth values.
23
-
24
-
#### Size
25
-
26
-
These buffers are the same resolution as the Minecraft window. This cannot be configured.
27
-
28
-
#### Format / precision
29
-
30
-
These buffers only store information in a single channel, the `r` component. The depth buffer precision is hardware / driver dependent. However, most hardware uses either 24-bit or 32-bit (`R24` or `R32`) precision.
22
+
These buffers are automatically written to by [`gbuffers`](/current/reference/programs/gbuffers) programs, and store the screenspace z coordinate at each pixel. You can manually write to this buffer by setting the `gl_FragDepth` variable in the fragment shader. If `gl_FragDepth` is used, it must have a value assigned for all execution paths. For more information see [the OpenGL Docs](https://registry.khronos.org/OpenGL-Refpages/gl4/html/gl_FragDepth.xhtml).
31
23
32
24
:::tip
33
25
The default (automatic) behavior of writing to the depth buffer is as follows:
@@ -36,6 +28,14 @@ gl_FragDepth = gl_FragCoord.z;
36
28
```
37
29
:::
38
30
31
+
#### Size
32
+
33
+
These buffers are the same resolution as the Minecraft window. This cannot be configured.
34
+
35
+
#### Format / precision
36
+
37
+
These buffers only store information in a single channel, the `r` component. The depth buffer precision is hardware / driver dependent. However, most hardware uses either 24-bit or 32-bit (`R24` or `R32`) precision.
38
+
39
39
#### Clearing
40
40
41
41
All these buffers clear to `vec4(1.0)`. This cannot be configured.
**Buffers** are dedicated memory used to temporarily store color data, depth information, and other rendering details. They are most commonly used in shader programming to hold **textures**, but can also be used for [shader storage buffer objects](/current/reference/buffers/ssbo). Buffers are accessed through sampling a `sampler2D` uniform.
9
+
**Buffers** are dedicated areas of memory used to temporarily store color data, depth information, or any other information used for rendering. The following are buffers Iris/OptiFine make available by default, some of which can be written to and read from, and some of which can only be read from.
<sup>*Configurable in [shaders.properties](current/reference/shadersproperties/overview)</sup><br/>
19
+
<sup>*Configurable</sup><br/>
20
+
<sup>†Dependent on drivers</sup>
19
21
20
-
<sup>†Dependent on drivers</sup>
22
+
Also provided are three [texture atlases](/reference/Buffers/atlases.mdx). These have the format `RGBA8` and their resolution can be determined with [`atlasSize`](https://shaders.properties/current/reference/uniforms/rendering/#atlassize).
23
+
24
+
On Iris, additional buffers can be created through through the use of [custom textures](/reference/buffers/custom_textures/), [custom images](/reference/buffers/custom_images/), and [SSBOs](/reference/buffers/ssbo/)
Copy file name to clipboardExpand all lines: src/content/docs/current/Reference/Buffers/shadowtex.mdx
+11-5Lines changed: 11 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,11 +16,17 @@ There are two samplers for accessing the shadow depth buffer.
16
16
17
17
#### Writing
18
18
19
-
These buffers are automatically written to by the [`shadow`](/current/reference/programs/gbuffers) program, and store the screenspace z coordinate at each pixel. You can manually write to this buffer by setting the `gl_FragDepth` variable in any `gbuffers`fragment shader. If `gl_FragDepth` is used in a shader, the automatic writing will be disabled and the shader is responsible for writing all depth values.
19
+
These buffers are automatically written to by the [`shadow`](/current/reference/programs/shadow) and [`shadow_*`](/current/reference/programs/shadow/#additional-shadow-programs-iris-18) programs, and store the screenspace z coordinate at each pixel. You can manually write to this buffer by setting the `gl_FragDepth` variable in the fragment shader. If `gl_FragDepth` is used, it must have a value assigned for all execution paths. For more information see [the OpenGL Docs](https://registry.khronos.org/OpenGL-Refpages/gl4/html/gl_FragDepth.xhtml).
20
20
21
-
#### Size
21
+
:::tip
22
+
The default (automatic) behavior of writing to the depth buffer is as follows:
23
+
```glsl
24
+
gl_FragDepth = gl_FragCoord.z;
25
+
```
26
+
:::
22
27
23
-
These buffers are the same resolution as the Minecraft window. This cannot be configured.
28
+
#### Size
29
+
These buffers default to the shadow pass resolution, which can be controlled with the [`shadowMapResolution`](/current/reference/constants/shadowmapresolution) constant.
24
30
25
31
#### Format / precision
26
32
@@ -38,6 +44,6 @@ These buffers do not flip.
38
44
The alias `waterShadow` points to the same buffer as `shadowtex0`. If `waterShadow` is present anywhere in the code, then the alias `shadow` will point to the same buffer as `shadowtex1`, otherwise it will point to the buffer `shadowtex0`.
39
45
40
46
## Hardware Sampling
41
-
[`shadowHardwareFiltering`](/current/reference/constants/shadowhardwarefiltering) enables support hardware sampling (depth comparison mode) for hardware shadow filtering. This turns the shadowtex samplers into `sampler2DShadow` samplers, which when sampled take the full `xyz` coordinates of the shadow position. The passed `z` coordinate is then compared to the values in the buffer around the `xy` coordinate, and the result is the weighted average of these comparisons. This produces a filtering effect on the shadow with very little to no performance impact. More information can be found in the [Khronos Wiki](https://www.khronos.org/opengl/wiki/Sampler_Object#Comparison_mode).
47
+
[`shadowHardwareFiltering`](/current/reference/constants/shadowhardwarefiltering) enables hardware filtering (depth comparison mode). This turns the shadowtex samplers into `sampler2DShadow` samplers, which when sampled take the full `xyz` coordinates of the shadow position. The passed `z` coordinate is then compared to the values in the buffer around the `xy` coordinate, and the result is the weighted average of these comparisons. This produces a filtering effect on the shadow with very little to no performance impact. More information can be found in the [Khronos Wiki](https://www.khronos.org/opengl/wiki/Sampler_Object#Comparison_mode).
42
48
43
-
When hardware sampling is used, the texture read no longer returns the distance stored in the buffer, but the result of a filtering depth comparison. This prevents its use in algorithms such as PCSS that rely on the actual value stored in the buffer. However, Iris enables the use of separate buffers for hardware sampling, `shadowtex0HW` and `shadowtex1HW`, while retaining the original functionality on the base shadowtex buffers. This requires the [`SEPARATE_HARDWARE_SAMPLERS`](/current/reference/shadersproperties/flags) feature flag as well as setting [`shadowHardwareFiltering`](/current/reference/constants/shadowhardwarefiltering) to true.
49
+
When hardware sampling is used, the texture read no longer returns the distance stored in the buffer, but the result of a filtering depth comparison. This prevents its use in algorithms such as PCSS that rely on the actual value stored in the buffer. However, Iris enables the use of separate buffers for hardware sampling, `shadowtex0HW` and `shadowtex1HW`, while retaining the original functionality on the base shadowtex buffers. This requires the [`SEPARATE_HARDWARE_SAMPLERS`](/current/reference/shadersproperties/flags) feature flag as well as setting [`shadowHardwareFiltering`](/current/reference/constants/shadowhardwarefiltering) to true.
Copy file name to clipboardExpand all lines: src/content/docs/current/Reference/Constants/shadow_mipmaps.mdx
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,9 +17,9 @@ sidebar:
17
17
18
18
---
19
19
20
-
These directives tells Iris to generate a mipmap chain for a [shadowtex](/current/reference/buffers/shadowtex) buffer. This directive only needs to be defined once in the shader pack, and can be defined in (mostly) any shader file. The mipmap will be generated after the [`shadow`](/current/reference/programs/shadow) pass but before [`shadowcomp`](/current/reference/programs/shadow_comp).
20
+
These directives tell Iris to generate a mipmap chain for a given [shadowtex](/current/reference/buffers/shadowtex) buffer. Each one only needs to be defined once in the shader pack, and can be defined in (mostly) any shader file. The mipmap will be generated after the [`shadow`](/current/reference/programs/shadow) pass but before [`shadowcomp`](/current/reference/programs/shadow_comp).
21
21
22
-
`generateShadowMipmap` will generate mipmaps for both `shadowtex0` and `shadowtex1`, whereas `shadowtexMipmap` will generate mipmaps for only `shadowtex0`.
22
+
`generateShadowMipmap` will generate mipmaps for both `shadowtex0` and `shadowtex1`.
23
23
24
24
25
25
## ShadowColor
@@ -38,6 +38,6 @@ These directives tells Iris to generate a mipmap chain for a [shadowtex](/curren
38
38
These directives are currently bugged. Mipmap chains for shadowcolor buffers will *not* be generated. Mipmaps for shadowtex buffers work as intended.
39
39
:::
40
40
41
-
These directives tells Iris to generate a mipmap chain for a [shadowcolor](/current/reference/buffers/shadowcolor) buffer. This directive only needs to be defined once in the shader pack, and can be defined in (mostly) any shader file. The mipmap will be generated after the [`shadow`](/current/reference/programs/shadow) pass but before [`shadowcomp`](/current/reference/programs/shadow_comp).
41
+
These directives tell Iris to generate a mipmap chain for a [shadowcolor](/current/reference/buffers/shadowcolor) buffer. This directive only needs to be defined once in the shader pack, and can be defined in (mostly) any shader file. The mipmap will be generated after the [`shadow`](/current/reference/programs/shadow) pass but before [`shadowcomp`](/current/reference/programs/shadow_comp).
42
42
43
-
`generateShadowColorMipmap` will generate mipmaps for both `shadowcolor0` and `shadowcolor1`.
43
+
`generateShadowColorMipmap` will generate mipmaps for both `shadowcolor0` and `shadowcolor1`.
description: Compile time constants providing information about the environment.
4
4
sidebar:
5
5
label: Overview
6
6
order: 1
7
7
---
8
8
9
-
Macros are a way of getting data, typically metadata about Iris itself, Minecraft, or hardware. Macros have two distinct categories:
10
-
1.**Value** macros: Iris will set the value of a macro to some data.
11
-
2.**Boolean** macros: Iris will define a macro if its criteria is met. This can be tested using the `ifdef` and `ifndef` directives.
9
+
Macros are compile time constants that provide information about the environment Iris/OptiFine is running in. For more information, see the [OpenGL Docs on Preprocessor directives](https://www.khronos.org/opengl/wiki/Core_Language_(GLSL)#Preprocessor_directives).
Copy file name to clipboardExpand all lines: src/content/docs/current/Reference/Miscellaneous/debug_mode.mdx
+8-3Lines changed: 8 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,8 +11,13 @@ Iris provides a debug mode with several features to facilitate development of sh
11
11
1. In the in-game Shader Selection screen (`Options > Video Settings > Shader Packs`, default keybind <kbd>O</kbd>) press <kbd>Ctrl + D</kbd> (Windows / Linux) or <kbd>Cmd + D</kbd> (macOS)
12
12
2. Set the `enableDebugOptions` field to `true` in Iris's settings file (`/config/iris.properties`)
13
13
14
+
:::caution[Warning]
15
+
On some GPU drivers, such as the AMD driver on Windows, enabling debug mode can cause the game to crash on startup. This can be resolved by setting `use_no_error_g_l_context` to `false` in `.minecraft/config/sodium-options.json` or by disabling the no error context in the game's settings (if you have the power of foresight).
16
+
:::
17
+
14
18
Debug mode's features are as follows:
15
19
16
-
-**Pretty printing**: code generated by the [Iris patcher](/current/reference/miscellaneous/patcher) is saved to `/patched_shaders/`
17
-
-**Error window**: when an error in a shader is encountered, the error is presented to a pop-up window in-game
18
-
-**Parity**: patched shader code more accurately represents the source code. As of right now, this only prevents the patcher from deleting unused functions
20
+
-**Patched code output**: code generated by the [Iris patcher](/current/reference/miscellaneous/patcher) is saved to `/patched_shaders/`. This is useful because
21
+
- The line numbers Iris provides in error messages correspond to this patched code, not your original code.
22
+
- The patcher can occasionally make mistakes, especially if your code is malformed in some way. Being able to see the output it produces is crucial in resolving these issues.
23
+
-**Error window**: If the shader fails to compile, the error message will be displayed directly on the screen, instead of only being printed to the log.
0 commit comments