Skip to content

Commit

Permalink
Merge pull request #226 from ninjamike1211/main
Browse files Browse the repository at this point in the history
feat: Directives/Shaders.Properties: add most of remaining directives
  • Loading branch information
ninjamike1211 authored May 27, 2024
2 parents b0dc213 + c9525fc commit dde66b1
Show file tree
Hide file tree
Showing 28 changed files with 317 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
title: alphaTest
description: alphaTest
sidebar:
label: alphaTest
order: 1
---

### `alphaTest.<program>=<off|func ref>`

#### Location: shaders.properties

This directive is used to control the alpha test for cutout programs. For the compatibility profile the alpha test is applied automatically when using `gl_FragData` or `gl_FragColor`. For the newer syntax, only the reference value is passed through [`alphaTestRef`](/reference/uniforms/general/alphatestref) and the function must be implemented by the shader.

Replace:
- `<program>` with a gbuffers program name, including the dimension folder if relevant (e.g. `world0/composite2`). This does not work with Iris custom dimensions however.
- `<off|func ref>` with `off` to disable alpha testing, or replace `func` with one of the following functions: `NEVER`, `LESS`, `EQUAL`, `LEQUAL`, `GREATER`, `NOTEQUAL`, `GEQUAL`, `GL_ALWAYS`. Replace `<ref>` with a reference value. The alpha value of the primary output will then be compared to this reference value using the function defined in `func`, and if it does not pass the value will be discarded (not written to the output buffer).
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: backFace
description: backFace
sidebar:
label: backFace
order: 1
---

### `backFace.solid=<true|false>`
### `backFace.cutout=<true|false>`
### `backFace.cutoutMipped=<true|false>`
### `backFace.translucent=<true|false>`

#### Location: shaders.properties

Enables or disables back-face culling for each type of rendering. This culls geometry which is facing away from the camera, improving performance. Back-face culling is enabled by default.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: beacon.beam.depth
description: beacon.beam.depth
sidebar:
label: beacon.beam.depth
order: 1
---

### `beacon.beam.depth=<true|false>`

#### Location: shaders.properties

Sets whether beacon beams write to the [depth buffer](/reference/buffers/depthtex). If `true`, the inner beacon beam will be treated like opaque geometry and only write toall depthtex buffers. This only applies to the opaque inner geometry of the beacon beam and not the outer translucent geometry. This setting is `false` by default.
30 changes: 30 additions & 0 deletions src/content/docs/reference/Directives/Shaders.Properties/blend.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
title: blend
description: blend
sidebar:
label: blend
order: 1
---

### `blend.<program>=<off|src dst srcA dstA>`
### `blend.<program>.<buffer>=<off|src dst srcA dstA>`

#### Location: shaders.properties

Controls the alpha blending for a specific gbuffers program, and optionally per-buffer.

Replace:
- `<program>` with a gbuffers program
- optionally `<buffer>` specifies the blending for a specific buffer (i.e. colortex5)

Setting the value to `off` will disable alpha blending, otherwise the blending parameters are specified:
- `src` is the source color multiplier
- `dst` is the destination color multiplier
- `srcA` is the source alpha multiplier
- `dstA` is the destination alpha multiplier

Each of the parameters should be filled with one of the following: `ZERO`, `ONE`, `SRC_COLOR`, `ONE_MINUS_SRC_COLOR`, `DST_COLOR`, `ONE_MINUS_DST_COLOR`, `SRC_ALPHA`, `ONE_MINUS_SRC_ALPHA`, `DST_ALPHA`, `ONE_MINUS_DST_ALPHA`, `SRC_ALPHA_SATURATE`.

The default alpha blending parameters are: `SRC_ALPHA`, `ONE_MINUS_SRC_ALPHA`, `ONE`, `ONE_MINUS_SRC_ALPHA` respectively.

More info on alpha blending can be found at the [Khronos Wiki](https://www.khronos.org/opengl/wiki/Blending)
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
title: Buffer Flip
description: Buffer Flip
title: flip
description: flip
sidebar:
label: Buffer Flip
label: flip
order: 1
---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
title: Buffer Size
description: Buffer Size
title: size.buffer
description: size.buffer
sidebar:
label: Buffer Size
label: size.buffer
order: 1
---

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: clouds
description: clouds
sidebar:
label: clouds
order: 1
---

### `clouds=<fast|fancy|off>`

#### Location: shaders.properties

Sets the clouds option, equivalent to the options in "Video Settings" however this setting overrides the user controlled setting if set.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Feature Flags
description: Feature Flags
sidebar:
label: Feature Flags
order: 2
order: 3
badge:
text: Iris Only
variant: tip
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: frustum.culling
description: frustum.culling
sidebar:
label: frustum.culling
order: 1
---

### `frustum.culling=<true|false>`

#### Location: shaders.properties

Enables or disables frustum culling, which culls geometry which is outside the view frustum (i.e. off screen). Frustum culling is enabled by default.
13 changes: 13 additions & 0 deletions src/content/docs/reference/Directives/Shaders.Properties/moon.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: moon
description: moon
sidebar:
label: moon
order: 1
---

### `moon=<true|false>`

#### Location: shaders.properties

Enables or disables rendering of the moon texture in gbuffers_skytextured.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: oldHandLight
description: oldHandLight
sidebar:
label: oldHandLight
order: 1
---

### `oldHandLight=<true|false>`

#### Location: shaders.properties

Sets a fallback for older shaders which don't support main and alt hands. If `oldHandLight` is set to `true`, [`heldBlockLightValue`](/reference/uniforms/general/heldblocklightvalue) will take the value of the highest light value. The default value is `true` due to legacy support, so it must be specifically disabled to have independent main and alt hand light values.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: oldLighting
description: oldLighting
sidebar:
label: oldLighting
order: 1
---

### `oldLighting=<true|false>`

#### Location: shaders.properties

Enables the "old lighting", which applies a lighting multiplier in the color attribute based on the block's orientation (this is the same as vanilla). This value is set to `false` by default, as most shaders use their own lighting.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: particles.before.deferred
description: particles.before.deferred
sidebar:
label: particles.before.deferred
order: 1
---

### `particles.before.deferred=<true|false>`

#### Location: shaders.properties

The legacy version of [`particles.ordering`](/reference/directives/shadersproperties/particles_ordering) which is supported by Optifine. If set to `true` all particles will be rendered before the deferred pass, otherwise particles will be rendered after the deferred pass. This ordering is overwritten by [`particles.ordering`](/reference/directives/shadersproperties/particles_ordering) by Iris if both are present.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
title: program.enabled
description: program.enabled
sidebar:
label: program.enabled
order: 1
---

### `program.<program>.enabled=<bool_expression>`

#### Location: shaders.properties

This directive can be used to disable a program based on shader options.

Replace:
- `<program>` with the program name, including the dimension folder if relevant (e.g. `world0/composite2`).
- `<bool_expression>` with a boolean expression containing shader options. For example, `program.deferred.enabled=!BLOOM && (SSR || PARALLAX)`. `true` or `false` can also be used to outright enable/disable a program.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: rain.depth
description: rain.depth
sidebar:
label: rain.depth
order: 1
---

### `rain.depth=<true|false>`

#### Location: shaders.properties

Sets whether rain/snow write to the [depth buffer](/reference/buffers/depthtex). If `true`, weather will be treated like translucent geometry and only write to `depthtex0`. This setting is `false` by default.
18 changes: 18 additions & 0 deletions src/content/docs/reference/Directives/Shaders.Properties/scale.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
title: scale
description: scale
sidebar:
label: scale
order: 1
---

### `scale.<program>=<scale|scale offsetX ofsetY>`

#### Location: shaders.properties

Defines a new viewport for a composite style program. This does not affect the resolution of the output buffer, it only impacts the vertex position attribute, therefore only changing the portion of the texture which is rendered to. The same effect can be achieved by manually modifying the position in the vertex stage, this directive simply offers a different interface for changing the viewport.

Replace:
- `<program>` with a composite style program (composite, deferred, prepare, etc.)
- `<scale>` with a scaling factor from `0.0` to `1.0` which affects both axes
- optionally `<offsetX>` and `<offsetY>` with the horizontal offset in each direction from `0.0` to `1.0`
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: separateAo
description: separateAo
sidebar:
label: separateAo
order: 1
---

### `separateAo=<true|false>`

#### Location: shaders.properties

Normally a vanilla AO (ambient occlusion) value is stored in the rgb components of the color vertex attribute. Enabling `separateAo` moves this into the alpha channel of the color attribute. `separateAo` is disabled by default.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: shadowBlockEntities
description: shadowBlockEntities
sidebar:
label: shadowBlockEntities
order: 1
---

### `shadowBlockEntities=<true|false>`

#### Location: shaders.properties

Sets whether block entities are rendered in the [`shadow pass`](/reference/programs/shadow).
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: shadowEntities
description: shadowEntities
sidebar:
label: shadowEntities
order: 1
---

### `shadowEntities=<true|false>`

#### Location: shaders.properties

Sets whether entities are rendered in the [`shadow pass`](/reference/programs/shadow).
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: shadowTerrain
description: shadowTerrain
sidebar:
label: shadowTerrain
order: 1
---

### `shadowTerrain=<true|false>`

#### Location: shaders.properties

Sets whether solid/cutout terrain is rendered in the [`shadow pass`](/reference/programs/shadow).
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: shadowTranslucent
description: shadowTranslucent
sidebar:
label: shadowTranslucent
order: 1
---

### `shadowTranslucent=<true|false>`

#### Location: shaders.properties

Sets whether translucent terrain (e.g. water) is rendered in the [`shadow pass`](/reference/programs/shadow).
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: shadow.culling
description: shadow.culling
sidebar:
label: shadow.culling
order: 2
order: 1
---

### `shadow.culling=<true|false|reversed>`
Expand Down
13 changes: 13 additions & 0 deletions src/content/docs/reference/Directives/Shaders.Properties/sun.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: sun
description: sun
sidebar:
label: sun
order: 1
---

### `sun=<true|false>`

#### Location: shaders.properties

Enables or disables rendering of the sun texture in gbuffers_skytextured.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: underwaterOverlay
description: underwaterOverlay
sidebar:
label: underwaterOverlay
order: 1
---

### `underwaterOverlay=<true|false>`

#### Location: shaders.properties

Enables or disables the water texture overlay when the player is underwater.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: vignette
description: vignette
sidebar:
label: vignette
order: 1
---

### `vignette=<true|false>`

#### Location: shaders.properties

Enables or disables rendering of the vignette overlay, an effect which darkens the edge of the screen slightly.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { Aside } from '@astrojs/starlight/components';

### `uniform float alphaTestRef;`

This value stores the alpha value that Iris recommends you discard pixels bellow. This value is commonly `0.1`, but can change in certain cases. Therefore the uniform should be used. It is normally used like this:
This value stores the alpha value that Iris recommends you discard pixels bellow. This value is commonly `0.1`, but can change in certain cases (therefore it is recommended to use the uniform over a hardcoded value). The value is also affected by the [`alphaTest`](/reference/directives/shadersproperties/alphatest) directive. It is normally used like this:
```glsl
if (albedoOut.a < alphaTestRef) discard;
```
Loading

0 comments on commit dde66b1

Please sign in to comment.