summaryrefslogtreecommitdiff
path: root/assets/minecraft/shaders
diff options
context:
space:
mode:
Diffstat (limited to 'assets/minecraft/shaders')
-rwxr-xr-xassets/minecraft/shaders/core/particle.fsh30
-rwxr-xr-xassets/minecraft/shaders/core/particle.vsh32
-rwxr-xr-xassets/minecraft/shaders/core/rendertype_armor_cutout_no_cull.fsh29
-rwxr-xr-xassets/minecraft/shaders/core/rendertype_armor_cutout_no_cull.vsh41
-rwxr-xr-xassets/minecraft/shaders/core/rendertype_cutout.fsh33
-rwxr-xr-xassets/minecraft/shaders/core/rendertype_cutout.vsh41
-rwxr-xr-xassets/minecraft/shaders/core/rendertype_cutout_mipped.fsh33
-rwxr-xr-xassets/minecraft/shaders/core/rendertype_cutout_mipped.vsh41
-rwxr-xr-xassets/minecraft/shaders/core/rendertype_entity_cutout.fsh34
-rwxr-xr-xassets/minecraft/shaders/core/rendertype_entity_cutout.vsh42
-rwxr-xr-xassets/minecraft/shaders/core/rendertype_entity_cutout_no_cull.fsh34
-rwxr-xr-xassets/minecraft/shaders/core/rendertype_entity_cutout_no_cull.vsh42
-rwxr-xr-xassets/minecraft/shaders/core/rendertype_entity_cutout_no_cull_z_offset.fsh34
-rwxr-xr-xassets/minecraft/shaders/core/rendertype_entity_cutout_no_cull_z_offset.vsh42
-rwxr-xr-xassets/minecraft/shaders/core/rendertype_entity_no_outline.fsh28
-rwxr-xr-xassets/minecraft/shaders/core/rendertype_entity_no_outline.vsh38
-rwxr-xr-xassets/minecraft/shaders/core/rendertype_entity_solid.fsh34
-rwxr-xr-xassets/minecraft/shaders/core/rendertype_entity_solid.json35
-rwxr-xr-xassets/minecraft/shaders/core/rendertype_entity_solid.vsh42
-rwxr-xr-xassets/minecraft/shaders/core/rendertype_entity_translucent.fsh37
-rwxr-xr-xassets/minecraft/shaders/core/rendertype_entity_translucent.json35
-rwxr-xr-xassets/minecraft/shaders/core/rendertype_entity_translucent.vsh42
-rwxr-xr-xassets/minecraft/shaders/core/rendertype_entity_translucent_cull.fsh32
-rwxr-xr-xassets/minecraft/shaders/core/rendertype_entity_translucent_cull.vsh43
-rwxr-xr-xassets/minecraft/shaders/core/rendertype_entity_translucent_solid.vsh170
-rwxr-xr-xassets/minecraft/shaders/core/rendertype_item_entity_translucent_cull.fsh32
-rwxr-xr-xassets/minecraft/shaders/core/rendertype_item_entity_translucent_cull.vsh43
-rwxr-xr-xassets/minecraft/shaders/core/rendertype_solid.fsh33
-rwxr-xr-xassets/minecraft/shaders/core/rendertype_solid.vsh41
-rwxr-xr-xassets/minecraft/shaders/core/rendertype_translucent.fsh30
-rwxr-xr-xassets/minecraft/shaders/core/rendertype_translucent.vsh41
-rwxr-xr-xassets/minecraft/shaders/include/emissive_utils.glsl102
-rwxr-xr-xassets/minecraft/shaders/include/player.glsl49
33 files changed, 1415 insertions, 0 deletions
diff --git a/assets/minecraft/shaders/core/particle.fsh b/assets/minecraft/shaders/core/particle.fsh
new file mode 100755
index 00000000..9769084d
--- /dev/null
+++ b/assets/minecraft/shaders/core/particle.fsh
@@ -0,0 +1,30 @@
1#version 150
2
3#moj_import <fog.glsl>
4#moj_import <emissive_utils.glsl>
5
6uniform sampler2D Sampler0;
7
8uniform vec4 ColorModulator;
9uniform float FogStart;
10uniform float FogEnd;
11uniform vec4 FogColor;
12
13in float vertexDistance;
14in vec2 texCoord0;
15in vec4 vertexColor;
16in vec4 lightColor;
17in vec4 maxLightColor;
18
19out vec4 fragColor;
20
21void main() {
22 vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator;
23 float alpha = textureLod(Sampler0, texCoord0, 0.0).a * 255.0;
24 color = make_emissive(color, lightColor, maxLightColor, vertexDistance, alpha);
25 color.a = remap_alpha(alpha) / 255.0;
26 if (color.a < 0.1) {
27 discard;
28 }
29 fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
30}
diff --git a/assets/minecraft/shaders/core/particle.vsh b/assets/minecraft/shaders/core/particle.vsh
new file mode 100755
index 00000000..987198fa
--- /dev/null
+++ b/assets/minecraft/shaders/core/particle.vsh
@@ -0,0 +1,32 @@
1#version 150
2
3#moj_import <light.glsl>
4#moj_import <fog.glsl>
5
6in vec3 Position;
7in vec2 UV0;
8in vec4 Color;
9in ivec2 UV2;
10
11uniform sampler2D Sampler2;
12
13uniform mat4 ModelViewMat;
14uniform mat4 ProjMat;
15uniform int FogShape;
16uniform mat3 IViewRotMat;
17
18out float vertexDistance;
19out vec2 texCoord0;
20out vec4 vertexColor;
21out vec4 lightColor;
22out vec4 maxLightColor;
23
24void main() {
25 gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
26
27 vertexDistance = fog_distance(ModelViewMat, IViewRotMat * Position, FogShape);
28 texCoord0 = UV0;
29 vertexColor = Color;
30 lightColor = minecraft_sample_lightmap(Sampler2, UV2);
31 maxLightColor = minecraft_sample_lightmap(Sampler2, ivec2(240.0, 240.0));
32}
diff --git a/assets/minecraft/shaders/core/rendertype_armor_cutout_no_cull.fsh b/assets/minecraft/shaders/core/rendertype_armor_cutout_no_cull.fsh
new file mode 100755
index 00000000..ee039007
--- /dev/null
+++ b/assets/minecraft/shaders/core/rendertype_armor_cutout_no_cull.fsh
@@ -0,0 +1,29 @@
1#version 150
2
3#moj_import <fog.glsl>
4#moj_import <emissive_utils.glsl>
5
6uniform sampler2D Sampler0;
7
8uniform vec4 ColorModulator;
9uniform float FogStart;
10uniform float FogEnd;
11uniform vec4 FogColor;
12
13in float vertexDistance;
14in vec2 texCoord0;
15in vec4 vertexColor;
16in vec4 lightColor;
17in vec4 maxLightColor;
18out vec4 fragColor;
19
20void main() {
21 vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator;
22 float alpha = textureLod(Sampler0, texCoord0, 0.0).a * 255.0;
23 color = make_emissive(color, lightColor, maxLightColor, vertexDistance, alpha);
24 color.a = remap_alpha(alpha) / 255.0;
25 if (color.a < 0.1) {
26 discard;
27 }
28 fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
29}
diff --git a/assets/minecraft/shaders/core/rendertype_armor_cutout_no_cull.vsh b/assets/minecraft/shaders/core/rendertype_armor_cutout_no_cull.vsh
new file mode 100755
index 00000000..03bf4875
--- /dev/null
+++ b/assets/minecraft/shaders/core/rendertype_armor_cutout_no_cull.vsh
@@ -0,0 +1,41 @@
1#version 150
2
3#moj_import <light.glsl>
4#moj_import <fog.glsl>
5
6in vec3 Position;
7in vec4 Color;
8in vec2 UV0;
9in vec2 UV1;
10in ivec2 UV2;
11in vec3 Normal;
12
13uniform sampler2D Sampler2;
14
15uniform mat4 ModelViewMat;
16uniform mat4 ProjMat;
17uniform int FogShape;
18uniform mat3 IViewRotMat;
19
20uniform vec3 Light0_Direction;
21uniform vec3 Light1_Direction;
22
23out float vertexDistance;
24out vec4 vertexColor;
25out vec4 lightColor;
26out vec4 maxLightColor;
27out vec2 texCoord0;
28out vec2 texCoord1;
29out vec4 normal;
30
31void main() {
32 gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
33
34 vertexDistance = fog_distance(ModelViewMat, IViewRotMat * Position, FogShape);
35 vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color);
36 lightColor = minecraft_sample_lightmap(Sampler2, UV2);
37 maxLightColor = minecraft_sample_lightmap(Sampler2, ivec2(240.0, 240.0));
38 texCoord0 = UV0;
39 texCoord1 = UV1;
40 normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
41}
diff --git a/assets/minecraft/shaders/core/rendertype_cutout.fsh b/assets/minecraft/shaders/core/rendertype_cutout.fsh
new file mode 100755
index 00000000..8db7346c
--- /dev/null
+++ b/assets/minecraft/shaders/core/rendertype_cutout.fsh
@@ -0,0 +1,33 @@
1#version 150
2
3#moj_import <fog.glsl>
4#moj_import <emissive_utils.glsl>
5
6uniform sampler2D Sampler0;
7
8uniform vec4 ColorModulator;
9uniform float FogStart;
10uniform float FogEnd;
11uniform vec4 FogColor;
12
13in float vertexDistance;
14in float dimension;
15in vec4 vertexColor;
16in vec4 lightColor;
17in vec4 maxLightColor;
18in vec2 texCoord0;
19in vec3 faceLightingNormal;
20in vec4 normal;
21
22out vec4 fragColor;
23
24void main() {
25 vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator;
26 float alpha = textureLod(Sampler0, texCoord0, 0.0).a * 255.0;
27 color = make_emissive(color, lightColor, maxLightColor, vertexDistance, alpha) / face_lighting_check(faceLightingNormal, alpha, dimension);
28 color.a = remap_alpha(alpha) / 255.0;
29 if (color.a < 0.1) {
30 discard;
31 }
32 fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
33}
diff --git a/assets/minecraft/shaders/core/rendertype_cutout.vsh b/assets/minecraft/shaders/core/rendertype_cutout.vsh
new file mode 100755
index 00000000..66307ce4
--- /dev/null
+++ b/assets/minecraft/shaders/core/rendertype_cutout.vsh
@@ -0,0 +1,41 @@
1#version 150
2
3#moj_import <light.glsl>
4#moj_import <fog.glsl>
5#moj_import <emissive_utils.glsl>
6
7in vec3 Position;
8in vec4 Color;
9in vec2 UV0;
10in ivec2 UV2;
11in vec3 Normal;
12
13uniform sampler2D Sampler2;
14
15uniform mat4 ModelViewMat;
16uniform mat4 ProjMat;
17uniform int FogShape;
18uniform vec3 ChunkOffset;
19
20out float vertexDistance;
21out float dimension;
22out vec4 vertexColor;
23out vec4 lightColor;
24out vec4 maxLightColor;
25out vec2 texCoord0;
26out vec3 faceLightingNormal;
27out vec4 normal;
28
29void main() {
30 vec3 pos = Position + ChunkOffset;
31 gl_Position = ProjMat * ModelViewMat * vec4(pos, 1.0);
32
33 vertexDistance = fog_distance(ModelViewMat, pos, FogShape);
34 dimension = get_dimension(minecraft_sample_lightmap(Sampler2, ivec2(0.0, 0.0)));
35 vertexColor = Color;
36 lightColor = minecraft_sample_lightmap(Sampler2, UV2);
37 maxLightColor = minecraft_sample_lightmap(Sampler2, ivec2(240.0, 240.0));
38 texCoord0 = UV0;
39 faceLightingNormal = Normal;
40 normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
41}
diff --git a/assets/minecraft/shaders/core/rendertype_cutout_mipped.fsh b/assets/minecraft/shaders/core/rendertype_cutout_mipped.fsh
new file mode 100755
index 00000000..5f085b1e
--- /dev/null
+++ b/assets/minecraft/shaders/core/rendertype_cutout_mipped.fsh
@@ -0,0 +1,33 @@
1#version 150
2
3#moj_import <fog.glsl>
4#moj_import <emissive_utils.glsl>
5
6uniform sampler2D Sampler0;
7
8uniform vec4 ColorModulator;
9uniform float FogStart;
10uniform float FogEnd;
11uniform vec4 FogColor;
12
13in float vertexDistance;
14in float dimension;
15in vec4 vertexColor;
16in vec4 lightColor;
17in vec4 maxLightColor;
18in vec2 texCoord0;
19in vec3 faceLightingNormal;
20in vec4 normal;
21
22out vec4 fragColor;
23
24void main() {
25 vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator;
26 float alpha = textureLod(Sampler0, texCoord0, 0.0).a * 255.0;
27 color = make_emissive(color, lightColor, maxLightColor, vertexDistance, alpha) / face_lighting_check(faceLightingNormal, alpha, dimension);
28 color.a = remap_alpha(alpha) / 255.0;
29 if (color.a < 0.5) {
30 discard;
31 }
32 fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
33}
diff --git a/assets/minecraft/shaders/core/rendertype_cutout_mipped.vsh b/assets/minecraft/shaders/core/rendertype_cutout_mipped.vsh
new file mode 100755
index 00000000..66307ce4
--- /dev/null
+++ b/assets/minecraft/shaders/core/rendertype_cutout_mipped.vsh
@@ -0,0 +1,41 @@
1#version 150
2
3#moj_import <light.glsl>
4#moj_import <fog.glsl>
5#moj_import <emissive_utils.glsl>
6
7in vec3 Position;
8in vec4 Color;
9in vec2 UV0;
10in ivec2 UV2;
11in vec3 Normal;
12
13uniform sampler2D Sampler2;
14
15uniform mat4 ModelViewMat;
16uniform mat4 ProjMat;
17uniform int FogShape;
18uniform vec3 ChunkOffset;
19
20out float vertexDistance;
21out float dimension;
22out vec4 vertexColor;
23out vec4 lightColor;
24out vec4 maxLightColor;
25out vec2 texCoord0;
26out vec3 faceLightingNormal;
27out vec4 normal;
28
29void main() {
30 vec3 pos = Position + ChunkOffset;
31 gl_Position = ProjMat * ModelViewMat * vec4(pos, 1.0);
32
33 vertexDistance = fog_distance(ModelViewMat, pos, FogShape);
34 dimension = get_dimension(minecraft_sample_lightmap(Sampler2, ivec2(0.0, 0.0)));
35 vertexColor = Color;
36 lightColor = minecraft_sample_lightmap(Sampler2, UV2);
37 maxLightColor = minecraft_sample_lightmap(Sampler2, ivec2(240.0, 240.0));
38 texCoord0 = UV0;
39 faceLightingNormal = Normal;
40 normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
41}
diff --git a/assets/minecraft/shaders/core/rendertype_entity_cutout.fsh b/assets/minecraft/shaders/core/rendertype_entity_cutout.fsh
new file mode 100755
index 00000000..ffe3e8a6
--- /dev/null
+++ b/assets/minecraft/shaders/core/rendertype_entity_cutout.fsh
@@ -0,0 +1,34 @@
1#version 150
2
3#moj_import <fog.glsl>
4#moj_import <emissive_utils.glsl>
5
6uniform sampler2D Sampler0;
7
8uniform vec4 ColorModulator;
9uniform float FogStart;
10uniform float FogEnd;
11uniform vec4 FogColor;
12
13in float vertexDistance;
14in vec4 vertexColor;
15in vec4 lightColor;
16in vec4 maxLightColor;
17in vec4 overlayColor;
18in vec2 texCoord0;
19in vec4 normal;
20
21out vec4 fragColor;
22
23void main() {
24 vec4 color = texture(Sampler0, texCoord0);
25 color *= vertexColor * ColorModulator;
26 color.rgb = mix(overlayColor.rgb, color.rgb, overlayColor.a);
27 float alpha = textureLod(Sampler0, texCoord0, 0.0).a * 255.0;
28 color = make_emissive(color, lightColor, maxLightColor, vertexDistance, alpha);
29 color.a = remap_alpha(alpha) / 255.0;
30 if (color.a < 0.1) {
31 discard;
32 }
33 fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
34}
diff --git a/assets/minecraft/shaders/core/rendertype_entity_cutout.vsh b/assets/minecraft/shaders/core/rendertype_entity_cutout.vsh
new file mode 100755
index 00000000..8866c684
--- /dev/null
+++ b/assets/minecraft/shaders/core/rendertype_entity_cutout.vsh
@@ -0,0 +1,42 @@
1#version 150
2
3#moj_import <light.glsl>
4#moj_import <fog.glsl>
5
6in vec3 Position;
7in vec4 Color;
8in vec2 UV0;
9in ivec2 UV1;
10in ivec2 UV2;
11in vec3 Normal;
12
13uniform sampler2D Sampler1;
14uniform sampler2D Sampler2;
15
16uniform mat4 ModelViewMat;
17uniform mat4 ProjMat;
18uniform int FogShape;
19uniform mat3 IViewRotMat;
20
21uniform vec3 Light0_Direction;
22uniform vec3 Light1_Direction;
23
24out float vertexDistance;
25out vec4 vertexColor;
26out vec4 lightColor;
27out vec4 maxLightColor;
28out vec4 overlayColor;
29out vec2 texCoord0;
30out vec4 normal;
31
32void main() {
33 gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
34
35 vertexDistance = fog_distance(ModelViewMat, IViewRotMat * Position, FogShape);
36 vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color);
37 lightColor = minecraft_sample_lightmap(Sampler2, UV2);
38 maxLightColor = minecraft_sample_lightmap(Sampler2, ivec2(240.0, 240.0));
39 overlayColor = texelFetch(Sampler1, UV1, 0);
40 texCoord0 = UV0;
41 normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
42}
diff --git a/assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull.fsh b/assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull.fsh
new file mode 100755
index 00000000..ffe3e8a6
--- /dev/null
+++ b/assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull.fsh
@@ -0,0 +1,34 @@
1#version 150
2
3#moj_import <fog.glsl>
4#moj_import <emissive_utils.glsl>
5
6uniform sampler2D Sampler0;
7
8uniform vec4 ColorModulator;
9uniform float FogStart;
10uniform float FogEnd;
11uniform vec4 FogColor;
12
13in float vertexDistance;
14in vec4 vertexColor;
15in vec4 lightColor;
16in vec4 maxLightColor;
17in vec4 overlayColor;
18in vec2 texCoord0;
19in vec4 normal;
20
21out vec4 fragColor;
22
23void main() {
24 vec4 color = texture(Sampler0, texCoord0);
25 color *= vertexColor * ColorModulator;
26 color.rgb = mix(overlayColor.rgb, color.rgb, overlayColor.a);
27 float alpha = textureLod(Sampler0, texCoord0, 0.0).a * 255.0;
28 color = make_emissive(color, lightColor, maxLightColor, vertexDistance, alpha);
29 color.a = remap_alpha(alpha) / 255.0;
30 if (color.a < 0.1) {
31 discard;
32 }
33 fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
34}
diff --git a/assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull.vsh b/assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull.vsh
new file mode 100755
index 00000000..8866c684
--- /dev/null
+++ b/assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull.vsh
@@ -0,0 +1,42 @@
1#version 150
2
3#moj_import <light.glsl>
4#moj_import <fog.glsl>
5
6in vec3 Position;
7in vec4 Color;
8in vec2 UV0;
9in ivec2 UV1;
10in ivec2 UV2;
11in vec3 Normal;
12
13uniform sampler2D Sampler1;
14uniform sampler2D Sampler2;
15
16uniform mat4 ModelViewMat;
17uniform mat4 ProjMat;
18uniform int FogShape;
19uniform mat3 IViewRotMat;
20
21uniform vec3 Light0_Direction;
22uniform vec3 Light1_Direction;
23
24out float vertexDistance;
25out vec4 vertexColor;
26out vec4 lightColor;
27out vec4 maxLightColor;
28out vec4 overlayColor;
29out vec2 texCoord0;
30out vec4 normal;
31
32void main() {
33 gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
34
35 vertexDistance = fog_distance(ModelViewMat, IViewRotMat * Position, FogShape);
36 vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color);
37 lightColor = minecraft_sample_lightmap(Sampler2, UV2);
38 maxLightColor = minecraft_sample_lightmap(Sampler2, ivec2(240.0, 240.0));
39 overlayColor = texelFetch(Sampler1, UV1, 0);
40 texCoord0 = UV0;
41 normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
42}
diff --git a/assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull_z_offset.fsh b/assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull_z_offset.fsh
new file mode 100755
index 00000000..ffe3e8a6
--- /dev/null
+++ b/assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull_z_offset.fsh
@@ -0,0 +1,34 @@
1#version 150
2
3#moj_import <fog.glsl>
4#moj_import <emissive_utils.glsl>
5
6uniform sampler2D Sampler0;
7
8uniform vec4 ColorModulator;
9uniform float FogStart;
10uniform float FogEnd;
11uniform vec4 FogColor;
12
13in float vertexDistance;
14in vec4 vertexColor;
15in vec4 lightColor;
16in vec4 maxLightColor;
17in vec4 overlayColor;
18in vec2 texCoord0;
19in vec4 normal;
20
21out vec4 fragColor;
22
23void main() {
24 vec4 color = texture(Sampler0, texCoord0);
25 color *= vertexColor * ColorModulator;
26 color.rgb = mix(overlayColor.rgb, color.rgb, overlayColor.a);
27 float alpha = textureLod(Sampler0, texCoord0, 0.0).a * 255.0;
28 color = make_emissive(color, lightColor, maxLightColor, vertexDistance, alpha);
29 color.a = remap_alpha(alpha) / 255.0;
30 if (color.a < 0.1) {
31 discard;
32 }
33 fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
34}
diff --git a/assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull_z_offset.vsh b/assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull_z_offset.vsh
new file mode 100755
index 00000000..8866c684
--- /dev/null
+++ b/assets/minecraft/shaders/core/rendertype_entity_cutout_no_cull_z_offset.vsh
@@ -0,0 +1,42 @@
1#version 150
2
3#moj_import <light.glsl>
4#moj_import <fog.glsl>
5
6in vec3 Position;
7in vec4 Color;
8in vec2 UV0;
9in ivec2 UV1;
10in ivec2 UV2;
11in vec3 Normal;
12
13uniform sampler2D Sampler1;
14uniform sampler2D Sampler2;
15
16uniform mat4 ModelViewMat;
17uniform mat4 ProjMat;
18uniform int FogShape;
19uniform mat3 IViewRotMat;
20
21uniform vec3 Light0_Direction;
22uniform vec3 Light1_Direction;
23
24out float vertexDistance;
25out vec4 vertexColor;
26out vec4 lightColor;
27out vec4 maxLightColor;
28out vec4 overlayColor;
29out vec2 texCoord0;
30out vec4 normal;
31
32void main() {
33 gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
34
35 vertexDistance = fog_distance(ModelViewMat, IViewRotMat * Position, FogShape);
36 vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color);
37 lightColor = minecraft_sample_lightmap(Sampler2, UV2);
38 maxLightColor = minecraft_sample_lightmap(Sampler2, ivec2(240.0, 240.0));
39 overlayColor = texelFetch(Sampler1, UV1, 0);
40 texCoord0 = UV0;
41 normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
42}
diff --git a/assets/minecraft/shaders/core/rendertype_entity_no_outline.fsh b/assets/minecraft/shaders/core/rendertype_entity_no_outline.fsh
new file mode 100755
index 00000000..7697f32e
--- /dev/null
+++ b/assets/minecraft/shaders/core/rendertype_entity_no_outline.fsh
@@ -0,0 +1,28 @@
1#version 150
2
3#moj_import <fog.glsl>
4#moj_import <emissive_utils.glsl>
5
6uniform sampler2D Sampler0;
7
8uniform vec4 ColorModulator;
9uniform float FogStart;
10uniform float FogEnd;
11uniform vec4 FogColor;
12
13in float vertexDistance;
14in vec4 vertexColor;
15in vec4 lightColor;
16in vec4 maxLightColor;
17in vec2 texCoord0;
18in vec4 normal;
19
20out vec4 fragColor;
21
22void main() {
23 vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator;
24 float alpha = textureLod(Sampler0, texCoord0, 0.0).a * 255.0;
25 color = make_emissive(color, lightColor, maxLightColor, vertexDistance, alpha);
26 color.a = remap_alpha(alpha) / 255.0;
27 fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
28}
diff --git a/assets/minecraft/shaders/core/rendertype_entity_no_outline.vsh b/assets/minecraft/shaders/core/rendertype_entity_no_outline.vsh
new file mode 100755
index 00000000..ea6651fd
--- /dev/null
+++ b/assets/minecraft/shaders/core/rendertype_entity_no_outline.vsh
@@ -0,0 +1,38 @@
1#version 150
2
3#moj_import <light.glsl>
4#moj_import <fog.glsl>
5
6in vec3 Position;
7in vec4 Color;
8in vec2 UV0;
9in ivec2 UV2;
10in vec3 Normal;
11
12uniform sampler2D Sampler2;
13
14uniform mat4 ModelViewMat;
15uniform mat4 ProjMat;
16uniform int FogShape;
17uniform mat3 IViewRotMat;
18
19uniform vec3 Light0_Direction;
20uniform vec3 Light1_Direction;
21
22out float vertexDistance;
23out vec4 vertexColor;
24out vec4 lightColor;
25out vec4 maxLightColor;
26out vec2 texCoord0;
27out vec4 normal;
28
29void main() {
30 gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
31
32 vertexDistance = fog_distance(ModelViewMat, IViewRotMat * Position, FogShape);
33 vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color);
34 lightColor = minecraft_sample_lightmap(Sampler2, UV2);
35 maxLightColor = minecraft_sample_lightmap(Sampler2, ivec2(240.0, 240.0));
36 texCoord0 = UV0;
37 normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
38}
diff --git a/assets/minecraft/shaders/core/rendertype_entity_solid.fsh b/assets/minecraft/shaders/core/rendertype_entity_solid.fsh
new file mode 100755
index 00000000..52953393
--- /dev/null
+++ b/assets/minecraft/shaders/core/rendertype_entity_solid.fsh
@@ -0,0 +1,34 @@
1#version 150
2
3#moj_import <fog.glsl>
4
5uniform sampler2D Sampler0;
6
7uniform vec4 ColorModulator;
8uniform float FogStart;
9uniform float FogEnd;
10uniform vec4 FogColor;
11
12in float vertexDistance;
13in vec4 vertexColor;
14in vec4 lightMapColor;
15in vec4 overlayColor;
16in vec2 texCoord0;
17in vec4 normal;
18flat in int player;
19in vec3 settings;
20in vec3 settings2;
21
22out vec4 fragColor;
23
24void main() {
25 vec4 color = texture(Sampler0, texCoord0);
26 if (player == 1 || player == 2) {
27 #moj_import <player.glsl>
28 } else {
29 color *= vertexColor * ColorModulator;
30 color.rgb = mix(overlayColor.rgb, color.rgb, overlayColor.a);
31 color *= lightMapColor;
32 fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
33 }
34}
diff --git a/assets/minecraft/shaders/core/rendertype_entity_solid.json b/assets/minecraft/shaders/core/rendertype_entity_solid.json
new file mode 100755
index 00000000..9d50760a
--- /dev/null
+++ b/assets/minecraft/shaders/core/rendertype_entity_solid.json
@@ -0,0 +1,35 @@
1{
2 "blend": {
3 "func": "add",
4 "srcrgb": "srcalpha",
5 "dstrgb": "1-srcalpha"
6 },
7 "vertex": "rendertype_entity_translucent_solid",
8 "fragment": "rendertype_entity_solid",
9 "attributes": [
10 "Position",
11 "Color",
12 "UV0",
13 "UV1",
14 "UV2",
15 "Normal"
16 ],
17 "samplers": [
18 { "name": "Sampler0" },
19 { "name": "Sampler1" },
20 { "name": "Sampler2" }
21 ],
22 "uniforms": [
23 { "name": "ModelViewMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] },
24 { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] },
25 { "name": "IViewRotMat", "type": "matrix3x3", "count": 9, "values": [ 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0 ] },
26 { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
27 { "name": "Light0_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] },
28 { "name": "Light1_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] },
29 { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
30 { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
31 { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] },
32 { "name": "FogShape", "type": "int", "count": 1, "values": [ 0 ] },
33 { "name": "GameTime", "type": "float", "count": 1, "values": [ 0.0 ] }
34 ]
35}
diff --git a/assets/minecraft/shaders/core/rendertype_entity_solid.vsh b/assets/minecraft/shaders/core/rendertype_entity_solid.vsh
new file mode 100755
index 00000000..8866c684
--- /dev/null
+++ b/assets/minecraft/shaders/core/rendertype_entity_solid.vsh
@@ -0,0 +1,42 @@
1#version 150
2
3#moj_import <light.glsl>
4#moj_import <fog.glsl>
5
6in vec3 Position;
7in vec4 Color;
8in vec2 UV0;
9in ivec2 UV1;
10in ivec2 UV2;
11in vec3 Normal;
12
13uniform sampler2D Sampler1;
14uniform sampler2D Sampler2;
15
16uniform mat4 ModelViewMat;
17uniform mat4 ProjMat;
18uniform int FogShape;
19uniform mat3 IViewRotMat;
20
21uniform vec3 Light0_Direction;
22uniform vec3 Light1_Direction;
23
24out float vertexDistance;
25out vec4 vertexColor;
26out vec4 lightColor;
27out vec4 maxLightColor;
28out vec4 overlayColor;
29out vec2 texCoord0;
30out vec4 normal;
31
32void main() {
33 gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
34
35 vertexDistance = fog_distance(ModelViewMat, IViewRotMat * Position, FogShape);
36 vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color);
37 lightColor = minecraft_sample_lightmap(Sampler2, UV2);
38 maxLightColor = minecraft_sample_lightmap(Sampler2, ivec2(240.0, 240.0));
39 overlayColor = texelFetch(Sampler1, UV1, 0);
40 texCoord0 = UV0;
41 normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
42}
diff --git a/assets/minecraft/shaders/core/rendertype_entity_translucent.fsh b/assets/minecraft/shaders/core/rendertype_entity_translucent.fsh
new file mode 100755
index 00000000..ec0ab606
--- /dev/null
+++ b/assets/minecraft/shaders/core/rendertype_entity_translucent.fsh
@@ -0,0 +1,37 @@
1#version 150
2
3#moj_import <fog.glsl>
4
5uniform sampler2D Sampler0;
6
7uniform vec4 ColorModulator;
8uniform float FogStart;
9uniform float FogEnd;
10uniform vec4 FogColor;
11
12in float vertexDistance;
13in vec4 vertexColor;
14in vec4 lightMapColor;
15in vec4 overlayColor;
16in vec2 texCoord0;
17in vec4 normal;
18flat in int player;
19in vec3 settings;
20in vec3 settings2;
21
22out vec4 fragColor;
23
24void main() {
25 vec4 color = texture(Sampler0, texCoord0);
26 if (player == 1 || player == 2) {
27 #moj_import <player.glsl>
28 } else {
29 color *= vertexColor * ColorModulator;
30 color.rgb = mix(overlayColor.rgb, color.rgb, overlayColor.a);
31 color *= lightMapColor;
32 fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
33 }
34 if (color.a < 0.1) {
35 discard;
36 }
37}
diff --git a/assets/minecraft/shaders/core/rendertype_entity_translucent.json b/assets/minecraft/shaders/core/rendertype_entity_translucent.json
new file mode 100755
index 00000000..07a4726d
--- /dev/null
+++ b/assets/minecraft/shaders/core/rendertype_entity_translucent.json
@@ -0,0 +1,35 @@
1{
2 "blend": {
3 "func": "add",
4 "srcrgb": "srcalpha",
5 "dstrgb": "1-srcalpha"
6 },
7 "vertex": "rendertype_entity_translucent_solid",
8 "fragment": "rendertype_entity_translucent",
9 "attributes": [
10 "Position",
11 "Color",
12 "UV0",
13 "UV1",
14 "UV2",
15 "Normal"
16 ],
17 "samplers": [
18 { "name": "Sampler0" },
19 { "name": "Sampler1" },
20 { "name": "Sampler2" }
21 ],
22 "uniforms": [
23 { "name": "ModelViewMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] },
24 { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] },
25 { "name": "IViewRotMat", "type": "matrix3x3", "count": 9, "values": [ 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0 ] },
26 { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
27 { "name": "Light0_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] },
28 { "name": "Light1_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] },
29 { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
30 { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
31 { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] },
32 { "name": "FogShape", "type": "int", "count": 1, "values": [ 0 ] },
33 { "name": "GameTime", "type": "float", "count": 1, "values": [ 0.0 ] }
34 ]
35}
diff --git a/assets/minecraft/shaders/core/rendertype_entity_translucent.vsh b/assets/minecraft/shaders/core/rendertype_entity_translucent.vsh
new file mode 100755
index 00000000..8866c684
--- /dev/null
+++ b/assets/minecraft/shaders/core/rendertype_entity_translucent.vsh
@@ -0,0 +1,42 @@
1#version 150
2
3#moj_import <light.glsl>
4#moj_import <fog.glsl>
5
6in vec3 Position;
7in vec4 Color;
8in vec2 UV0;
9in ivec2 UV1;
10in ivec2 UV2;
11in vec3 Normal;
12
13uniform sampler2D Sampler1;
14uniform sampler2D Sampler2;
15
16uniform mat4 ModelViewMat;
17uniform mat4 ProjMat;
18uniform int FogShape;
19uniform mat3 IViewRotMat;
20
21uniform vec3 Light0_Direction;
22uniform vec3 Light1_Direction;
23
24out float vertexDistance;
25out vec4 vertexColor;
26out vec4 lightColor;
27out vec4 maxLightColor;
28out vec4 overlayColor;
29out vec2 texCoord0;
30out vec4 normal;
31
32void main() {
33 gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
34
35 vertexDistance = fog_distance(ModelViewMat, IViewRotMat * Position, FogShape);
36 vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color);
37 lightColor = minecraft_sample_lightmap(Sampler2, UV2);
38 maxLightColor = minecraft_sample_lightmap(Sampler2, ivec2(240.0, 240.0));
39 overlayColor = texelFetch(Sampler1, UV1, 0);
40 texCoord0 = UV0;
41 normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
42}
diff --git a/assets/minecraft/shaders/core/rendertype_entity_translucent_cull.fsh b/assets/minecraft/shaders/core/rendertype_entity_translucent_cull.fsh
new file mode 100755
index 00000000..94962da5
--- /dev/null
+++ b/assets/minecraft/shaders/core/rendertype_entity_translucent_cull.fsh
@@ -0,0 +1,32 @@
1#version 150
2
3#moj_import <fog.glsl>
4#moj_import <emissive_utils.glsl>
5
6uniform sampler2D Sampler0;
7
8uniform vec4 ColorModulator;
9uniform float FogStart;
10uniform float FogEnd;
11uniform vec4 FogColor;
12
13in float vertexDistance;
14in vec4 vertexColor;
15in vec4 lightColor;
16in vec4 maxLightColor;
17in vec2 texCoord0;
18in vec2 texCoord1;
19in vec4 normal;
20
21out vec4 fragColor;
22
23void main() {
24 vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator;
25 float alpha = textureLod(Sampler0, texCoord0, 0.0).a * 255.0;
26 color = make_emissive(color, lightColor, maxLightColor, vertexDistance, alpha);
27 color.a = remap_alpha(alpha) / 255.0;
28 if (color.a < 0.1) {
29 discard;
30 }
31 fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
32} \ No newline at end of file
diff --git a/assets/minecraft/shaders/core/rendertype_entity_translucent_cull.vsh b/assets/minecraft/shaders/core/rendertype_entity_translucent_cull.vsh
new file mode 100755
index 00000000..2fbbaa14
--- /dev/null
+++ b/assets/minecraft/shaders/core/rendertype_entity_translucent_cull.vsh
@@ -0,0 +1,43 @@
1#version 150
2
3#moj_import <light.glsl>
4#moj_import <fog.glsl>
5
6in vec3 Position;
7in vec4 Color;
8in vec2 UV0;
9in vec2 UV1;
10in ivec2 UV2;
11in vec3 Normal;
12
13uniform sampler2D Sampler2;
14
15uniform mat4 ModelViewMat;
16uniform mat4 ProjMat;
17uniform int FogShape;
18uniform mat3 IViewRotMat;
19
20uniform vec3 Light0_Direction;
21uniform vec3 Light1_Direction;
22
23out float vertexDistance;
24out vec4 vertexColor;
25out vec4 lightColor;
26out vec4 maxLightColor;
27out vec2 texCoord0;
28out vec2 texCoord1;
29out vec2 texCoord2;
30out vec4 normal;
31
32void main() {
33 gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
34
35 vertexDistance = fog_distance(ModelViewMat, IViewRotMat * Position, FogShape);
36 vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color);
37 lightColor = minecraft_sample_lightmap(Sampler2, UV2);
38 maxLightColor = minecraft_sample_lightmap(Sampler2, ivec2(240.0, 240.0));
39 texCoord0 = UV0;
40 texCoord1 = UV1;
41 texCoord2 = UV2;
42 normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
43}
diff --git a/assets/minecraft/shaders/core/rendertype_entity_translucent_solid.vsh b/assets/minecraft/shaders/core/rendertype_entity_translucent_solid.vsh
new file mode 100755
index 00000000..6a99a480
--- /dev/null
+++ b/assets/minecraft/shaders/core/rendertype_entity_translucent_solid.vsh
@@ -0,0 +1,170 @@
1#version 150
2
3#moj_import <light.glsl>
4#moj_import <fog.glsl>
5
6in vec3 Position;
7in vec4 Color;
8in vec2 UV0;
9in ivec2 UV1;
10in ivec2 UV2;
11in vec3 Normal;
12
13uniform sampler2D Sampler0;
14uniform sampler2D Sampler1;
15uniform sampler2D Sampler2;
16
17uniform mat4 ModelViewMat;
18uniform mat4 ProjMat;
19uniform mat3 IViewRotMat;
20uniform int FogShape;
21uniform float GameTime;
22
23uniform vec3 Light0_Direction;
24uniform vec3 Light1_Direction;
25
26out float vertexDistance;
27out vec4 vertexColor;
28out vec4 lightMapColor;
29out vec4 overlayColor;
30out vec2 texCoord0;
31out vec4 normal;
32flat out int player;
33out vec3 settings;
34out vec3 settings2;
35
36float hash(float p) {
37 p = fract(p * 0.011);
38 p *= p + 7.5;
39 p *= p + p;
40 return fract(p);
41}
42
43float noise(float x) {
44 float i = floor(x);
45 float f = fract(x);
46 float u = f * f * (3.0 - 2.0 * f);
47 return mix(hash(i), hash(i + 1.0), u);
48}
49
50float fbm(float x) {
51 float v = 0.0;
52 float a = 0.5;
53 float shift = float(100);
54 for (int i = 0; i < 3; ++i) {
55 v += a * noise(x);
56 x = x * 2.0 + shift;
57 a *= 0.5;
58 }
59 return v;
60}
61
62void main() {
63 vec3 pos = IViewRotMat * Position;
64
65 gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
66
67 vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color);
68 lightMapColor = texelFetch(Sampler2, UV2 / 16, 0);
69 vec4 damageFlash = texelFetch(Sampler1, UV1, 0);
70 overlayColor = damageFlash;
71 texCoord0 = UV0;
72 normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
73
74 player = 0;
75 if (ivec2(textureSize(Sampler0, 0)) == ivec2(64, 64) && ivec4(texelFetch(Sampler0, ivec2(0, 16), 0) * 255.0 + 0.5) == ivec4(1, 1, 1, 255)) {
76 player = 1;
77 settings = texelFetch(Sampler0, ivec2(1, 16), 0).rgb;
78 settings2 = texelFetch(Sampler0, ivec2(2, 16), 0).rgb;
79 // Check if current vertex is on the player's face
80 if (texCoord0.x >= 0.125 && texCoord0.y >= 0.125 && texCoord0.x <= 0.25 && texCoord0.y <= 0.25) {
81 // Damage face
82 if (settings.r > 0.99 && damageFlash != vec4(1.0)) {
83 if (gl_VertexID == 16) {
84 texCoord0 = vec2(0.5, 0.0);
85 } else if (gl_VertexID == 17) {
86 texCoord0 = vec2(0.375, 0.0);
87 } else if (gl_VertexID == 18) {
88 texCoord0 = vec2(0.375, 0.125);
89 } else if (gl_VertexID == 19) {
90 texCoord0 = vec2(0.5, 0.125);
91 }
92 // Blinking
93 } else if (settings.b > 0.99) {
94 vec3 blinkOffset = texelFetch(Sampler0, ivec2(20, 20), 0).rgb;
95 if (fbm(floor(GameTime * 6400.0) * 64.0 + (blinkOffset.r + blinkOffset.g + blinkOffset.b) * 0.01) > 0.725) {
96 if (gl_VertexID == 16) {
97 texCoord0 = vec2(0.125, 0.0);
98 } else if (gl_VertexID == 17) {
99 texCoord0 = vec2(0.0, 0.0);
100 } else if (gl_VertexID == 18) {
101 texCoord0 = vec2(0.0, 0.125);
102 } else if (gl_VertexID == 19) {
103 texCoord0 = vec2(0.125, 0.125);
104 }
105 }
106 }
107 } else if (texCoord0.x >= 0.625 && texCoord0.y >= 0.125 && texCoord0.x <= 0.75 && texCoord0.y <= 0.25) {
108 // Damage face
109 if (settings.r > 0.99 && damageFlash != vec4(1.0)) {
110 if (gl_VertexID == 160) {
111 texCoord0 = vec2(1.0, 0.0);
112 } else if (gl_VertexID == 161) {
113 texCoord0 = vec2(0.875, 0.0);
114 } else if (gl_VertexID == 162) {
115 texCoord0 = vec2(0.875, 0.125);
116 } else if (gl_VertexID == 163) {
117 texCoord0 = vec2(1.0, 0.125);
118 }
119 // Blinking
120 } else if (settings.b > 0.99) {
121 vec3 blinkOffset = texelFetch(Sampler0, ivec2(3, 19), 0).rgb;
122 if (fbm(floor(GameTime * 6400.0) * 64.0 + (blinkOffset.r + blinkOffset.g + blinkOffset.b) * 0.01) > 0.725) {
123 if (gl_VertexID == 160) {
124 texCoord0 = vec2(0.625, 0.0);
125 } else if (gl_VertexID == 161) {
126 texCoord0 = vec2(0.5, 0.0);
127 } else if (gl_VertexID == 162) {
128 texCoord0 = vec2(0.5, 0.125);
129 } else if (gl_VertexID == 163) {
130 texCoord0 = vec2(0.625, 0.125);
131 }
132 }
133 }
134 }
135 // Custom damage flash
136 if (settings.g > 0.99) {
137 overlayColor = texelFetch(Sampler0, ivec2(0, 19), 0);
138 overlayColor.a = damageFlash.a;
139 }
140 // Cape
141 if (settings2.g > 0.99) {
142 vec3 normal = IViewRotMat * Normal;
143 float wave = (sin(GameTime * 800.0) * 0.5 + 0.5) * 0.2;
144 float angle = wave + 0.2;
145 if (gl_VertexID == 284) {
146 player = 2;
147 pos += normal * 0.045;
148 texCoord0 = vec2(1.0, 0.25);
149 } else if (gl_VertexID == 285) {
150 player = 2;
151 pos += normal * 0.045;
152 texCoord0 = vec2(0.875, 0.25);
153 } else if (gl_VertexID == 286) {
154 player = 2;
155 texCoord0 = vec2(0.875, 0.5);
156 pos += normal * angle;
157 pos.y += length(angle) * 0.4 - 0.2;
158 } else if (gl_VertexID == 287) {
159 player = 2;
160 texCoord0 = vec2(1.0, 0.5);
161 pos += normal * angle;
162 pos.y += length(angle) * 0.4 - 0.2;
163 }
164 }
165
166 gl_Position = ProjMat * ModelViewMat * vec4(pos * IViewRotMat, 1.0);
167 }
168
169 vertexDistance = fog_distance(ModelViewMat, pos, FogShape);
170}
diff --git a/assets/minecraft/shaders/core/rendertype_item_entity_translucent_cull.fsh b/assets/minecraft/shaders/core/rendertype_item_entity_translucent_cull.fsh
new file mode 100755
index 00000000..892ddb87
--- /dev/null
+++ b/assets/minecraft/shaders/core/rendertype_item_entity_translucent_cull.fsh
@@ -0,0 +1,32 @@
1#version 150
2
3#moj_import <fog.glsl>
4#moj_import <emissive_utils.glsl>
5
6uniform sampler2D Sampler0;
7
8uniform vec4 ColorModulator;
9uniform float FogStart;
10uniform float FogEnd;
11uniform vec4 FogColor;
12
13in float vertexDistance;
14in vec4 vertexColor;
15in vec4 lightColor;
16in vec4 maxLightColor;
17in vec2 texCoord0;
18in vec2 texCoord1;
19in vec4 normal;
20
21out vec4 fragColor;
22
23void main() {
24 vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator;
25 float alpha = textureLod(Sampler0, texCoord0, 0.0).a * 255.0;
26 color = make_emissive(color, lightColor, maxLightColor, vertexDistance, alpha);
27 color.a = remap_alpha(alpha) / 255.0;
28 if (color.a < 0.1) {
29 discard;
30 }
31 fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
32}
diff --git a/assets/minecraft/shaders/core/rendertype_item_entity_translucent_cull.vsh b/assets/minecraft/shaders/core/rendertype_item_entity_translucent_cull.vsh
new file mode 100755
index 00000000..2fbbaa14
--- /dev/null
+++ b/assets/minecraft/shaders/core/rendertype_item_entity_translucent_cull.vsh
@@ -0,0 +1,43 @@
1#version 150
2
3#moj_import <light.glsl>
4#moj_import <fog.glsl>
5
6in vec3 Position;
7in vec4 Color;
8in vec2 UV0;
9in vec2 UV1;
10in ivec2 UV2;
11in vec3 Normal;
12
13uniform sampler2D Sampler2;
14
15uniform mat4 ModelViewMat;
16uniform mat4 ProjMat;
17uniform int FogShape;
18uniform mat3 IViewRotMat;
19
20uniform vec3 Light0_Direction;
21uniform vec3 Light1_Direction;
22
23out float vertexDistance;
24out vec4 vertexColor;
25out vec4 lightColor;
26out vec4 maxLightColor;
27out vec2 texCoord0;
28out vec2 texCoord1;
29out vec2 texCoord2;
30out vec4 normal;
31
32void main() {
33 gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
34
35 vertexDistance = fog_distance(ModelViewMat, IViewRotMat * Position, FogShape);
36 vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color);
37 lightColor = minecraft_sample_lightmap(Sampler2, UV2);
38 maxLightColor = minecraft_sample_lightmap(Sampler2, ivec2(240.0, 240.0));
39 texCoord0 = UV0;
40 texCoord1 = UV1;
41 texCoord2 = UV2;
42 normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
43}
diff --git a/assets/minecraft/shaders/core/rendertype_solid.fsh b/assets/minecraft/shaders/core/rendertype_solid.fsh
new file mode 100755
index 00000000..d51f5041
--- /dev/null
+++ b/assets/minecraft/shaders/core/rendertype_solid.fsh
@@ -0,0 +1,33 @@
1#version 150
2
3#moj_import <fog.glsl>
4#moj_import <emissive_utils.glsl>
5
6uniform sampler2D Sampler0;
7
8uniform vec4 ColorModulator;
9uniform float FogStart;
10uniform float FogEnd;
11uniform vec4 FogColor;
12
13in float vertexDistance;
14in float dimension;
15in vec4 vertexColor;
16in vec4 lightColor;
17in vec4 maxLightColor;
18in vec2 texCoord0;
19in vec3 faceLightingNormal;
20in vec4 normal;
21
22out vec4 fragColor;
23
24void main() {
25 vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator;
26 if (color.a < 0.1) {
27 discard;
28 }
29 float alpha = textureLod(Sampler0, texCoord0, 0.0).a * 255.0;
30 color = make_emissive(color, lightColor, maxLightColor, vertexDistance, alpha) / face_lighting_check(faceLightingNormal, alpha, dimension);
31 color.a = remap_alpha(alpha) / 255.0;
32 fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
33}
diff --git a/assets/minecraft/shaders/core/rendertype_solid.vsh b/assets/minecraft/shaders/core/rendertype_solid.vsh
new file mode 100755
index 00000000..66307ce4
--- /dev/null
+++ b/assets/minecraft/shaders/core/rendertype_solid.vsh
@@ -0,0 +1,41 @@
1#version 150
2
3#moj_import <light.glsl>
4#moj_import <fog.glsl>
5#moj_import <emissive_utils.glsl>
6
7in vec3 Position;
8in vec4 Color;
9in vec2 UV0;
10in ivec2 UV2;
11in vec3 Normal;
12
13uniform sampler2D Sampler2;
14
15uniform mat4 ModelViewMat;
16uniform mat4 ProjMat;
17uniform int FogShape;
18uniform vec3 ChunkOffset;
19
20out float vertexDistance;
21out float dimension;
22out vec4 vertexColor;
23out vec4 lightColor;
24out vec4 maxLightColor;
25out vec2 texCoord0;
26out vec3 faceLightingNormal;
27out vec4 normal;
28
29void main() {
30 vec3 pos = Position + ChunkOffset;
31 gl_Position = ProjMat * ModelViewMat * vec4(pos, 1.0);
32
33 vertexDistance = fog_distance(ModelViewMat, pos, FogShape);
34 dimension = get_dimension(minecraft_sample_lightmap(Sampler2, ivec2(0.0, 0.0)));
35 vertexColor = Color;
36 lightColor = minecraft_sample_lightmap(Sampler2, UV2);
37 maxLightColor = minecraft_sample_lightmap(Sampler2, ivec2(240.0, 240.0));
38 texCoord0 = UV0;
39 faceLightingNormal = Normal;
40 normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
41}
diff --git a/assets/minecraft/shaders/core/rendertype_translucent.fsh b/assets/minecraft/shaders/core/rendertype_translucent.fsh
new file mode 100755
index 00000000..2491aecf
--- /dev/null
+++ b/assets/minecraft/shaders/core/rendertype_translucent.fsh
@@ -0,0 +1,30 @@
1#version 150
2
3#moj_import <fog.glsl>
4#moj_import <emissive_utils.glsl>
5
6uniform sampler2D Sampler0;
7
8uniform vec4 ColorModulator;
9uniform float FogStart;
10uniform float FogEnd;
11uniform vec4 FogColor;
12
13in float vertexDistance;
14in float dimension;
15in vec4 vertexColor;
16in vec4 lightColor;
17in vec4 maxLightColor;
18in vec2 texCoord0;
19in vec3 faceLightingNormal;
20in vec4 normal;
21
22out vec4 fragColor;
23
24void main() {
25 vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator;
26 float alpha = textureLod(Sampler0, texCoord0, 0.0).a * 255.0;
27 color = make_emissive(color, lightColor, maxLightColor, vertexDistance, alpha) / face_lighting_check(faceLightingNormal, alpha, dimension);
28 color.a = remap_alpha(alpha) / 255.0;
29 fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
30}
diff --git a/assets/minecraft/shaders/core/rendertype_translucent.vsh b/assets/minecraft/shaders/core/rendertype_translucent.vsh
new file mode 100755
index 00000000..66307ce4
--- /dev/null
+++ b/assets/minecraft/shaders/core/rendertype_translucent.vsh
@@ -0,0 +1,41 @@
1#version 150
2
3#moj_import <light.glsl>
4#moj_import <fog.glsl>
5#moj_import <emissive_utils.glsl>
6
7in vec3 Position;
8in vec4 Color;
9in vec2 UV0;
10in ivec2 UV2;
11in vec3 Normal;
12
13uniform sampler2D Sampler2;
14
15uniform mat4 ModelViewMat;
16uniform mat4 ProjMat;
17uniform int FogShape;
18uniform vec3 ChunkOffset;
19
20out float vertexDistance;
21out float dimension;
22out vec4 vertexColor;
23out vec4 lightColor;
24out vec4 maxLightColor;
25out vec2 texCoord0;
26out vec3 faceLightingNormal;
27out vec4 normal;
28
29void main() {
30 vec3 pos = Position + ChunkOffset;
31 gl_Position = ProjMat * ModelViewMat * vec4(pos, 1.0);
32
33 vertexDistance = fog_distance(ModelViewMat, pos, FogShape);
34 dimension = get_dimension(minecraft_sample_lightmap(Sampler2, ivec2(0.0, 0.0)));
35 vertexColor = Color;
36 lightColor = minecraft_sample_lightmap(Sampler2, UV2);
37 maxLightColor = minecraft_sample_lightmap(Sampler2, ivec2(240.0, 240.0));
38 texCoord0 = UV0;
39 faceLightingNormal = Normal;
40 normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
41}
diff --git a/assets/minecraft/shaders/include/emissive_utils.glsl b/assets/minecraft/shaders/include/emissive_utils.glsl
new file mode 100755
index 00000000..d0c999cb
--- /dev/null
+++ b/assets/minecraft/shaders/include/emissive_utils.glsl
@@ -0,0 +1,102 @@
1#version 150
2
3// Checking for the exact alpha value breaks things, so I use this function to cut down on space while also making it work better.
4
5bool check_alpha(float textureAlpha, float targetAlpha) {
6
7 float targetLess = targetAlpha - 0.01;
8 float targetMore = targetAlpha + 0.01;
9 return (textureAlpha > targetLess && textureAlpha < targetMore);
10
11}
12
13
14// For cases in which you want something to have a lower light level, but still be bright when in light.
15
16vec4 apply_partial_emissivity(vec4 inputColor, vec4 originalLightColor, vec3 minimumLightColor) {
17
18 vec4 newLightColor = originalLightColor;
19 newLightColor.r = max(originalLightColor.r, minimumLightColor.r);
20 newLightColor.g = max(originalLightColor.g, minimumLightColor.g);
21 newLightColor.b = max(originalLightColor.b, minimumLightColor.b);
22 return inputColor * newLightColor;
23
24}
25
26
27// The meat and bones of the pack, does all the work for making things emissive.
28
29vec4 make_emissive(vec4 inputColor, vec4 lightColor, vec4 maxLightColor, float vertexDistance, float inputAlpha) {
30
31 if (vertexDistance > 800) return inputColor; // Vertex Distance > 800 generally means an object is in the UI, which we don't want to affect.
32
33 if (check_alpha(inputAlpha, 252.0)) return inputColor; // Checks for alpha 252 and just returns the input color if it is. Used in the example pack for redstone ore and the zombie's eyes.
34 else if (check_alpha(inputAlpha, 251.0)) return apply_partial_emissivity(inputColor, lightColor, vec3(0.411, 0.345, 0.388)); // Used in the example pack for ice.
35 else if (check_alpha(inputAlpha, 250.0)) return inputColor; // You can copy & this line and change the function to add a new emissive type. Used in the example pack for lime concrete.
36
37 else return inputColor * lightColor; // If none of the pixels are supposed to be emissive, then it adds the light.
38
39}
40
41
42// Gets the dimension that an object is in, -1 for The Nether, 0 for The Overworld, 1 for The End.
43
44float get_dimension(vec4 minLightColor) {
45
46 if (minLightColor.r == minLightColor.g && minLightColor.g == minLightColor.b) return 0.0; // Shadows are grayscale in The Overworld
47 else if (minLightColor.r > minLightColor.g) return -1.0; // Shadows are more red in The Nether
48 else return 1.0; // Shadows are slightly green in The End
49
50}
51
52
53// Gets the face lighting of a block. Credits to Venaxsys for the original function.
54
55vec4 get_face_lighting(vec3 normal, float dimension) {
56
57 vec4 faceLighting = vec4(1.0, 1.0, 1.0, 1.0);
58 vec3 absNormal = abs(normal);
59 float top = 229.0 / 255.0;
60 float bottom = 127.0 / 255.0;
61 float east = 153.0 / 255.0;
62 float north = 204.0 / 255.0;
63
64 // Top (only required in the Nether)
65 if (normal.y > normal.z && normal.y > normal.x && check_alpha(dimension, -1.0)) faceLighting = vec4(top, top, top, 1.0); // It's not really checking the alpha but I'm too stubborn to change the function name
66
67 // Bottom
68 if (normal.y < normal.z && normal.y < normal.x && !check_alpha(dimension, -1.0)) faceLighting = vec4(bottom, bottom, bottom, 1.0);
69 else if (normal.y < normal.z && normal.y < normal.x && check_alpha(dimension, -1.0)) faceLighting = vec4(top, top, top, 1.0);
70
71 // East-West
72 if (absNormal.x > absNormal.z && absNormal.x > absNormal.y) faceLighting = vec4(east, east, east, 1.0);
73
74 // North-South
75 if (absNormal.z > absNormal.x && absNormal.z > absNormal.y) faceLighting = vec4(north, north, north, 1.0);
76
77 return faceLighting;
78}
79
80
81// Checks the alpha and removes face lighting if required.
82
83vec4 face_lighting_check(vec3 normal, float inputAlpha, float dimension) {
84
85 if (check_alpha(inputAlpha, 250.0)) return get_face_lighting(normal, dimension); // Checks for alpha 250, and runs it through the remove_face_lighting() function if it is. Used in the example pack for lime concrete.
86 else return vec4(1.0, 1.0, 1.0, 1.0); // If the block doesn't need to have its face lighting removed, returns 1.0 so nothing gets divided.
87
88}
89
90
91// Makes sure transparent things don't become solid and vice versa.
92
93float remap_alpha(float inputAlpha) {
94
95 if (check_alpha(inputAlpha, 252.0)) return 255.0; // Checks for alpha 252 and converts all pixels of that to alpha 255. Used in the example pack for redstone ore and the zombie's eyes.
96 else if (check_alpha(inputAlpha, 251.0)) return 190.0; // You can copy & paste this line and change the values to make any transparent block work with this pack. Used in the example pack for ice.
97 else if (check_alpha(inputAlpha, 250.0)) return 255.0; // Used in the example pack for lime concrete.
98
99 else return inputAlpha; // If a pixel doesn't need to have its alpha changed then it simply does not change.
100
101}
102
diff --git a/assets/minecraft/shaders/include/player.glsl b/assets/minecraft/shaders/include/player.glsl
new file mode 100755
index 00000000..a421a1ff
--- /dev/null
+++ b/assets/minecraft/shaders/include/player.glsl
@@ -0,0 +1,49 @@
1if (player == 2 && color.rgb == vec3(0.0)) {
2 color.a = 0.0;
3}
4
5float emissive = 0.0;
6float damage = 0.25;
7
8for (int i = 0; i < 4; i++) {
9 for (int j = 0; j < 4; j++) {
10 vec4 control = texelFetch(Sampler0, ivec2(36 + i, 16 + j), 0);
11 if (control.rgb == color.rgb) {
12 emissive = 1.0;
13 }
14 }
15}
16
17if (settings2.r > 0.99) {
18 damage = 0.0;
19}
20
21if (overlayColor.a < 0.99) {
22 if (texelFetch(Sampler0, ivec2(2, 16), 0).r > 0.99) {
23 for (int i = 0; i < 4; i++) {
24 for (int j = 0; j < 4; j++) {
25 vec4 control = texelFetch(Sampler0, ivec2(12 + i, 16 + j), 0);
26 if (control.rgb == color.rgb) {
27 damage = 0.25;
28 }
29 }
30 }
31 for (int i = 0; i < 4; i++) {
32 for (int j = 0; j < 4; j++) {
33 vec4 control = texelFetch(Sampler0, ivec2(16 + i, 16 + j), 0);
34 if (control.rgb == color.rgb) {
35 damage = 1.0;
36 }
37 }
38 }
39 }
40 color.rgb = mix(color.rgb, overlayColor.rgb, damage);
41}
42
43color *= ColorModulator;
44
45if (settings.g != 1.0 || emissive != 1.0) {
46 color *= lightMapColor * vertexColor;
47}
48
49fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);