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: src/content/docs/current/Guides/Your First Shader/0_intro.mdx
+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
@@ -42,4 +42,4 @@ A "shader" is, by definition, any program that is executed on the GPU. For Minec
42
42
Odds are, all your previous code has been executed on the CPU. Shaders are instead executed on the GPU (also know as a graphics or video card). CPUs are great at performing complex sequential tasks, whereas GPUs are great are executing simple tasks in parallel. In fact, modern high-end graphics cards are capable of performing *trillions* of calculations per second! You can read more about the differences [here](https://www.intel.com/content/www/us/en/products/docs/processors/cpu-vs-gpu.html).
43
43
:::
44
44
45
-
For a full list of programs and what they do, see the [Iris Docs](https://shaders.properties/current/reference/programs/overview/).
45
+
For a full list of programs and what they do, see the [Iris Docs](/current/reference/programs/overview/).
Copy file name to clipboardExpand all lines: src/content/docs/current/Guides/Your First Shader/1_composite.mdx
+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
@@ -124,7 +124,7 @@ This is where we recieve the `texcoord` passed `out` in the vertex shader. This
124
124
/* RENDERTARGETS: 0 */
125
125
```
126
126
127
-
This is a comment that the Iris patcher reads. It tells the shader to write back to `colortex0`. For more info, see [the docs](/current/reference/constants/rendertargets).
127
+
This is a comment that the Iris patcher reads. It tells the shader to write back to `colortex0`. For more info, see [the docs](/current/reference/constants/rendertargets/).
Copy file name to clipboardExpand all lines: src/content/docs/current/Guides/Your First Shader/2_gbuffers.mdx
+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
@@ -165,7 +165,7 @@ layout(location = 1) out vec4 someMoreData; // writes to colortex3
165
165
166
166
167
167
:::note[Note]
168
-
Iris implements by default something known as 'buffer flipping'. This means that the texture you write to is not actually the same one you read from. This is because different instances of the shader might run at different times and if multiple of them try to access the same pixel, the output could be different depending on which one gets to it first. For more information, see [the docs](/current/reference/shadersproperties/rendering#flip)
168
+
Iris implements by default something known as 'buffer flipping'. This means that the texture you write to is not actually the same one you read from. This is because different instances of the shader might run at different times and if multiple of them try to access the same pixel, the output could be different depending on which one gets to it first. For more information, see [the docs](/current/reference/shadersproperties/rendering/#flip)
169
169
:::
170
170
171
171
Finally, in main, let's write this data to the textures, so we can access it in `composite`.
At the moment, our shadows are extremely blocky. This is due to the limited resolution of the shadow map. We can improve things somewhat by increasing this, using the [`shadowMapResolution`](/current/reference/constant/shadowmapresolution) const. This constant can be defined anywhere, but just because it's a nice place to put it, we'll go back to `shadow.fsh`. Let's add the following. It should be outside the `main` function - I put mine just before my `layout` qualifier declaration.
147
+
At the moment, our shadows are extremely blocky. This is due to the limited resolution of the shadow map. We can improve things somewhat by increasing this, using the [`shadowMapResolution`](/current/reference/constant/shadowmapresolution/) const. This constant can be defined anywhere, but just because it's a nice place to put it, we'll go back to `shadow.fsh`. Let's add the following. It should be outside the `main` function - I put mine just before my `layout` qualifier declaration.
148
148
149
149
```glsl
150
150
const int shadowMapResolution = 2048;
@@ -390,7 +390,7 @@ Our shadows now have soft edges, and the aliasing artifacts are no longer visibl
You'll see the pixels in `noisetex` are pretty chunky. This is because it has a resolution of 64x64, and is being stretched to fit the screen. We could just increase the resolution, but to ensure we're getting a unique value for every pixel, we'll instead use a function called `texelFetch`. `texelFetch` takes in an exact pixel coordinate in a texture and returns the value there without doing any filtering. We will need to convert our `texcoord` to a pixel coordinate within the range (0-64). We can do this using another couple of uniforms, [`viewWidth`](/current/reference/uniforms/system#viewwidth) and [`viewHeight`](/current/reference/uniforms/system#viewheight) (both `float`s). We will also make use of the type `ivec2` which is like a `vec2` except it can store only integer values. Let's make another new function called `getNoise`. It will take in a vec2 texcoord and return a vec4, the lookup value from `noisetex`. We're going to access it in `getSoftShadow` so it should be placed before this function.
393
+
You'll see the pixels in `noisetex` are pretty chunky. This is because it has a resolution of 64x64, and is being stretched to fit the screen. We could just increase the resolution, but to ensure we're getting a unique value for every pixel, we'll instead use a function called `texelFetch`. `texelFetch` takes in an exact pixel coordinate in a texture and returns the value there without doing any filtering. We will need to convert our `texcoord` to a pixel coordinate within the range (0-64). We can do this using another couple of uniforms, [`viewWidth`](/current/reference/uniforms/system/#viewwidth) and [`viewHeight`](/current/reference/uniforms/system/#viewheight) (both `float`s). We will also make use of the type `ivec2` which is like a `vec2` except it can store only integer values. Let's make another new function called `getNoise`. It will take in a vec2 texcoord and return a vec4, the lookup value from `noisetex`. We're going to access it in `getSoftShadow` so it should be placed before this function.
Copy file name to clipboardExpand all lines: src/content/docs/current/Guides/Your First Shader/5_fog.mdx
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,9 +55,9 @@ It's good practice to try to minimise duplicate code as much as possible. To org
55
55
56
56
## The Fog is Coming
57
57
58
-
What we want is for something which is nearly out of render distance to have lots of fog, and something which is close to the player not to have any fog at all. To do this, we can divide the distance from the player by a uniform `float`, [`far`](/current/reference/uniforms/rendering#far). The name of this variable is misleading, as what it gives us is the player's render distance, in blocks.
58
+
What we want is for something which is nearly out of render distance to have lots of fog, and something which is close to the player not to have any fog at all. To do this, we can divide the distance from the player by a uniform `float`, [`far`](/current/reference/uniforms/rendering/#far). The name of this variable is misleading, as what it gives us is the player's render distance, in blocks.
59
59
60
-
Of course, we also need to have a fog color to blend with, and for this, we'll use another uniform, a `vec3`[`fogColor`](/current/reference/uniforms/rendering#fogcolor).
60
+
Of course, we also need to have a fog color to blend with, and for this, we'll use another uniform, a `vec3`[`fogColor`](/current/reference/uniforms/rendering/#fogcolor).
Copy file name to clipboardExpand all lines: src/content/docs/current/Guides/Your First Shader/6_next_steps.mdx
+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
@@ -14,7 +14,7 @@ This is as far as we go with the tutorial, but there's plenty more that can be d
14
14
Right now, our entities appear partially translucent. This is because we have only written a `gbuffers_terrain` program. Entities are handled by `gbuffers_entities`, which falls back to `gbuffers_textured_lit`. Since we have not overriden this program, it doesn't write our normals or lightmap data to the buffers we need it to. An easy way to resolve this is to rename `gbuffers_terrain` to `gbuffers_textured_lit`, which most programs we care about will fall back to. For more information, see [Gbuffers](/current/reference/programs/gbuffers/).
15
15
16
16
### Bright Night
17
-
Since our sunlight and skylight colors are constant, things are still very well lit at night. This can be improved by varying the skylight and sunlight colors based on the time of day. We can do this using the uniform [`worldTime`](/current/reference/uniforms/world#worldtime).
17
+
Since our sunlight and skylight colors are constant, things are still very well lit at night. This can be improved by varying the skylight and sunlight colors based on the time of day. We can do this using the uniform [`worldTime`](/current/reference/uniforms/world/#worldtime).
18
18
19
19
## Things to Do
20
20
Here are some things you could try adding to your shader next. Some of these are more complex than others, and may require additional research into graphics programming.
Copy file name to clipboardExpand all lines: src/content/docs/current/How To/coordinate_spaces.mdx
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,10 +20,10 @@ This page is designed to be read in tandem with this cheatsheet, which shows eve
20
20
## Spaces
21
21
22
22
### Model 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**".
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**".
24
24
25
25
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:
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:
27
27
```glsl
28
28
vec3 model_pos = vaPosition + chunkOffset;
29
29
```
@@ -36,17 +36,17 @@ The `x` and `y` components of view space line up with screen space (negative is
36
36
### Player Space
37
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).
38
38
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).
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).
40
40
41
41
#### Feet and Eye Player Space
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.
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.
43
43
44
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.
45
45
46
46
### World Space
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
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
48
48
49
49
## Shadow 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**.
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**.
51
51
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*.
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*.
Copy file name to clipboardExpand all lines: src/content/docs/current/Reference/Attributes/mc_Entity.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
@@ -12,14 +12,14 @@ sidebar:
12
12
13
13
---
14
14
15
-
The `x` component stores the block ID which was assigned to the current block in [`block.properties`](/current/reference/miscellaneous/block_properties). If an ID for the current block is not defined, a value of `-1` is sent.
15
+
The `x` component stores the block ID which was assigned to the current block in [`block.properties`](/current/reference/miscellaneous/block_properties/). If an ID for the current block is not defined, a value of `-1` is sent.
16
16
17
17
:::tip
18
18
Iris 1.3 and later (as well as OptiFine) uses a signed short for `mc_Entity`, meaning they can store IDs from `-32768` to `32767`. Older Iris versions do not support negative values, and will send the maximum unsigned value,`65535`, for any blocks with unassigned IDs.
19
19
:::
20
20
21
-
When [`block.properties`](/current/reference/miscellaneous/block_properties) is not present in the shader pack files, block IDs are assigned according to their pre 1.13 numerical values, as described in the [Minecraft Wiki](https://minecraft.wiki/w/Java_Edition_data_values/Pre-flattening#Block_IDs). This is intended for legacy purposes, and should not be used for new shader packs.
21
+
When [`block.properties`](/current/reference/miscellaneous/block_properties/) is not present in the shader pack files, block IDs are assigned according to their pre 1.13 numerical values, as described in the [Minecraft Wiki](https://minecraft.wiki/w/Java_Edition_data_values/Pre-flattening/#Block_IDs). This is intended for legacy purposes, and should not be used for new shader packs.
22
22
23
23
The `y` component stores the "render type", which is `1` for fluids (water, lava, etc) and `-1` for all other blocks.
24
24
25
-
This attribute is only available for terrain. For other types of geometry, see [`entityid`](/current/reference/uniforms/id#entityid) and [`blockentityid`](/current/reference/uniforms/id#blockentityid).
25
+
This attribute is only available for terrain. For other types of geometry, see [`entityid`](/current/reference/uniforms/id/#entityid) and [`blockentityid`](/current/reference/uniforms/id/#blockentityid).
0 commit comments