diff --git a/src/content/docs/current/Guides/Your First Shaderpack/4_shadows.mdx b/src/content/docs/current/Guides/Your First Shaderpack/4_shadows.mdx index db12fd98..31cb13e9 100644 --- a/src/content/docs/current/Guides/Your First Shaderpack/4_shadows.mdx +++ b/src/content/docs/current/Guides/Your First Shaderpack/4_shadows.mdx @@ -316,7 +316,7 @@ float shadow = step(shadowScreenPos.z, texture(shadowtex0, shadowScreenPos.xy).r with -``` +```glsl vec3 shadow = getShadow(shadowScreenPos); ``` diff --git a/src/content/docs/current/How To/coordinate_spaces.mdx b/src/content/docs/current/How To/coordinate_spaces.mdx index 7424e59f..17cac4cc 100644 --- a/src/content/docs/current/How To/coordinate_spaces.mdx +++ b/src/content/docs/current/How To/coordinate_spaces.mdx @@ -49,4 +49,4 @@ It is also worth noting that in third person mode, view bobbing is disabled, and ## Shadow Space "Shadow Space" can refer to a number of different coordinate spaces, all of which are used for the [shadow pass](/current/reference/programs/shadow/). As such, the "shadow" versions of coordinate spaces are generally equivalent to their normal versions but from the perspective of the shadow camera (the sun/moon). The shadow spaces include **shadow view space**, **shadow clip space**, **shadow NDC space**, and **shadow screen space**. -In the [shadow pass](/current/reference/programs/shadow/), the same base matrices are used ([`modelViewMatrix`](/current/reference/uniforms/matrices/#modelviewmatrix), [`projectionMatrix`](/current/reference/uniforms/matrices/#projectionmatrix), etc), or the `shadow` matrix uniforms (e.g. [`shadowModelView`](/current/reference/uniforms/matrices/#shadowmodelview), [`shadowProjection`](/current/reference/uniforms/matrices/#shadowprojection)) can be used from any program. When sampling the shadow map, positions can be transformed into **player space**, and from there back into *shadow screen space*. +In the [shadow pass](/current/reference/programs/shadow/), the same base matrices are used ([`gl_ModelViewMatrix`](/current/reference/uniforms/matrices/#gl_modelviewmatrix), [`gl_ProjectionMatrix`](/current/reference/uniforms/matrices/#gl_projectionmatrix), etc), or the `shadow` matrix uniforms (e.g. [`shadowModelView`](/current/reference/uniforms/matrices/#shadowmodelview), [`shadowProjection`](/current/reference/uniforms/matrices/#shadowprojection)) can be used from any program. When sampling the shadow map, positions can be transformed into **player space**, and from there back into *shadow screen space*. diff --git a/src/content/docs/current/Reference/Attributes/ftransform.mdx b/src/content/docs/current/Reference/Attributes/ftransform.mdx new file mode 100644 index 00000000..d9bcbe08 --- /dev/null +++ b/src/content/docs/current/Reference/Attributes/ftransform.mdx @@ -0,0 +1,27 @@ +--- +title: ftransform +description: The vertex position in clip space. +sidebar: + label: ftransform + order: 2 +--- + +### `ftransform` + +**Valid Programs**: `*.vsh` + +--- + +Function returning the vertex position in clip space. + +```glsl +/* + vec3 model_pos = gl_Vertex.xyz; + vec4 view_pos = gl_ModelViewMatrix * vec4(model_pos, 1.0); + vec4 clip_pos = gl_ProjectionMatrix * view_pos; +*/ + +vec4 clip_pos = ftransform(); // Equivalent to the above, not accounting for possible rounding differences. + +gl_Position = clip_pos; +``` diff --git a/src/content/docs/current/Reference/Attributes/gl_Color.mdx b/src/content/docs/current/Reference/Attributes/gl_Color.mdx index ce56c2b0..0ad518f7 100644 --- a/src/content/docs/current/Reference/Attributes/gl_Color.mdx +++ b/src/content/docs/current/Reference/Attributes/gl_Color.mdx @@ -16,12 +16,14 @@ The vertex color attribute. The color attribute is often used to apply tints to colored blocks such as leaves, grass, water, etc. It also contains the [vanilla ambient occlusion](/current/reference/constants/ambientocclusionlevel/) and, if enabled, the [old lighting](/current/reference/shadersproperties/features/#oldlighting). -Enabling [`separateAo`](/current/reference/shadersproperties/features/#separateao) will move the ambient occlusion from the `rgb` components of `gl_Color` to the `a` component, which can be applied later like this: +Enabling [`separateAo`](/current/reference/shadersproperties/features/#separateao) will move the ambient occlusion from the `rgb` components of `gl_Color` to the `a` component in terrain programs, which can be applied later like this: ```glsl vec3 color = gl_Color.rgb * gl_Color.a; ``` +The `a` component includes tint for alpha in some non-terrain programs. + ### `in vec4 vaColor;` :::danger diff --git a/src/content/docs/current/Reference/Attributes/mc_chunkFade.mdx b/src/content/docs/current/Reference/Attributes/mc_chunkFade.mdx index a7be04cd..d2e5fc66 100644 --- a/src/content/docs/current/Reference/Attributes/mc_chunkFade.mdx +++ b/src/content/docs/current/Reference/Attributes/mc_chunkFade.mdx @@ -21,4 +21,4 @@ The fade-in progress of the geometry. This value is a `float` automatically decl In `gbuffers_terrain.vsh`, the value will be a float in the range 0-1. In all other gbuffers programs, it will be declared as `const float mc_chunkFade = -1.0;`. -The variable will not be declared if the `FADE_VARIABLE` [feature flag](/current/reference/shadersproperties/flags/) is not available. You should check if the feature is available when using the variable. \ No newline at end of file +The variable will not be declared if the `FADE_VARIABLE` [feature flag](/current/reference/shadersproperties/flags/) is not available. You should check if the feature is available when using the variable. diff --git a/src/content/docs/current/Reference/Buffers/ssbo.mdx b/src/content/docs/current/Reference/Buffers/ssbo.mdx index 4ca674d8..c73ecdaf 100644 --- a/src/content/docs/current/Reference/Buffers/ssbo.mdx +++ b/src/content/docs/current/Reference/Buffers/ssbo.mdx @@ -25,14 +25,14 @@ SSBOs require OpenGL 4.3 support, which macOS does not have. For more informatio ### Fixed Size SSBOs To define the SSBO with a fixed size, put the following in [`shaders.properties`](/current/reference/shadersproperties/overview/) and replace `` with the total size of the SSBO in bytes and replace `` with a unique value from 0 to 8. -``` +```properties bufferObject. = ``` ### Screen-Sized SSBOs SSBOs can also be defined as screen-sized (Iris 1.6.6 and later), where their size is relative to the screen dimensions. This is useful for storing data per-pixel. To use this, put the following in [`shaders.properties`](/current/reference/shadersproperties/overview/). -``` +```properties bufferObject. = ``` @@ -75,4 +75,4 @@ void main() { ## Initialization Data File (Iris 1.8+) ### `bufferObject. = ` -Iris 1.8 adds support for initializing an SSBO with data from a binary file. Simply append the file path to the end of the SSBO declaration in [`shaders.properties`](/current/reference/shadersproperties/overview/). The value is be initialized at on shader load/reload. This works with only fixed sized SSBOs, and if the size of the file is bigger than the SSBO Iris will throw an error. If the file is smaller than the SSBO, the remaining data in the SSBO will be uninitialized (and is likely to be garbage data). \ No newline at end of file +Iris 1.8 adds support for initializing an SSBO with data from a binary file. Simply append the file path to the end of the SSBO declaration in [`shaders.properties`](/current/reference/shadersproperties/overview/). The value is be initialized at on shader load/reload. This works with only fixed sized SSBOs, and if the size of the file is bigger than the SSBO Iris will throw an error. If the file is smaller than the SSBO, the remaining data in the SSBO will be uninitialized (and is likely to be garbage data). diff --git a/src/content/docs/current/Reference/Macros/MAX_COLOR_BUFFERS.mdx b/src/content/docs/current/Reference/Macros/MAX_COLOR_BUFFERS.mdx new file mode 100644 index 00000000..25c0bf84 --- /dev/null +++ b/src/content/docs/current/Reference/Macros/MAX_COLOR_BUFFERS.mdx @@ -0,0 +1,14 @@ +--- +title: MAX_COLOR_BUFFERS +description: Maximum colortex texture count. +sidebar: + label: MAX_COLOR_BUFFERS + order: 2 + badge: + text: Iris Only (1.10.5+) + variant: tip +--- + +### `MAX_COLOR_BUFFERS` + +The maximum number of [colortex](/current/reference/buffers/colortex/) textures that a shader pack can use. diff --git a/src/content/docs/current/Reference/Macros/MC_GLSL_VERSION.mdx b/src/content/docs/current/Reference/Macros/MC_GLSL_VERSION.mdx index 66a314ff..70ace90c 100644 --- a/src/content/docs/current/Reference/Macros/MC_GLSL_VERSION.mdx +++ b/src/content/docs/current/Reference/Macros/MC_GLSL_VERSION.mdx @@ -8,4 +8,4 @@ sidebar: ### `MC_GLSL_VERSION` -The maximum GLSL version supported by the system. For example: 120, 330, 460, etc. \ No newline at end of file +The maximum GLSL version supported by the system. For example: 120, 330, 460, etc. diff --git a/src/content/docs/current/Reference/Macros/MC_GL_VERSION.mdx b/src/content/docs/current/Reference/Macros/MC_GL_VERSION.mdx index eb3071dd..7d65dbe6 100644 --- a/src/content/docs/current/Reference/Macros/MC_GL_VERSION.mdx +++ b/src/content/docs/current/Reference/Macros/MC_GL_VERSION.mdx @@ -13,4 +13,4 @@ The maximum OpenGL version supported by the system, encoded in an integer format For example: - OpenGL 2.1 -> 210 - OpenGL 3.3 -> 330 -- OpenGL 4.6 -> 460 \ No newline at end of file +- OpenGL 4.6 -> 460 diff --git a/src/content/docs/current/Reference/Macros/MC_HAND_DEPTH.mdx b/src/content/docs/current/Reference/Macros/MC_HAND_DEPTH.mdx index 4fed5112..76493d22 100644 --- a/src/content/docs/current/Reference/Macros/MC_HAND_DEPTH.mdx +++ b/src/content/docs/current/Reference/Macros/MC_HAND_DEPTH.mdx @@ -10,9 +10,9 @@ sidebar: The clip space depth multiplier applied to geometry in [`gbuffers_hand`](/current/reference/programs/gbuffers/) and [`gbuffers_hand_water`](/current/reference/programs/gbuffers/). -The multiplier is applied in clip space automatically through the [projection matrix](/current/reference/uniforms/matrices/#projectionMatrix). When working backwards from the depth buffer, the multiplier should be applied in NDC space rather than screen space to produce the correct result, for example: +The multiplier is applied in clip space automatically through the [projection matrix](/current/reference/uniforms/matrices/#gl_projectionMatrix). When working backwards from the depth buffer, the multiplier should be applied in NDC space rather than screen space to produce the correct result, for example: ```glsl float screenDepth = textureLod(depthtex0, texcoord, 0.0).r; float ndcDepth = (screenDepth * 2.0 - 1.0) / MC_HAND_DEPTH; -``` \ No newline at end of file +``` diff --git a/src/content/docs/current/Reference/Macros/MC_MIPMAP_LEVEL.mdx b/src/content/docs/current/Reference/Macros/MC_MIPMAP_LEVEL.mdx new file mode 100644 index 00000000..3ca9cee6 --- /dev/null +++ b/src/content/docs/current/Reference/Macros/MC_MIPMAP_LEVEL.mdx @@ -0,0 +1,14 @@ +--- +title: MC_MIPMAP_LEVEL +description: The current maximum mipmap level. +sidebar: + label: MC_MIPMAP_LEVEL + order: 2 + badge: + text: Iris Only (1.8.1+) + variant: tip +--- + +### `MC_MIPMAP_LEVEL` + +The current maximum mipmap level. diff --git a/src/content/docs/current/Reference/Uniforms/camera.mdx b/src/content/docs/current/Reference/Uniforms/camera.mdx index 0168f62c..2327b6d4 100644 --- a/src/content/docs/current/Reference/Uniforms/camera.mdx +++ b/src/content/docs/current/Reference/Uniforms/camera.mdx @@ -113,6 +113,24 @@ This value stores the world aligned direction the player model's head is facing. ---------------- +## vehicleLookVector +```glsl +uniform vec3 vehicleLookVector; +``` +This value stores the world aligned direction that the currently used vehicle's model's head is facing. + +---------------- + + +## relativeVehiclePosition +```glsl +uniform vec3 relativeVehiclePosition; +``` +This value stores the world space offset from the position of the currently used vehicle to the camera's position. + +---------------- + + ## upPosition ```glsl uniform vec3 upPosition; @@ -153,4 +171,4 @@ This uniform stores the value in the depth buffer `depthtex0` at the center of t ```glsl uniform bool firstPersonCamera; ``` -This value is `true` when the player is in the first person camera view and `false` in any third person camera view. \ No newline at end of file +This value is `true` when the player is in the first person camera view and `false` in any third person camera view. diff --git a/src/content/docs/current/Reference/Uniforms/id.mdx b/src/content/docs/current/Reference/Uniforms/id.mdx index 57783e33..433fcd20 100644 --- a/src/content/docs/current/Reference/Uniforms/id.mdx +++ b/src/content/docs/current/Reference/Uniforms/id.mdx @@ -28,6 +28,15 @@ This uniform stores the ID (from [`block.properties`](/current/reference/miscell ---------------- +## vehicleId +```glsl +uniform int vehicleId; +``` +This uniform stores the ID (from [`entity.properties`](/current/reference/miscellaneous/entity_properties/)) of the vehicle currently used by the player. Value is `0` if no [`entity.properties`](/current/reference/miscellaneous/entity_properties/) is present. Value `65535` if [`entity.properties`](/current/reference/miscellaneous/entity_properties/) is present and the entity is not in the file. + +---------------- + + ## currentRenderedItemId ```glsl uniform int currentRenderedItemId; @@ -96,7 +105,4 @@ uniform int heldBlockLightValue2; ``` The light strength of the item held in the player's offhand. This ranges from `0`-`15` for vanilla blocks, however some modded blocks may have a higher value. - ---------------- - - diff --git a/src/content/docs/current/Reference/Uniforms/matrices.mdx b/src/content/docs/current/Reference/Uniforms/matrices.mdx index 8d94cacf..ec677629 100644 --- a/src/content/docs/current/Reference/Uniforms/matrices.mdx +++ b/src/content/docs/current/Reference/Uniforms/matrices.mdx @@ -35,7 +35,7 @@ Equal to [`inverse(gbufferModelView)`](/current/reference/uniforms/matrices/#gbu ```glsl uniform mat4 gbufferProjection; ``` -Equal to the [`projectionMatrix`](/current/reference/uniforms/matrices/#projectionmatrix) used by all [gbuffers programs](/current/reference/programs/gbuffers/) except for `gbuffers_hand` and `gbuffers_hand_water`, where the [`projectionMatrix`](/current/reference/uniforms/matrices/#projectionmatrix) multiplies the Z axis by `MC_HAND_DEPTH` to move the hand closer to the camera than the rest of the world. +Equal to the [`gl_ProjectionMatrix`](/current/reference/uniforms/matrices/#gl_projectionmatrix) used by all [gbuffers programs](/current/reference/programs/gbuffers/) except for `gbuffers_hand` and `gbuffers_hand_water`, where the [`gl_ProjectionMatrix`](/current/reference/uniforms/matrices/#gl_projectionmatrix) multiplies the Z axis by `MC_HAND_DEPTH` to move the hand closer to the camera than the rest of the world. ---------------- @@ -53,7 +53,7 @@ Equal to [`inverse(gbufferProjection)`](/current/reference/uniforms/matrices/#gb ```glsl uniform mat4 shadowModelView; ``` -Equal to the [`modelViewMatrix`](/current/reference/uniforms/matrices/#modelviewmatrix) when the shadow map was generated in the [shadow program](/current/reference/programs/shadow/). +Equal to the [`gl_ModelViewMatrix`](/current/reference/uniforms/matrices/#gl_modelviewmatrix) when the shadow map was generated in the [shadow program](/current/reference/programs/shadow/). ---------------- @@ -71,7 +71,7 @@ Equal to [`inverse(shadowModelView)`](/current/reference/uniforms/matrices#shado ```glsl uniform mat4 shadowProjection; ``` -Equal to the [`projectionMatrix`](/current/reference/uniforms/matrices/#projectionmatrix) when the shadow map was generated in the [shadow program](/current/reference/programs/shadow). +Equal to the [`gl_ProjectionMatrix`](/current/reference/uniforms/matrices/#gl_projectionmatrix) when the shadow map was generated in the [shadow program](/current/reference/programs/shadow). ---------------- @@ -137,17 +137,17 @@ gl_Position = clip_pos; ---------------- +## gl_ModelViewMatrixInverse +```glsl +gl_ModelViewMatrixInverse +``` +Equal to [`inverse(gl_ModelViewMatrix)`](/current/reference/uniforms/matrices/#gl_modelviewmatrix), but calculated on the CPU to avoid running the expensive `inverse()` function on the GPU. -## modelViewMatrixInverse - -:::danger -This uniform only works with the `core` profile in Minecraft 1.17 and newer. It is recommended to use the `compatibility` profile with Iris for better support. See [this page](/current/how-to/compatibility_vs_core) for more information. -::: +Equivalent to `modelViewMatrixInverse` in the [`core` profile](/current/how-to/compatibility_vs_core). ```glsl uniform mat4 modelViewMatrixInverse; ``` -Equal to [`inverse(modelViewMatrix)`](/current/reference/uniforms/matrices/#modelviewmatrix), but calculated on the CPU to avoid running the expensive `inverse()` function on the GPU. ---------------- @@ -180,24 +180,38 @@ vec4 clip_pos = projectionMatrix * view_pos; gl_Position = clip_pos; ``` - - ---------------- +## gl_ProjectionMatrixInverse +```glsl +gl_ProjectionMatrixInverse +``` +Equal to [`inverse(gl_ProjectionMatrix)`](/current/reference/uniforms/matrices/#gl_projectionmatrix), but calculated on the CPU to avoid running the expensive `inverse()` function on the GPU. -## projectionMatrixInverse -:::danger -This uniform only works with the `core` profile in Minecraft 1.17 and newer. It is recommended to use the `compatibility` profile with Iris for better support. See [this page](/current/how-to/compatibility_vs_core) for more information. -::: +Equivalent to `projectionMatrixInverse` in the [`core` profile](/current/how-to/compatibility_vs_core). ```glsl uniform mat4 projectionMatrixInverse; ``` -Equal to [`inverse(projectionMatrix)`](/current/reference/uniforms/matrices/#projectionmatrix), but calculated on the CPU to avoid running the expensive `inverse()` function on the GPU. ---------------- +## gl_ModelViewProjectionMatrix +```glsl +gl_ModelViewProjectionMatrix +``` +Equal to `gl_ProjectionMatrix * gl_ModelViewMatrix`, not accounting for possible rounding differences. + +```glsl +vec3 model_pos = gl_Vertex.xyz; +vec4 clip_pos = gl_ModelViewProjectionMatrix * vec4(model_pos, 1.0); + +gl_Position = clip_pos; +``` + +---------------- + ## gl_NormalMatrix ```glsl gl_NormalMatrix diff --git a/src/content/docs/current/Reference/Uniforms/overview.mdx b/src/content/docs/current/Reference/Uniforms/overview.mdx index 56fb436f..1c4c1220 100644 --- a/src/content/docs/current/Reference/Uniforms/overview.mdx +++ b/src/content/docs/current/Reference/Uniforms/overview.mdx @@ -13,52 +13,59 @@ Below is an index of all uniforms available in Iris. Uniforms marked as | -| [cameraPositionInt](/current/reference/uniforms/camera/#camerapositionint) | ivec3 | | Integer component of the camera position in world space | | -| [previousCameraPosition](/current/reference/uniforms/camera/#previouscameraposition) | vec3 | | Value of `cameraPosition` from the previous frame | | -| [previousCameraPositionFract](/current/reference/uniforms/camera/#previouscamerapositionfract) | vec3 | [0,1) | Value of `cameraPositionFract` from the previous frame | | -| [previousCameraPositionInt](/current/reference/uniforms/camera/#previouscamerapositionint) | ivec3 | | Value of `cameraPositionInt` from the previous frame | | -| [eyePosition](/current/reference/uniforms/camera/#eyeposition) | vec3 | | World space position of the player's head model | | -| [relativeEyePosition](/current/reference/uniforms/camera/#relativeeyeposition) | vec3 | | World space offset from the player head to the camera | | -| [playerBodyVector](/current/reference/uniforms/camera/#playerbodyvector) | vec3 | [0,1] | World aligned direction of player model's body | | -| [playerLookVector](/current/reference/uniforms/camera/#playerlookvector) | vec3 | [0,1] | World aligned direction of player model's head | | -| [upPosition](/current/reference/uniforms/camera/#upposition) | vec3 | [0, 100] | Upwards direction in view space, length of 100 | | -| [eyeBrightness](/current/reference/uniforms/camera/#eyebrightness) | ivec2 | [0, 240] | Light value at the player's location: (block, sky) | | -| [eyeBrightnessSmooth](/current/reference/uniforms/camera/#eyebrightnesssmooth) | ivec2 | [0, 240] | `eyeBrightness` smoothed over time by `eyeBrightnessHalfLife` | | -| [centerDepthSmooth](/current/reference/uniforms/camera/#centerdepthsmooth) | float | [0,1] | Depth buffer value at the center of the screen, smoothed over time | | -| [firstPersonCamera](/current/reference/uniforms/camera/#firstpersoncamera) | bool | true / false | Whether the player camera is in first person mode | | +| Uniform | Type | Value range | Description | Tag | +| ---------------------------------------------------------------------------------------------- | ----- | ------------ | ------------------------------------------------------------------ | ------------------------------------------------------ | +| [cameraPosition](/current/reference/uniforms/camera/#cameraposition) | vec3 | | Position of the camera in world space | | +| [eyeAltitude](/current/reference/uniforms/camera/#eyealtitude) | float | | Y coordinate of the player in blocks | | +| [cameraPositionFract](/current/reference/uniforms/camera/#camerapositionfract) | vec3 | [0,1) | Fractional component of the camera position in world space | | +| [cameraPositionInt](/current/reference/uniforms/camera/#camerapositionint) | ivec3 | | Integer component of the camera position in world space | | +| [previousCameraPosition](/current/reference/uniforms/camera/#previouscameraposition) | vec3 | | Value of `cameraPosition` from the previous frame | | +| [previousCameraPositionFract](/current/reference/uniforms/camera/#previouscamerapositionfract) | vec3 | [0,1) | Value of `cameraPositionFract` from the previous frame | | +| [previousCameraPositionInt](/current/reference/uniforms/camera/#previouscamerapositionint) | ivec3 | | Value of `cameraPositionInt` from the previous frame | | +| [eyePosition](/current/reference/uniforms/camera/#eyeposition) | vec3 | | World space position of the player's head model | | +| [relativeEyePosition](/current/reference/uniforms/camera/#relativeeyeposition) | vec3 | | World space offset from the player head to the camera | | +| [playerBodyVector](/current/reference/uniforms/camera/#playerbodyvector) | vec3 | [0,1] | World aligned direction of player model's body | | +| [playerLookVector](/current/reference/uniforms/camera/#playerlookvector) | vec3 | [0,1] | World aligned direction of player model's head | | +| [vehicleLookVector](/current/reference/uniforms/camera/#vehiclelookvector) | vec3 | | World aligned direction of current vehicle model's head | | +| [relativeVehiclePosition](/current/reference/uniforms/camera/#relativevehicleposition) | vec3 | | World space offset from the current vehicle to the camera | | +| [upPosition](/current/reference/uniforms/camera/#upposition) | vec3 | [0, 100] | Upwards direction in view space, length of 100 | | +| [eyeBrightness](/current/reference/uniforms/camera/#eyebrightness) | ivec2 | [0, 240] | Light value at the player's location: (block, sky) | | +| [eyeBrightnessSmooth](/current/reference/uniforms/camera/#eyebrightnesssmooth) | ivec2 | [0, 240] | `eyeBrightness` smoothed over time by `eyeBrightnessHalfLife` | | +| [centerDepthSmooth](/current/reference/uniforms/camera/#centerdepthsmooth) | float | [0,1] | Depth buffer value at the center of the screen, smoothed over time | | +| [firstPersonCamera](/current/reference/uniforms/camera/#firstpersoncamera) | bool | true / false | Whether the player camera is in first person mode | | ## Player Status -| Uniform | Type | Value range | Description | Tag | -| ------------------------------------------------------------------------------ | ----- | ------------- | -------------------------------------------------------------- | ------------------------------------------------- | -| [isEyeInWater](/current/reference/uniforms/status/#iseyeinwater) | int | 0, 1, 2, 3 | Fluid that the camera is currently in | | -| [isSpectator](/current/reference/uniforms/status/#isspectator) | bool | true / false | Whether the player is currently in spectator mode | | -| [isRightHanded](/current/reference/uniforms/status/#isrighthanded) | bool | true / false | Whether the player's main hand is set to right hand | | -| [blindness](/current/reference/uniforms/status/#blindness) | float | [0,1] | Blindness effect multiplier | | -| [darknessFactor](/current/reference/uniforms/status/#darknessfactor) | float | [0,1] | Strength of the darkness effect | | -| [darknessLightFactor](/current/reference/uniforms/status/#darknesslightfactor) | float | [0,1] | Strength of the dimming effect from the darkness status effect | | -| [nightVision](/current/reference/uniforms/status/#nightvision) | float | [0,1] | Night vision effect multiplier | | -| [playerMood](/current/reference/uniforms/status/#playermood) | float | [0,1] | Player mood value | | -| [constantMood](/current/reference/uniforms/status/#constantmood) | float | [0,1] | `playerMood` but it doesn't reset at `1.0` | | -| [currentPlayerAir](/current/reference/uniforms/status/#currentplayerair) | float | [0,1] | Normalized air the player has remaining | | -| [maxPlayerAir](/current/reference/uniforms/status/#maxplayerair) | float | -1, 300 | Maximum player air when underwater | | -| [currentPlayerArmor](/current/reference/uniforms/status/#currentplayerarmor) | float | -1, [0,1] | Normalized armor player has equipped | | -| [maxPlayerArmor](/current/reference/uniforms/status/#maxplayerarmor) | float | 50 | Maximum player armor value | | -| [currentPlayerHealth](/current/reference/uniforms/status/#currentplayerhealth) | float | -1, [0,1] | Normalized health the player has remaining | | -| [maxPlayerHealth](/current/reference/uniforms/status/#maxplayerhealth) | float | -1, [0, 1024] | Maximum player health value | | -| [currentPlayerHunger](/current/reference/uniforms/status/#currentplayerhunger) | float | -1, [0,1] | Normalized hunger level of player | | -| [maxPlayerHunger](/current/reference/uniforms/status/#maxplayerhunger) | float | 20 | Maximum player hunger value | | -| [is_burning](/current/reference/uniforms/status/#is_burning) | bool | true / false | Whether the player is currently on fire | | -| [is_hurt](/current/reference/uniforms/status/#is_hurt) | bool | true / false | Whether the player is currently taking damage | | -| [is_invisible](/current/reference/uniforms/status/#is_invisible) | bool | true / false | Whether the player is invisible | | -| [is_on_ground](/current/reference/uniforms/status/#is_on_ground) | bool | true / false | Whether the player is currently touching the ground | | -| [is_sneaking](/current/reference/uniforms/status/#is_sneaking) | bool | true / false | Whether the player is currently sneaking | | -| [is_sprinting](/current/reference/uniforms/status/#is_sprinting) | bool | true / false | Whether the player is currently sprinting | | -| [hideGUI](/current/reference/uniforms/status/#hidegui) | bool | true / false | Whether the player's GUI is hidden | | +| Uniform | Type | Value range | Description | Tag | +| ------------------------------------------------------------------------------ | ----- | ------------- | -------------------------------------------------------------- | ------------------------------------------------------ | +| [isEyeInWater](/current/reference/uniforms/status/#iseyeinwater) | int | 0, 1, 2, 3 | Fluid that the camera is currently in | | +| [isSpectator](/current/reference/uniforms/status/#isspectator) | bool | true / false | Whether the player is currently in spectator mode | | +| [isRightHanded](/current/reference/uniforms/status/#isrighthanded) | bool | true / false | Whether the player's main hand is set to right hand | | +| [blindness](/current/reference/uniforms/status/#blindness) | float | [0,1] | Blindness effect multiplier | | +| [darknessFactor](/current/reference/uniforms/status/#darknessfactor) | float | [0,1] | Strength of the darkness effect | | +| [darknessLightFactor](/current/reference/uniforms/status/#darknesslightfactor) | float | [0,1] | Strength of the dimming effect from the darkness status effect | | +| [nightVision](/current/reference/uniforms/status/#nightvision) | float | [0,1] | Night vision effect multiplier | | +| [playerMood](/current/reference/uniforms/status/#playermood) | float | [0,1] | Player mood value | | +| [constantMood](/current/reference/uniforms/status/#constantmood) | float | [0,1] | `playerMood` but it doesn't reset at `1.0` | | +| [currentPlayerAir](/current/reference/uniforms/status/#currentplayerair) | float | [0,1] | Normalized air the player has remaining | | +| [maxPlayerAir](/current/reference/uniforms/status/#maxplayerair) | float | -1, 300 | Maximum player air when underwater | | +| [currentPlayerArmor](/current/reference/uniforms/status/#currentplayerarmor) | float | -1, [0,1] | Normalized armor player has equipped | | +| [maxPlayerArmor](/current/reference/uniforms/status/#maxplayerarmor) | float | 50 | Maximum player armor value | | +| [currentPlayerHealth](/current/reference/uniforms/status/#currentplayerhealth) | float | -1, [0,1] | Normalized health the player has remaining | | +| [maxPlayerHealth](/current/reference/uniforms/status/#maxplayerhealth) | float | -1, [0, 1024] | Maximum player health value | | +| [currentPlayerHunger](/current/reference/uniforms/status/#currentplayerhunger) | float | -1, [0,1] | Normalized hunger level of player | | +| [maxPlayerHunger](/current/reference/uniforms/status/#maxplayerhunger) | float | 20 | Maximum player hunger value | | +| [vehicleInWater](/current/reference/uniforms/status/#vehicleinwater) | bool | true / false | Whether the current vehicle is touching a water surface | | +| [isRiding](/current/reference/uniforms/status/#isriding) | bool | true / false | Whether the player is riding an entity | | +| [inSwimmingAnimation](/current/reference/uniforms/status/#inswimminganimation) | bool | true / false | Whether the player currently has the swimming animation | | +| [feetInWater](/current/reference/uniforms/status/#feetinwater) | bool | true / false | Whether the player is currently touching a water surface | | +| [isElytraFlying](/current/reference/uniforms/status/#isElytraFlying) | bool | true / false | Whether the player is currently flying with an elytra | | +| [is_burning](/current/reference/uniforms/status/#is_burning) | bool | true / false | Whether the player is currently on fire | | +| [is_hurt](/current/reference/uniforms/status/#is_hurt) | bool | true / false | Whether the player is currently taking damage | | +| [is_invisible](/current/reference/uniforms/status/#is_invisible) | bool | true / false | Whether the player is invisible | | +| [is_on_ground](/current/reference/uniforms/status/#is_on_ground) | bool | true / false | Whether the player is currently touching the ground | | +| [is_sneaking](/current/reference/uniforms/status/#is_sneaking) | bool | true / false | Whether the player is currently sneaking | | +| [is_sprinting](/current/reference/uniforms/status/#is_sprinting) | bool | true / false | Whether the player is currently sprinting | | +| [hideGUI](/current/reference/uniforms/status/#hidegui) | bool | true / false | Whether the player's GUI is hidden | | ## Screen/System | Uniform | Type | Value range | Description | Tag | @@ -76,17 +83,18 @@ Below is an index of all uniforms available in Iris. Uniforms marked as | ## ID -| Uniform | Type | Value range | Description | Tag | -| ---------------------------------------------------------------------------------- | ---- | --------------- | ----------------------------------------------------------------------- | -------------------------------------------- | -| [entityId](/current/reference/uniforms/id/#entityid) | int | [0, 65535] | ID of the currently rendering entity (gbuffers_entities) | | -| [blockEntityId](/current/reference/uniforms/id/#blockentityid) | int | [-32768, 32767] | ID of the currently rendering block entity (gbuffers_block) | | -| [currentRenderedItemId](/current/reference/uniforms/id/#currentrendereditemid) | int | [0,65535] | Item ID of currently rendering item/armor/trim | | -| [currentSelectedBlockId](/current/reference/uniforms/id/#currentselectedblockid) | int | [-32768, 32767] | Block ID of block selected by the player | | -| [currentSelectedBlockPos](/current/reference/uniforms/id/#currentselectedblockpos) | vec3 | | Player space position of the center of the block selected by the player | | -| [heldItemId](/current/reference/uniforms/id/#helditemid) | int | [0, 65535] | Item ID of the item in the player's hand | | -| [heldItemId2](/current/reference/uniforms/id/#helditemid2) | int | [0, 65535] | Item ID of the item in the player's offhand | | -| [heldBlockLightValue](/current/reference/uniforms/id/#heldblocklightvalue) | int | [0,15] | Light value of the item held in the player's hand | | -| [heldBlockLightValue2](/current/reference/uniforms/id/#heldblocklightvalue2) | int | [0,15] | Light value of the item held in the player's offhand | | +| Uniform | Type | Value range | Description | Tag | +| ---------------------------------------------------------------------------------- | ---- | --------------- | ----------------------------------------------------------------------- | ------------------------------------------------------ | +| [entityId](/current/reference/uniforms/id/#entityid) | int | [0, 65535] | ID of the currently rendering entity (gbuffers_entities) | | +| [blockEntityId](/current/reference/uniforms/id/#blockentityid) | int | [-32768, 32767] | ID of the currently rendering block entity (gbuffers_block) | | +| [vehicleId](/current/reference/uniforms/id/#vehicleid) | int | [0, 65535] | ID of the vehicle currently used by the player | | +| [currentRenderedItemId](/current/reference/uniforms/id/#currentrendereditemid) | int | [0,65535] | Item ID of currently rendering item/armor/trim | | +| [currentSelectedBlockId](/current/reference/uniforms/id/#currentselectedblockid) | int | [-32768, 32767] | Block ID of block selected by the player | | +| [currentSelectedBlockPos](/current/reference/uniforms/id/#currentselectedblockpos) | vec3 | | Player space position of the center of the block selected by the player | | +| [heldItemId](/current/reference/uniforms/id/#helditemid) | int | [0, 65535] | Item ID of the item in the player's hand | | +| [heldItemId2](/current/reference/uniforms/id/#helditemid2) | int | [0, 65535] | Item ID of the item in the player's offhand | | +| [heldBlockLightValue](/current/reference/uniforms/id/#heldblocklightvalue) | int | [0,15] | Light value of the item held in the player's hand | | +| [heldBlockLightValue2](/current/reference/uniforms/id/#heldblocklightvalue2) | int | [0,15] | Light value of the item held in the player's offhand | | ## World/Weather | Uniform | Type | Value range | Description | Tag | @@ -144,22 +152,22 @@ Below is an index of all uniforms available in Iris. Uniforms marked as | ## Matrices -| Uniform | Type | Value range | Description | Tag | -| -------------------------------------------------------------------------------------------- | ---- | ----------- | ---------------------------------------------------------------------- | --- | -| [gbufferModelView](/current/reference/uniforms/matrices/#gbuffermodelview) | mat4 | | Player space to view space in general | | -| [gbufferModelViewInverse](/current/reference/uniforms/matrices/#gbuffermodelviewinverse) | mat4 | | Converts from view space to player space in general | | -| [gbufferProjection](/current/reference/uniforms/matrices/#gbufferprojection) | mat4 | | Converts from view space to clip space in general | | -| [gbufferProjectionInverse](/current/reference/uniforms/matrices/#gbufferprojectioninverse) | mat4 | | Converts from clip/screen to view space in general | | -| [shadowModelView](/current/reference/uniforms/matrices/#shadowmodelview) | mat4 | | Converts from player space to shadow view space in general | | -| [shadowModelViewInverse](/current/reference/uniforms/matrices/#shadowmodelviewinverse) | mat4 | | Converts from shadow view space to player space in general | | -| [shadowProjection](/current/reference/uniforms/matrices/#shadowprojection) | mat4 | | Converts from shadow view space to shadow clip space in general | | -| [shadowProjectionInverse](/current/reference/uniforms/matrices/#shadowprojectioninverse) | mat4 | | Converts from shadow clip/screen space to shadow view space in general | | -| [gbufferPreviousModelView](/current/reference/uniforms/matrices/#gbufferpreviousmodelview) | mat4 | | Value of `gbufferModelView` from the previous frame | | -| [gbufferPreviousProjection](/current/reference/uniforms/matrices/#gbufferpreviousprojection) | mat4 | | Value of `gbufferProjection` from the previous frame | | -| [modelViewMatrix](/current/reference/uniforms/matrices/#modelviewmatrix) | mat4 | | Converts from model space to view space in general | | -| [modelViewMatrixInverse](/current/reference/uniforms/matrices/#modelviewmatrixinverse) | mat4 | | Converts from view space to model space for current geometry | | -| [projectionMatrix](/current/reference/uniforms/matrices/#projectionmatrix) | mat4 | | Converts from view space to clip space for current geometry | | -| [projectionMatrixInverse](/current/reference/uniforms/matrices/#projectionmatrixinverse) | mat4 | | Converts from clip/screen space to view space for current geometry | | -| [normalMatrix](/current/reference/uniforms/matrices/#normalmatrix) | mat3 | | Converts normals from model space to view space for current geometry | | -| [textureMatrix](/current/reference/uniforms/matrices/#texturematrix) | mat4 | | Transforms texture coordinates before sampling | | - +| Uniform | Type | Value range | Description | Tag | +| -------------------------------------------------------------------------------------------------- | ---- | ----------- | ---------------------------------------------------------------------- | --- | +| [gbufferModelView](/current/reference/uniforms/matrices/#gbuffermodelview) | mat4 | | Player space to view space in general | | +| [gbufferModelViewInverse](/current/reference/uniforms/matrices/#gbuffermodelviewinverse) | mat4 | | Converts from view space to player space in general | | +| [gbufferProjection](/current/reference/uniforms/matrices/#gbufferprojection) | mat4 | | Converts from view space to clip space in general | | +| [gbufferProjectionInverse](/current/reference/uniforms/matrices/#gbufferprojectioninverse) | mat4 | | Converts from clip/screen to view space in general | | +| [shadowModelView](/current/reference/uniforms/matrices/#shadowmodelview) | mat4 | | Converts from player space to shadow view space in general | | +| [shadowModelViewInverse](/current/reference/uniforms/matrices/#shadowmodelviewinverse) | mat4 | | Converts from shadow view space to player space in general | | +| [shadowProjection](/current/reference/uniforms/matrices/#shadowprojection) | mat4 | | Converts from shadow view space to shadow clip space in general | | +| [shadowProjectionInverse](/current/reference/uniforms/matrices/#shadowprojectioninverse) | mat4 | | Converts from shadow clip/screen space to shadow view space in general | | +| [gbufferPreviousModelView](/current/reference/uniforms/matrices/#gbufferpreviousmodelview) | mat4 | | Value of `gbufferModelView` from the previous frame | | +| [gbufferPreviousProjection](/current/reference/uniforms/matrices/#gbufferpreviousprojection) | mat4 | | Value of `gbufferProjection` from the previous frame | | +| [gl_ModelViewMatrix](/current/reference/uniforms/matrices/#gl_modelviewmatrix) | mat4 | | Converts from model space to view space in general | | +| [gl_ModelViewMatrixInverse](/current/reference/uniforms/matrices/#gl_modelviewmatrixinverse) | mat4 | | Converts from view space to model space for current geometry | | +| [gl_ProjectionMatrix](/current/reference/uniforms/matrices/#gl_projectionmatrix) | mat4 | | Converts from view space to clip space for current geometry | | +| [gl_ProjectionMatrixInverse](/current/reference/uniforms/matrices/#gl_projectionmatrixinverse) | mat4 | | Converts from clip/screen space to view space for current geometry | | +| [gl_ModelViewProjectionMatrix](/current/reference/uniforms/matrices/#gl_modelviewprojectionmatrix) | mat4 | | Converts from model space to clip space for current geometry | | +| [gl_NormalMatrix](/current/reference/uniforms/matrices/#gl_normalmatrix) | mat3 | | Converts normals from model space to view space for current geometry | | +| [gl_TextureMatrix\[0\]](/current/reference/uniforms/matrices/#gl_texturematrix0) | mat4 | | Transforms texture coordinates before sampling | | diff --git a/src/content/docs/current/Reference/Uniforms/rendering.mdx b/src/content/docs/current/Reference/Uniforms/rendering.mdx index d15e15f6..954f6489 100644 --- a/src/content/docs/current/Reference/Uniforms/rendering.mdx +++ b/src/content/docs/current/Reference/Uniforms/rendering.mdx @@ -80,6 +80,10 @@ The entity tint color. The `rgb` components store the color, and the `a` compone color.rgb = mix(color.rgb, entityColor.rgb, entityColor.a); ``` +:::caution[Warning] +This variable may be patched to a non-uniform value despite the `uniform` storage qualifier. +::: + ---------------- @@ -208,7 +212,7 @@ This uniform encodes the fog shape used for vanilla fog, based on the current bi ## textureFilteringMode ```glsl -uniform int textureFilteringMode; +uniform int textureFilteringMode; ``` This uniform reports the texture filtering mode selected by the user in the Sodium quality settings. It will have one of the following values. @@ -219,5 +223,3 @@ This uniform reports the texture filtering mode selected by the user in the Sodi **The `TEXTURE_FILTERING` [feature flag](/current/reference/shadersproperties/flags/) must be enabled for this uniform to be defined.** If this feature is not enabled, the user will not be able to select texture filtering options in the Sodium settings. ---------------- - - diff --git a/src/content/docs/current/Reference/Uniforms/status.mdx b/src/content/docs/current/Reference/Uniforms/status.mdx index dd4b23cb..49de0832 100644 --- a/src/content/docs/current/Reference/Uniforms/status.mdx +++ b/src/content/docs/current/Reference/Uniforms/status.mdx @@ -100,7 +100,7 @@ Equivalent to [`playerMood`](/current/reference/uniforms/status/#playermood) exc ## currentPlayerAir -``` +```glsl uniform float currentPlayerAir; ``` This value stores the relative player air when underwater ranging from `0` to `1`. That means when the player is at full air, this value is `1`, and when they are out of air (e.g. drowning) the value is `0`. The value is `-1` in creative and spectator modes. To absolute air of the player, multiply this value by the uniform [`maxPlayerAir`](/current/reference/uniforms/status/#maxplayerair). @@ -171,6 +171,51 @@ This value stores the maximum player hunger value, which is twice the number of ---------------- +## vehicleInWater +```glsl +uniform bool vehicleInWater; +``` +This value is `true` when a vehicle currently used by the player is touching a water surface, and `false` otherwise. + +---------------- + + +## isRiding +```glsl +uniform bool isRiding; +``` +This value is `true` when the player is riding an entity and `false` otherwise. + +---------------- + + +## inSwimmingAnimation +```glsl +uniform bool inSwimmingAnimation; +``` +This value is `true` when the player is currently in a state where the swimming animation is used, and `false` otherwise. + +---------------- + + +## feetInWater +```glsl +uniform bool feetInWater; +``` +This value is `true` when the player is touching a water surface and `false` otherwise. + +---------------- + + +## isElytraFlying +```glsl +uniform bool isElytraFlying; +``` +This value is `true` when the player is flying with an elytra and `false` otherwise. + +---------------- + + ## is_burning ```glsl uniform bool is_burning; @@ -241,4 +286,4 @@ In OptiFine, this value is only available to [custom uniforms](/current/referenc ```glsl uniform bool hideGUI; ``` -This value stores whether or not the gui is hidden. This value is `false` when the GUI visible and `true` when the GUI hidden (e.g. by pressing f1). \ No newline at end of file +This value stores whether or not the gui is hidden. This value is `false` when the GUI visible and `true` when the GUI hidden (e.g. by pressing f1).