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
-7Lines changed: 0 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,15 +4,8 @@ description: Get started creating your first shader
4
4
sidebar:
5
5
label: An Introduction to Shaders
6
6
order: 1
7
-
badge:
8
-
text: In Development
9
-
variant: caution
10
7
---
11
8
12
-
:::caution[Warning]
13
-
This tutorial is still being developed. Some statements may be incorrect, and things may change in the future. Got any feedback? [Comment on the tracking issue](https://github.com/IrisShaders/DocsPage/issues/327).
14
-
:::
15
-
16
9
17
10
## Foreward
18
11
This tutorial is based on one written by [saadam1n](https://github.com/saadam1n/MinecraftShaderProgramming). This newer tutorial has been necessitated by the fact that since the tutorial was written, the general state of development on Minecraft shaders has advanced somewhat, and other developers have identified several areas where this can be improved.
Copy file name to clipboardExpand all lines: src/content/docs/current/Guides/Your First Shader/1_composite.mdx
-4Lines changed: 0 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,10 +6,6 @@ sidebar:
6
6
order: 2
7
7
---
8
8
9
-
:::caution[Warning]
10
-
This tutorial is still being developed. Some statements may be incorrect, and things may change in the future. Got any feedback? [Comment on the tracking issue](https://github.com/IrisShaders/DocsPage/issues/327).
11
-
:::
12
-
13
9
## Setting Up the File Structure
14
10
Minecraft shaders require a specific structure of files in the right places to load code. While it's important to understand this structure, to save time, we will be working with the Base 330 pack from shaderLABS. Download it from [here](https://github.com/shaderLABS/Base-330), and extract it into your `shaderpacks` folder. You should have the following structure.
Copy file name to clipboardExpand all lines: src/content/docs/current/Guides/Your First Shader/2_gbuffers.mdx
-4Lines changed: 0 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,10 +6,6 @@ sidebar:
6
6
order: 2
7
7
---
8
8
9
-
:::caution[Warning]
10
-
This tutorial is still being developed. Some statements may be incorrect, and things may change in the future. Got any feedback? [Comment on the tracking issue](https://github.com/IrisShaders/DocsPage/issues/327).
11
-
:::
12
-
13
9
In this next section, we will start with a fresh copy of the Base-330 pack, instead of using the grayscale version we made in the previous step. You could also just remove the lines you added to `composite.fsh`.
14
10
15
11
For the purposes of this tutorial, we will only be covering the shading of terrain. Therefore, it is worth deleting all other files starting with `gbuffers_`. You can also get rid of the `deferred` files. You should now just have
Copy file name to clipboardExpand all lines: src/content/docs/current/Guides/Your First Shader/3_composite_lighting.mdx
-4Lines changed: 0 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,10 +6,6 @@ sidebar:
6
6
order: 3
7
7
---
8
8
9
-
:::caution[Warning]
10
-
This tutorial is still being developed. Some statements may be incorrect, and things may change in the future. Got any feedback? [Comment on the tracking issue](https://github.com/IrisShaders/DocsPage/issues/327).
11
-
:::
12
-
13
9
In this section we will implement basic diffuse shading in the composite pass. As such, we will be primarily editing `composite.fsh`.
Copy file name to clipboardExpand all lines: src/content/docs/current/Guides/Your First Shader/4_shadows.mdx
-4Lines changed: 0 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,10 +6,6 @@ sidebar:
6
6
order: 4
7
7
---
8
8
9
-
:::caution[Warning]
10
-
This tutorial is still being developed. Some statements may be incorrect, and things may change in the future. Got any feedback? [Comment on the tracking issue](https://github.com/IrisShaders/DocsPage/issues/327).
11
-
:::
12
-
13
9
In this section we will implement basic shadow mapping which allows us to check if a pixel has a shadow cast on it.
Copy file name to clipboardExpand all lines: src/content/docs/current/Guides/Your First Shader/5_fog.mdx
-4Lines changed: 0 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,10 +6,6 @@ sidebar:
6
6
order: 5
7
7
---
8
8
9
-
:::caution[Warning]
10
-
This tutorial is still being developed. Some statements may be incorrect, and things may change in the future. Got any feedback? [Comment on the tracking issue](https://github.com/IrisShaders/DocsPage/issues/327).
11
-
:::
12
-
13
9
In this section we will implement depth based fog, so that things seem to fade into the distance.
Copy file name to clipboardExpand all lines: src/content/docs/current/Guides/Your First Shader/6_next_steps.mdx
+10-8Lines changed: 10 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,30 +6,32 @@ sidebar:
6
6
order: 5
7
7
---
8
8
9
-
:::caution[Warning]
10
-
This tutorial is still being developed. Some statements may be incorrect, and things may change in the future. Got any feedback? [Comment on the tracking issue](https://github.com/IrisShaders/DocsPage/issues/327).
11
-
:::
12
-
13
9
This is as far as we go with the tutorial, but there's plenty more that can be done with the shader!
Right now, our entities seem semitranslucent. 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](http://localhost:4321/current/reference/programs/gbuffers/).
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/).
19
15
20
16
### Bright Night
21
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).
22
18
23
19
## Things to Do
24
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.
21
+
22
+
:::caution[Warning]
23
+
**None of the resources linked to are Minecraft specific!** You will need to modify the code they provide quite significantly to make it work in your shaderpack. **Do not expect to be able to just copy and paste code and have it work**.
24
+
:::
25
+
25
26
- A custom sky, using a simple gradient based on the time of day, or even a physically based atmosphere
26
27
- Waving water and foliage
27
28
- Better shadow filtering, using [interleaved gradient noise](https://blog.demofox.org/2022/01/01/interleaved-gradient-noise-a-different-kind-of-low-discrepancy-sequence/) and a [Vogel disk](https://www.shadertoy.com/view/tddXWl)
28
29
- A [tonemap](https://64.github.io/tonemapping/)
29
30
- Clouds
30
31
- Specular shading, using something like [Blinn-Phong shading](https://learnopengl.com/Advanced-Lighting/Advanced-Lighting) or at a more advanced level, the [Cook-Torrance BRDF](https://learnopengl.com/PBR/Theory)
31
-
- Screen Space Reflections
32
-
- Bloom
32
+
-[Screen Space Ambient Occlusion (SSAO)](https://learnopengl.com/Advanced-Lighting/SSAO)
33
+
-[Screen Space Reflections](https://lettier.github.io/3d-game-shaders-for-beginners/screen-space-reflection.html)
34
+
-[Bloom](https://learnopengl.com/Advanced-Lighting/Bloom). Most modern packs do [bloom in HDR](https://learnopengl.com/Guest-Articles/2022/Phys.-Based-Bloom), which will require you to use a [floating point buffer format](current/reference/constants/buffer_format/) and store every "mip level" in a single texture.
33
35
34
36
## Resources
35
37
- The [shaderLABS discord](https://discord.gg/RpzWN9S) has some resources on shader development, but also has channels where you can ask for help if you're stuck on something.
0 commit comments