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
Copy file name to clipboardExpand all lines: README.md
+34-11Lines changed: 34 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,23 +37,45 @@ Unfinished/Unfinished docs are marked with the `Unfinished` tag in the warning s
37
37
38
38
Write in your own way, and try to use existing pages or ask before adding new ones. For how to write content, follow the guides on [https://diataxis.fr/](https://diataxis.fr/).
39
39
40
-
### Dictionary:
41
-
42
-
- Please use full terms, no shortening. EX no `complementary -> comp`.
43
-
- Refer to shader packs as `pack` and/ or `packs`.
44
-
- If referring to worlds (`world0` and the like), use this syntax: Overworld(`world0`)
40
+
### Style Guide
41
+
42
+
- Use proper capitalization. Common mistakes include:
43
+
-`Optifine` (should be `OptiFine`)
44
+
-`glsl` (should be `GLSL`)
45
+
- Use the correct text stylization:
46
+
- Backticks (\`) should be used for any term used exactly in code (ex: `uniform`)
47
+
- For colortex buffers, only use backticks if the number is included (ex: `colortex5`)
48
+
- For gbuffers, just kinda vibe it, I don't have a definitive rule here
49
+
- Bold (\*\*) should be used for any term not used in code (ex: **attributes**)
50
+
- Italics (\*) may be used for emphasis
51
+
- Use full terms, no shortening. (ex: no `complementary -> comp`.)
52
+
- Something specific to a specific type of shader (vertex, fragment, etc) should include the file extension (ex: `gbuffers_water.fsh`)
53
+
- Use wildcard notation (`*`) to indicate multiple files (ex: `gbuffers_*.fsh` refers to all fragment shaders in a`gbuffers` program)
54
+
- Something valid for all shader types should omit an extension (ex: `final`)
55
+
- Refer to shader packs as `shader pack(s)`.
56
+
- Refer to texture/resource packs as `resource pack(s)`
57
+
- Use `rgba` for swizzling only when explicitly related to color channels, otherwise use `xyzw`
45
58
- Make headings as succinct as possible to help the reader quickly find the content they need
46
59
- Use simple present tense for verbs
47
60
48
-
### Guides:
49
-
Guides walk the user through completing a task (EX creating their first shader). A guide should lead from one outcome to another, and is a multi lesson system of teaching (defined by their folder with multiple pages). They are to be written in a style similar to [tutorials on Diataxis](https://diataxis.fr/tutorials/). Guides are open ended.
61
+
#### File Structure
62
+
- Use `/` to denote folders (as opposed to `\`, which is used on Windows)
63
+
- Add a closing `/` to indicate folders, omit to indicate files
64
+
- The root directory is assumed to be the Minecraft folder. Ex:
65
+
-`/patched_shaders/`
66
+
-`/mods/1.21.4/iris-1.7.1+mc1.21.jar`
67
+
- For a local directory, omit the starting `/`. Ex:
68
+
-`shaders/final.fsh`
69
+
70
+
### Guides
71
+
Guides walk the user through completing a task (e.g. creating their first shader). A guide should lead from one outcome to another, and is a multi lesson system of teaching (defined by their folder with multiple pages). They are to be written in a style similar to [tutorials on Diataxis](https://diataxis.fr/tutorials/). Guides are open ended.
50
72
51
73
A guide should leave the reader feeling comfortable with the topic, and it should leave them in a way that they are able to experiment by themselves.
52
74
53
-
### How To:
54
-
A how to is a singular short article that walks a user through a small problem in their way (EX transforming shadows to screen space or tonemapping). A how to is made to walk a user through a short section of code and does not need to lead from one outcome to another. It is made to increase/create the understanding on a small section of code, and is rarely open ended. The how to should be written similar to [how to guides on Diataxis](https://diataxis.fr/how-to-guides/).
75
+
### How To
76
+
A how to is a singular short article that walks a user through a small problem in their way (e.g. transforming shadows to screen space or tonemapping). A how to is made to walk a user through a short section of code and does not need to lead from one outcome to another. It is made to increase/create the understanding on a small section of code, and is rarely open ended. The how to should be written similar to [how to guides on Diataxis](https://diataxis.fr/how-to-guides/).
55
77
56
-
### Reference:
78
+
### Reference
57
79
A reference is a docs page. It give objective information on a subject, without moving towards individual use cases. These are often short pages, which are written to provide information about syntax surrounding a line or two of code. These need to be written in a succinct way so that the user can quickly find information. Best practices are located at [references in Diataxis](https://diataxis.fr/current/reference/)
58
80
59
81
For uniform references please look at `alphaTestRef` for formatting. The aside found there can be used for any version specific stuff.
@@ -85,4 +107,5 @@ Translations are not yet supported, but once the english version is complete we
85
107
-[Iris Docs](https://github.com/IrisShaders/ShaderDoc/tree/master) - Most of the early documentation
86
108
- WhyFencePost / WhyFenceCode - The page and a lot of the data transfer
87
109
- NinjaMike - Many uniforms including Iris exclusive uniforms, constants, shaders.properties, programs
88
-
- jbritain - Some uniforms, other miscellaneous things
110
+
- jbritain - Some uniforms, other miscellaneous things
Copy file name to clipboardExpand all lines: SECURITY.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@
11
11
12
12
If you've found a vulnerability, we would like to know so we can fix it before it is released publicly. Do not open a GitHub issue for a found vulnerability.
13
13
14
-
Please join [The Iris Discord](https://discord.gg/jQJnav2jPu) and dm one of the docs developers. Send the details:
14
+
Please join [The Iris Discord](https://discord.gg/jQJnav2jPu) and DM one of the docs developers. Send the details:
Copy file name to clipboardExpand all lines: src/content/docs/aperture/migration.mdx
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ Aperture is a new pipeline for Iris, set to be released with Iris 2.0.
15
15
- It uses pipeline code written by shader developers in TypeScript, allowing for fully customizable packs.
16
16
- It has a mod API that allows for mods to apply custom vertex formats, vertex transformations, and (basic) fragment warping without interfering with shader developers.
17
17
- It has no limits on the number of textures, buffers, or programs you can have, how complex they can be, or how they are running.
18
-
- It has a new shadow mapping system based on cascaded shadow maps, allowing shadow maps that reach far beyond what Optifine packs can without distortion.
18
+
- It has a new shadow mapping system based on cascaded shadow maps, allowing shadow maps that reach far beyond what OptiFine packs can without distortion.
19
19
- Packs written on Aperture use a modern version of OpenGL that can be translated to other API's in the future.
20
20
21
21
This serves as temporary documentation whilst Aperture is being developed.
@@ -47,7 +47,7 @@ Shader programs are registered in the `setupShader` function with the `registerS
47
47
48
48
`ObjectShader`s take a `programUsage`, these are predefined for you, for example `TERRAIN_SOLID`.
49
49
50
-
`Composite` and `Compute` shaders require a `Stage` argument passed to `registerShader` before the shader object itself. This defines when the shader runs - for example `Stage.POST_RENDER` is equivalent to a `composite` pass in the Optifine format.
50
+
`Composite` and `Compute` shaders require a `Stage` argument passed to `registerShader` before the shader object itself. This defines when the shader runs - for example `Stage.POST_RENDER` is equivalent to a `composite` pass in the OptiFine format.
51
51
52
52
To add a vertex and fragment shader to your shader object, you can call `.vertex(<PATH_TO_VERTEX>)` and `.fragment(<PATH_TO_FRAGMENT>)`.
53
53
@@ -70,7 +70,7 @@ Vertex shaders should define two functions:
70
70
Set `data.clipPos` as you would `gl_Position`. Usually this can just be `iris_projectionMatrix * iris_modelViewMatrix * data.modelPos`
71
71
72
72
:::note[Info]
73
-
`iris_projectionMatrix` and `iris_modelViewMatrix` are patched to make sense for the relevant usage, in the same way `gl_ModelViewMatrix` is in Optifine.
73
+
`iris_projectionMatrix` and `iris_modelViewMatrix` are patched to make sense for the relevant usage, in the same way `gl_ModelViewMatrix` is in OptiFine.
Copy file name to clipboardExpand all lines: src/content/docs/current/How To/coordinate_spaces.mdx
+12-10Lines changed: 12 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,9 @@ sidebar:
8
8
9
9
At the start of a shader program, the vertex position is provided in the form of `gl_Vertex` (or `VAPosition`). This position is in *model space*. By the time it reaches the fragment shader, the position is in *screen space*. Between these two are a number of other coordinate spaces.
10
10
11
-
**This page does not cover *clip space*, *NDC space*, or *screen space*, as these are applicable to all 3D graphics, not just Minecraft.** It is recommended that you also read the [LearnOpenGL article on coordinate systems](https://learnopengl.com/Getting-started/Coordinate-Systems) to gain a good understanding of these other spaces. The [shaderLABS Wiki](https://shaderlabs.org/wiki/Coordinate_Spaces) also has an explanation of different types of transformations, as well as an interactive visualiser of the different spaces.
11
+
:::note
12
+
This page does not cover **clip space**, **NDC space**, or **screen space**, as these are applicable to all 3D graphics, not just Minecraft. It is recommended that you also read the [LearnOpenGL article on coordinate systems](https://learnopengl.com/Getting-started/Coordinate-Systems) to gain a good understanding of these other spaces. The [shaderLABS Wiki](https://shaderlabs.org/wiki/Coordinate_Spaces) also has an explanation of different types of transformations, as well as an interactive visualiser of the different spaces.
13
+
:::
12
14
13
15
## Space Conversion Cheatsheet
14
16
This page is designed to be read in tandem with this cheatsheet, which shows every space and how to convert between them.
@@ -18,7 +20,7 @@ This page is designed to be read in tandem with this cheatsheet, which shows eve
18
20
## Spaces
19
21
20
22
### Model Space
21
-
In Iris (and Optifine), *model space* is whatever coordinate space the vertex position attribute is sent in. The exact coordinate space varies based on the specific geometry, and has the potential to vary across different Minecraft versions. As a result, it is always recommended to treat *model space* like an unknown space and convert to view space with the `gl_ModelViewMatrix`/[`modelViewMatrix`](/current/reference/uniforms/matrices#modelviewmatrix). *Model space* is also sometimes known as '*local space*'.
23
+
In Iris (and OptiFine), **model space** is whatever coordinate space the vertex position attribute is sent in. The exact coordinate space varies based on the specific geometry, and has the potential to vary across different Minecraft versions. As a result, it is always recommended to treat *model space* like an unknown space and convert to view space with the `gl_ModelViewMatrix`/[`modelViewMatrix`](/current/reference/uniforms/matrices#modelviewmatrix). **Model space** is also sometimes known as "**local space**".
22
24
23
25
24
26
If using the core profile (and as such using [`vaPosition`](/current/reference/attributes/vaposition) instead of `gl_Vertex`), the *model space* position for terrain should be offset with [`chunkOffset`](/current/reference/uniforms/rendering#chunkoffset). The conversion sheet assumes this has already been done. Here's an example of what that should look like:
*View space* is the vertex position relative to the camera. This is also sometimes known as '*eye space*' (not to be confused with '*eye player space*').
32
+
*View space* is the vertex position relative to the camera. This is also sometimes known as "**eye space**" (not to be confused with "**eye player space**").
31
33
32
-
The `x` and `y` components of view space line up with screenspace (negative is left/down, positive is right/up), however the `z` coordinate is "backwards" (forward is negative z).
34
+
The `x` and `y` components of view space line up with screen space (negative is left/down, positive is right/up), however the `z` coordinate is "backwards" (forward is negative z).
33
35
34
36
### Player Space
35
-
*Player space* is the vertex position relative to the *camera* (not the player). The difference between view and *player space* is that whilst *view space* directions change based on the camera angle, *player space* directions are constant, aligned to the axes of Minecraft's coordinates. For example, a vector `0.0, 1.0, 0.0` is along the Y axis and as such would be along Minecraft's actual Y axis (upwards).
37
+
*Player space* is the vertex position relative to the *camera* (not the player). The difference between view and **player space** is that whilst **view space** directions change based on the camera angle, **player space** directions are constant, aligned to the axes of Minecraft's coordinates. For example, a `vec3(0.0, 1.0, 0.0)` is along the Y axis and as such would be along Minecraft's actual Y axis (upwards).
36
38
37
39
To get a position which is relative to the actual player model in third person, you can use [`relativeEyePosition`](/current/reference/uniforms/camera#relativeeyeposition).
38
40
39
41
#### Feet and Eye Player Space
40
-
The names of these spaces are misleading, as '*feet player space*' is not in any way related to the player's feet. The difference between the two is that in *feet player space*, the origin remains locked to the player's head position, whereas in *eye player space*, effects like view bobbing are accounted for, meaning that the origin is locked to the camera. This is why the two can be interchanged with the addition and subtraction of [`gbufferModelViewInverse[3]`](/current/reference/uniforms/matrices#gbuffermodelviewinverse) - this fourth component of the matrix accounts for the translation from the player's head to the camera.
42
+
The names of these spaces are misleading, as "**feet player space**" is not in any way related to the player's feet. The difference between the two is that in **feet player space**, the origin remains locked to the player's head position, whereas in **eye player space**, effects like view bobbing are accounted for, meaning that the origin is locked to the camera. This is why the two can be interchanged with the addition and subtraction of [`gbufferModelViewInverse[3]`](/current/reference/uniforms/matrices#gbuffermodelviewinverse) - this fourth component of the matrix accounts for the translation from the player's head to the camera.
41
43
42
-
It is also worth noting that in third person mode, view bobbing is disabled, and as such, *eye* and *feet player space* are *usually* identical.
44
+
It is also worth noting that in third person mode, view bobbing is disabled, and as such, eye and feet player space are *usually* identical.
43
45
44
46
### World Space
45
-
*World space* is the vertex position in Minecraft's actual coordinate system. It is directionally equivalent to *player space*, as it is simply the result of offsetting a *feet player space* position by the camera position. This roughly lines up with the game's actual coordinate positions, however [`cameraPosition`](/current/reference/uniforms/camera#cameraposition) resets every 30000 blocks (or every 1000 blocks when teleporting). If the exact Minecraft position is required, [`cameraPositionInt`](/current/reference/uniforms/camera#camerapositionint) and [`cameraPositionFract`](/current/reference/uniforms/camera#camerapositionfract) can be used
47
+
**World space** is the vertex position in Minecraft's actual coordinate system. It is directionally equivalent to **player space**, as it is simply the result of offsetting a *feet player space* position by the camera position. This roughly lines up with the game's actual coordinate positions, however [`cameraPosition`](/current/reference/uniforms/camera#cameraposition) resets every 30000 blocks (or every 1000 blocks when teleporting). If the exact Minecraft position is required, [`cameraPositionInt`](/current/reference/uniforms/camera#camerapositionint) and [`cameraPositionFract`](/current/reference/uniforms/camera#camerapositionfract) can be used
46
48
47
49
## Shadow Space
48
-
'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*.
50
+
"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**.
49
51
50
-
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*.
52
+
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*.
The first three components store the world/player space offset from the vertex's position to the center of the block in 1/64th block units. For example, the center position would be calculated like this:
15
+
The `xyz` components store the world/player space offset from the vertex's position to the center of the block in 1/64th block units. For example, the center position would be calculated like this:
16
16
```glsl
17
-
vec3 centerPosition = position + at_midBlock.xyz/64.0;
17
+
vec3 centerPosition = position + at_midBlock.xyz / 64.0;
18
18
```
19
19
20
-
In Iris 1.7 and newer, `at_midBlock.w` stores the light level of the current block (without the influence of nearby light sources, range `0` to `15`). This can be used to tell if a block is emissive. It's recommended to use this together with [`BLOCK_EMISSION_ATTRIBUTE`](/current/reference/shadersproperties/flags).
21
-
22
-
This attribute (both the mid block offset and the emission value) are only available for terrain.
20
+
In Iris 1.7 and newer, the `w` component stores the light level of the current block (without the influence of nearby light sources, range `0` to `15`). This can be used to tell if a block is emissive. It's recommended to use this together with [`BLOCK_EMISSION_ATTRIBUTE`](/current/reference/shadersproperties/flags).
0 commit comments