diff options
Diffstat (limited to 'assets/minecraft/shaders/core')
31 files changed, 1264 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 | |||
| 6 | uniform sampler2D Sampler0; | ||
| 7 | |||
| 8 | uniform vec4 ColorModulator; | ||
| 9 | uniform float FogStart; | ||
| 10 | uniform float FogEnd; | ||
| 11 | uniform vec4 FogColor; | ||
| 12 | |||
| 13 | in float vertexDistance; | ||
| 14 | in vec2 texCoord0; | ||
| 15 | in vec4 vertexColor; | ||
| 16 | in vec4 lightColor; | ||
| 17 | in vec4 maxLightColor; | ||
| 18 | |||
| 19 | out vec4 fragColor; | ||
| 20 | |||
| 21 | void 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 | |||
| 6 | in vec3 Position; | ||
| 7 | in vec2 UV0; | ||
| 8 | in vec4 Color; | ||
| 9 | in ivec2 UV2; | ||
| 10 | |||
| 11 | uniform sampler2D Sampler2; | ||
| 12 | |||
| 13 | uniform mat4 ModelViewMat; | ||
| 14 | uniform mat4 ProjMat; | ||
| 15 | uniform int FogShape; | ||
| 16 | uniform mat3 IViewRotMat; | ||
| 17 | |||
| 18 | out float vertexDistance; | ||
| 19 | out vec2 texCoord0; | ||
| 20 | out vec4 vertexColor; | ||
| 21 | out vec4 lightColor; | ||
| 22 | out vec4 maxLightColor; | ||
| 23 | |||
| 24 | void 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 | |||
| 6 | uniform sampler2D Sampler0; | ||
| 7 | |||
| 8 | uniform vec4 ColorModulator; | ||
| 9 | uniform float FogStart; | ||
| 10 | uniform float FogEnd; | ||
| 11 | uniform vec4 FogColor; | ||
| 12 | |||
| 13 | in float vertexDistance; | ||
| 14 | in vec2 texCoord0; | ||
| 15 | in vec4 vertexColor; | ||
| 16 | in vec4 lightColor; | ||
| 17 | in vec4 maxLightColor; | ||
| 18 | out vec4 fragColor; | ||
| 19 | |||
| 20 | void 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 | |||
| 6 | in vec3 Position; | ||
| 7 | in vec4 Color; | ||
| 8 | in vec2 UV0; | ||
| 9 | in vec2 UV1; | ||
| 10 | in ivec2 UV2; | ||
| 11 | in vec3 Normal; | ||
| 12 | |||
| 13 | uniform sampler2D Sampler2; | ||
| 14 | |||
| 15 | uniform mat4 ModelViewMat; | ||
| 16 | uniform mat4 ProjMat; | ||
| 17 | uniform int FogShape; | ||
| 18 | uniform mat3 IViewRotMat; | ||
| 19 | |||
| 20 | uniform vec3 Light0_Direction; | ||
| 21 | uniform vec3 Light1_Direction; | ||
| 22 | |||
| 23 | out float vertexDistance; | ||
| 24 | out vec4 vertexColor; | ||
| 25 | out vec4 lightColor; | ||
| 26 | out vec4 maxLightColor; | ||
| 27 | out vec2 texCoord0; | ||
| 28 | out vec2 texCoord1; | ||
| 29 | out vec4 normal; | ||
| 30 | |||
| 31 | void 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 | |||
| 6 | uniform sampler2D Sampler0; | ||
| 7 | |||
| 8 | uniform vec4 ColorModulator; | ||
| 9 | uniform float FogStart; | ||
| 10 | uniform float FogEnd; | ||
| 11 | uniform vec4 FogColor; | ||
| 12 | |||
| 13 | in float vertexDistance; | ||
| 14 | in float dimension; | ||
| 15 | in vec4 vertexColor; | ||
| 16 | in vec4 lightColor; | ||
| 17 | in vec4 maxLightColor; | ||
| 18 | in vec2 texCoord0; | ||
| 19 | in vec3 faceLightingNormal; | ||
| 20 | in vec4 normal; | ||
| 21 | |||
| 22 | out vec4 fragColor; | ||
| 23 | |||
| 24 | void 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 | |||
| 7 | in vec3 Position; | ||
| 8 | in vec4 Color; | ||
| 9 | in vec2 UV0; | ||
| 10 | in ivec2 UV2; | ||
| 11 | in vec3 Normal; | ||
| 12 | |||
| 13 | uniform sampler2D Sampler2; | ||
| 14 | |||
| 15 | uniform mat4 ModelViewMat; | ||
| 16 | uniform mat4 ProjMat; | ||
| 17 | uniform int FogShape; | ||
| 18 | uniform vec3 ChunkOffset; | ||
| 19 | |||
| 20 | out float vertexDistance; | ||
| 21 | out float dimension; | ||
| 22 | out vec4 vertexColor; | ||
| 23 | out vec4 lightColor; | ||
| 24 | out vec4 maxLightColor; | ||
| 25 | out vec2 texCoord0; | ||
| 26 | out vec3 faceLightingNormal; | ||
| 27 | out vec4 normal; | ||
| 28 | |||
| 29 | void 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 | |||
| 6 | uniform sampler2D Sampler0; | ||
| 7 | |||
| 8 | uniform vec4 ColorModulator; | ||
| 9 | uniform float FogStart; | ||
| 10 | uniform float FogEnd; | ||
| 11 | uniform vec4 FogColor; | ||
| 12 | |||
| 13 | in float vertexDistance; | ||
| 14 | in float dimension; | ||
| 15 | in vec4 vertexColor; | ||
| 16 | in vec4 lightColor; | ||
| 17 | in vec4 maxLightColor; | ||
| 18 | in vec2 texCoord0; | ||
| 19 | in vec3 faceLightingNormal; | ||
| 20 | in vec4 normal; | ||
| 21 | |||
| 22 | out vec4 fragColor; | ||
| 23 | |||
| 24 | void 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 | |||
| 7 | in vec3 Position; | ||
| 8 | in vec4 Color; | ||
| 9 | in vec2 UV0; | ||
| 10 | in ivec2 UV2; | ||
| 11 | in vec3 Normal; | ||
| 12 | |||
| 13 | uniform sampler2D Sampler2; | ||
| 14 | |||
| 15 | uniform mat4 ModelViewMat; | ||
| 16 | uniform mat4 ProjMat; | ||
| 17 | uniform int FogShape; | ||
| 18 | uniform vec3 ChunkOffset; | ||
| 19 | |||
| 20 | out float vertexDistance; | ||
| 21 | out float dimension; | ||
| 22 | out vec4 vertexColor; | ||
| 23 | out vec4 lightColor; | ||
| 24 | out vec4 maxLightColor; | ||
| 25 | out vec2 texCoord0; | ||
| 26 | out vec3 faceLightingNormal; | ||
| 27 | out vec4 normal; | ||
| 28 | |||
| 29 | void 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 | |||
| 6 | uniform sampler2D Sampler0; | ||
| 7 | |||
| 8 | uniform vec4 ColorModulator; | ||
| 9 | uniform float FogStart; | ||
| 10 | uniform float FogEnd; | ||
| 11 | uniform vec4 FogColor; | ||
| 12 | |||
| 13 | in float vertexDistance; | ||
| 14 | in vec4 vertexColor; | ||
| 15 | in vec4 lightColor; | ||
| 16 | in vec4 maxLightColor; | ||
| 17 | in vec4 overlayColor; | ||
| 18 | in vec2 texCoord0; | ||
| 19 | in vec4 normal; | ||
| 20 | |||
| 21 | out vec4 fragColor; | ||
| 22 | |||
| 23 | void 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 | |||
| 6 | in vec3 Position; | ||
| 7 | in vec4 Color; | ||
| 8 | in vec2 UV0; | ||
| 9 | in ivec2 UV1; | ||
| 10 | in ivec2 UV2; | ||
| 11 | in vec3 Normal; | ||
| 12 | |||
| 13 | uniform sampler2D Sampler1; | ||
| 14 | uniform sampler2D Sampler2; | ||
| 15 | |||
| 16 | uniform mat4 ModelViewMat; | ||
| 17 | uniform mat4 ProjMat; | ||
| 18 | uniform int FogShape; | ||
| 19 | uniform mat3 IViewRotMat; | ||
| 20 | |||
| 21 | uniform vec3 Light0_Direction; | ||
| 22 | uniform vec3 Light1_Direction; | ||
| 23 | |||
| 24 | out float vertexDistance; | ||
| 25 | out vec4 vertexColor; | ||
| 26 | out vec4 lightColor; | ||
| 27 | out vec4 maxLightColor; | ||
| 28 | out vec4 overlayColor; | ||
| 29 | out vec2 texCoord0; | ||
| 30 | out vec4 normal; | ||
| 31 | |||
| 32 | void 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 | |||
| 6 | uniform sampler2D Sampler0; | ||
| 7 | |||
| 8 | uniform vec4 ColorModulator; | ||
| 9 | uniform float FogStart; | ||
| 10 | uniform float FogEnd; | ||
| 11 | uniform vec4 FogColor; | ||
| 12 | |||
| 13 | in float vertexDistance; | ||
| 14 | in vec4 vertexColor; | ||
| 15 | in vec4 lightColor; | ||
| 16 | in vec4 maxLightColor; | ||
| 17 | in vec4 overlayColor; | ||
| 18 | in vec2 texCoord0; | ||
| 19 | in vec4 normal; | ||
| 20 | |||
| 21 | out vec4 fragColor; | ||
| 22 | |||
| 23 | void 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 | |||
| 6 | in vec3 Position; | ||
| 7 | in vec4 Color; | ||
| 8 | in vec2 UV0; | ||
| 9 | in ivec2 UV1; | ||
| 10 | in ivec2 UV2; | ||
| 11 | in vec3 Normal; | ||
| 12 | |||
| 13 | uniform sampler2D Sampler1; | ||
| 14 | uniform sampler2D Sampler2; | ||
| 15 | |||
| 16 | uniform mat4 ModelViewMat; | ||
| 17 | uniform mat4 ProjMat; | ||
| 18 | uniform int FogShape; | ||
| 19 | uniform mat3 IViewRotMat; | ||
| 20 | |||
| 21 | uniform vec3 Light0_Direction; | ||
| 22 | uniform vec3 Light1_Direction; | ||
| 23 | |||
| 24 | out float vertexDistance; | ||
| 25 | out vec4 vertexColor; | ||
| 26 | out vec4 lightColor; | ||
| 27 | out vec4 maxLightColor; | ||
| 28 | out vec4 overlayColor; | ||
| 29 | out vec2 texCoord0; | ||
| 30 | out vec4 normal; | ||
| 31 | |||
| 32 | void 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 | |||
| 6 | uniform sampler2D Sampler0; | ||
| 7 | |||
| 8 | uniform vec4 ColorModulator; | ||
| 9 | uniform float FogStart; | ||
| 10 | uniform float FogEnd; | ||
| 11 | uniform vec4 FogColor; | ||
| 12 | |||
| 13 | in float vertexDistance; | ||
| 14 | in vec4 vertexColor; | ||
| 15 | in vec4 lightColor; | ||
| 16 | in vec4 maxLightColor; | ||
| 17 | in vec4 overlayColor; | ||
| 18 | in vec2 texCoord0; | ||
| 19 | in vec4 normal; | ||
| 20 | |||
| 21 | out vec4 fragColor; | ||
| 22 | |||
| 23 | void 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 | |||
| 6 | in vec3 Position; | ||
| 7 | in vec4 Color; | ||
| 8 | in vec2 UV0; | ||
| 9 | in ivec2 UV1; | ||
| 10 | in ivec2 UV2; | ||
| 11 | in vec3 Normal; | ||
| 12 | |||
| 13 | uniform sampler2D Sampler1; | ||
| 14 | uniform sampler2D Sampler2; | ||
| 15 | |||
| 16 | uniform mat4 ModelViewMat; | ||
| 17 | uniform mat4 ProjMat; | ||
| 18 | uniform int FogShape; | ||
| 19 | uniform mat3 IViewRotMat; | ||
| 20 | |||
| 21 | uniform vec3 Light0_Direction; | ||
| 22 | uniform vec3 Light1_Direction; | ||
| 23 | |||
| 24 | out float vertexDistance; | ||
| 25 | out vec4 vertexColor; | ||
| 26 | out vec4 lightColor; | ||
| 27 | out vec4 maxLightColor; | ||
| 28 | out vec4 overlayColor; | ||
| 29 | out vec2 texCoord0; | ||
| 30 | out vec4 normal; | ||
| 31 | |||
| 32 | void 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 | |||
| 6 | uniform sampler2D Sampler0; | ||
| 7 | |||
| 8 | uniform vec4 ColorModulator; | ||
| 9 | uniform float FogStart; | ||
| 10 | uniform float FogEnd; | ||
| 11 | uniform vec4 FogColor; | ||
| 12 | |||
| 13 | in float vertexDistance; | ||
| 14 | in vec4 vertexColor; | ||
| 15 | in vec4 lightColor; | ||
| 16 | in vec4 maxLightColor; | ||
| 17 | in vec2 texCoord0; | ||
| 18 | in vec4 normal; | ||
| 19 | |||
| 20 | out vec4 fragColor; | ||
| 21 | |||
| 22 | void 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 | |||
| 6 | in vec3 Position; | ||
| 7 | in vec4 Color; | ||
| 8 | in vec2 UV0; | ||
| 9 | in ivec2 UV2; | ||
| 10 | in vec3 Normal; | ||
| 11 | |||
| 12 | uniform sampler2D Sampler2; | ||
| 13 | |||
| 14 | uniform mat4 ModelViewMat; | ||
| 15 | uniform mat4 ProjMat; | ||
| 16 | uniform int FogShape; | ||
| 17 | uniform mat3 IViewRotMat; | ||
| 18 | |||
| 19 | uniform vec3 Light0_Direction; | ||
| 20 | uniform vec3 Light1_Direction; | ||
| 21 | |||
| 22 | out float vertexDistance; | ||
| 23 | out vec4 vertexColor; | ||
| 24 | out vec4 lightColor; | ||
| 25 | out vec4 maxLightColor; | ||
| 26 | out vec2 texCoord0; | ||
| 27 | out vec4 normal; | ||
| 28 | |||
| 29 | void 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 | |||
| 5 | uniform sampler2D Sampler0; | ||
| 6 | |||
| 7 | uniform vec4 ColorModulator; | ||
| 8 | uniform float FogStart; | ||
| 9 | uniform float FogEnd; | ||
| 10 | uniform vec4 FogColor; | ||
| 11 | |||
| 12 | in float vertexDistance; | ||
| 13 | in vec4 vertexColor; | ||
| 14 | in vec4 lightMapColor; | ||
| 15 | in vec4 overlayColor; | ||
| 16 | in vec2 texCoord0; | ||
| 17 | in vec4 normal; | ||
| 18 | flat in int player; | ||
| 19 | in vec3 settings; | ||
| 20 | in vec3 settings2; | ||
| 21 | |||
| 22 | out vec4 fragColor; | ||
| 23 | |||
| 24 | void 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 | |||
| 6 | in vec3 Position; | ||
| 7 | in vec4 Color; | ||
| 8 | in vec2 UV0; | ||
| 9 | in ivec2 UV1; | ||
| 10 | in ivec2 UV2; | ||
| 11 | in vec3 Normal; | ||
| 12 | |||
| 13 | uniform sampler2D Sampler1; | ||
| 14 | uniform sampler2D Sampler2; | ||
| 15 | |||
| 16 | uniform mat4 ModelViewMat; | ||
| 17 | uniform mat4 ProjMat; | ||
| 18 | uniform int FogShape; | ||
| 19 | uniform mat3 IViewRotMat; | ||
| 20 | |||
| 21 | uniform vec3 Light0_Direction; | ||
| 22 | uniform vec3 Light1_Direction; | ||
| 23 | |||
| 24 | out float vertexDistance; | ||
| 25 | out vec4 vertexColor; | ||
| 26 | out vec4 lightColor; | ||
| 27 | out vec4 maxLightColor; | ||
| 28 | out vec4 overlayColor; | ||
| 29 | out vec2 texCoord0; | ||
| 30 | out vec4 normal; | ||
| 31 | |||
| 32 | void 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 | |||
| 5 | uniform sampler2D Sampler0; | ||
| 6 | |||
| 7 | uniform vec4 ColorModulator; | ||
| 8 | uniform float FogStart; | ||
| 9 | uniform float FogEnd; | ||
| 10 | uniform vec4 FogColor; | ||
| 11 | |||
| 12 | in float vertexDistance; | ||
| 13 | in vec4 vertexColor; | ||
| 14 | in vec4 lightMapColor; | ||
| 15 | in vec4 overlayColor; | ||
| 16 | in vec2 texCoord0; | ||
| 17 | in vec4 normal; | ||
| 18 | flat in int player; | ||
| 19 | in vec3 settings; | ||
| 20 | in vec3 settings2; | ||
| 21 | |||
| 22 | out vec4 fragColor; | ||
| 23 | |||
| 24 | void 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 | |||
| 6 | in vec3 Position; | ||
| 7 | in vec4 Color; | ||
| 8 | in vec2 UV0; | ||
| 9 | in ivec2 UV1; | ||
| 10 | in ivec2 UV2; | ||
| 11 | in vec3 Normal; | ||
| 12 | |||
| 13 | uniform sampler2D Sampler1; | ||
| 14 | uniform sampler2D Sampler2; | ||
| 15 | |||
| 16 | uniform mat4 ModelViewMat; | ||
| 17 | uniform mat4 ProjMat; | ||
| 18 | uniform int FogShape; | ||
| 19 | uniform mat3 IViewRotMat; | ||
| 20 | |||
| 21 | uniform vec3 Light0_Direction; | ||
| 22 | uniform vec3 Light1_Direction; | ||
| 23 | |||
| 24 | out float vertexDistance; | ||
| 25 | out vec4 vertexColor; | ||
| 26 | out vec4 lightColor; | ||
| 27 | out vec4 maxLightColor; | ||
| 28 | out vec4 overlayColor; | ||
| 29 | out vec2 texCoord0; | ||
| 30 | out vec4 normal; | ||
| 31 | |||
| 32 | void 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 | |||
| 6 | uniform sampler2D Sampler0; | ||
| 7 | |||
| 8 | uniform vec4 ColorModulator; | ||
| 9 | uniform float FogStart; | ||
| 10 | uniform float FogEnd; | ||
| 11 | uniform vec4 FogColor; | ||
| 12 | |||
| 13 | in float vertexDistance; | ||
| 14 | in vec4 vertexColor; | ||
| 15 | in vec4 lightColor; | ||
| 16 | in vec4 maxLightColor; | ||
| 17 | in vec2 texCoord0; | ||
| 18 | in vec2 texCoord1; | ||
| 19 | in vec4 normal; | ||
| 20 | |||
| 21 | out vec4 fragColor; | ||
| 22 | |||
| 23 | void 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 | |||
| 6 | in vec3 Position; | ||
| 7 | in vec4 Color; | ||
| 8 | in vec2 UV0; | ||
| 9 | in vec2 UV1; | ||
| 10 | in ivec2 UV2; | ||
| 11 | in vec3 Normal; | ||
| 12 | |||
| 13 | uniform sampler2D Sampler2; | ||
| 14 | |||
| 15 | uniform mat4 ModelViewMat; | ||
| 16 | uniform mat4 ProjMat; | ||
| 17 | uniform int FogShape; | ||
| 18 | uniform mat3 IViewRotMat; | ||
| 19 | |||
| 20 | uniform vec3 Light0_Direction; | ||
| 21 | uniform vec3 Light1_Direction; | ||
| 22 | |||
| 23 | out float vertexDistance; | ||
| 24 | out vec4 vertexColor; | ||
| 25 | out vec4 lightColor; | ||
| 26 | out vec4 maxLightColor; | ||
| 27 | out vec2 texCoord0; | ||
| 28 | out vec2 texCoord1; | ||
| 29 | out vec2 texCoord2; | ||
| 30 | out vec4 normal; | ||
| 31 | |||
| 32 | void 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 | |||
| 6 | in vec3 Position; | ||
| 7 | in vec4 Color; | ||
| 8 | in vec2 UV0; | ||
| 9 | in ivec2 UV1; | ||
| 10 | in ivec2 UV2; | ||
| 11 | in vec3 Normal; | ||
| 12 | |||
| 13 | uniform sampler2D Sampler0; | ||
| 14 | uniform sampler2D Sampler1; | ||
| 15 | uniform sampler2D Sampler2; | ||
| 16 | |||
| 17 | uniform mat4 ModelViewMat; | ||
| 18 | uniform mat4 ProjMat; | ||
| 19 | uniform mat3 IViewRotMat; | ||
| 20 | uniform int FogShape; | ||
| 21 | uniform float GameTime; | ||
| 22 | |||
| 23 | uniform vec3 Light0_Direction; | ||
| 24 | uniform vec3 Light1_Direction; | ||
| 25 | |||
| 26 | out float vertexDistance; | ||
| 27 | out vec4 vertexColor; | ||
| 28 | out vec4 lightMapColor; | ||
| 29 | out vec4 overlayColor; | ||
| 30 | out vec2 texCoord0; | ||
| 31 | out vec4 normal; | ||
| 32 | flat out int player; | ||
| 33 | out vec3 settings; | ||
| 34 | out vec3 settings2; | ||
| 35 | |||
| 36 | float hash(float p) { | ||
| 37 | p = fract(p * 0.011); | ||
| 38 | p *= p + 7.5; | ||
| 39 | p *= p + p; | ||
| 40 | return fract(p); | ||
| 41 | } | ||
| 42 | |||
| 43 | float 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 | |||
| 50 | float 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 | |||
| 62 | void 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 | |||
| 6 | uniform sampler2D Sampler0; | ||
| 7 | |||
| 8 | uniform vec4 ColorModulator; | ||
| 9 | uniform float FogStart; | ||
| 10 | uniform float FogEnd; | ||
| 11 | uniform vec4 FogColor; | ||
| 12 | |||
| 13 | in float vertexDistance; | ||
| 14 | in vec4 vertexColor; | ||
| 15 | in vec4 lightColor; | ||
| 16 | in vec4 maxLightColor; | ||
| 17 | in vec2 texCoord0; | ||
| 18 | in vec2 texCoord1; | ||
| 19 | in vec4 normal; | ||
| 20 | |||
| 21 | out vec4 fragColor; | ||
| 22 | |||
| 23 | void 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 | |||
| 6 | in vec3 Position; | ||
| 7 | in vec4 Color; | ||
| 8 | in vec2 UV0; | ||
| 9 | in vec2 UV1; | ||
| 10 | in ivec2 UV2; | ||
| 11 | in vec3 Normal; | ||
| 12 | |||
| 13 | uniform sampler2D Sampler2; | ||
| 14 | |||
| 15 | uniform mat4 ModelViewMat; | ||
| 16 | uniform mat4 ProjMat; | ||
| 17 | uniform int FogShape; | ||
| 18 | uniform mat3 IViewRotMat; | ||
| 19 | |||
| 20 | uniform vec3 Light0_Direction; | ||
| 21 | uniform vec3 Light1_Direction; | ||
| 22 | |||
| 23 | out float vertexDistance; | ||
| 24 | out vec4 vertexColor; | ||
| 25 | out vec4 lightColor; | ||
| 26 | out vec4 maxLightColor; | ||
| 27 | out vec2 texCoord0; | ||
| 28 | out vec2 texCoord1; | ||
| 29 | out vec2 texCoord2; | ||
| 30 | out vec4 normal; | ||
| 31 | |||
| 32 | void 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 | |||
| 6 | uniform sampler2D Sampler0; | ||
| 7 | |||
| 8 | uniform vec4 ColorModulator; | ||
| 9 | uniform float FogStart; | ||
| 10 | uniform float FogEnd; | ||
| 11 | uniform vec4 FogColor; | ||
| 12 | |||
| 13 | in float vertexDistance; | ||
| 14 | in float dimension; | ||
| 15 | in vec4 vertexColor; | ||
| 16 | in vec4 lightColor; | ||
| 17 | in vec4 maxLightColor; | ||
| 18 | in vec2 texCoord0; | ||
| 19 | in vec3 faceLightingNormal; | ||
| 20 | in vec4 normal; | ||
| 21 | |||
| 22 | out vec4 fragColor; | ||
| 23 | |||
| 24 | void 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 | |||
| 7 | in vec3 Position; | ||
| 8 | in vec4 Color; | ||
| 9 | in vec2 UV0; | ||
| 10 | in ivec2 UV2; | ||
| 11 | in vec3 Normal; | ||
| 12 | |||
| 13 | uniform sampler2D Sampler2; | ||
| 14 | |||
| 15 | uniform mat4 ModelViewMat; | ||
| 16 | uniform mat4 ProjMat; | ||
| 17 | uniform int FogShape; | ||
| 18 | uniform vec3 ChunkOffset; | ||
| 19 | |||
| 20 | out float vertexDistance; | ||
| 21 | out float dimension; | ||
| 22 | out vec4 vertexColor; | ||
| 23 | out vec4 lightColor; | ||
| 24 | out vec4 maxLightColor; | ||
| 25 | out vec2 texCoord0; | ||
| 26 | out vec3 faceLightingNormal; | ||
| 27 | out vec4 normal; | ||
| 28 | |||
| 29 | void 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 | |||
| 6 | uniform sampler2D Sampler0; | ||
| 7 | |||
| 8 | uniform vec4 ColorModulator; | ||
| 9 | uniform float FogStart; | ||
| 10 | uniform float FogEnd; | ||
| 11 | uniform vec4 FogColor; | ||
| 12 | |||
| 13 | in float vertexDistance; | ||
| 14 | in float dimension; | ||
| 15 | in vec4 vertexColor; | ||
| 16 | in vec4 lightColor; | ||
| 17 | in vec4 maxLightColor; | ||
| 18 | in vec2 texCoord0; | ||
| 19 | in vec3 faceLightingNormal; | ||
| 20 | in vec4 normal; | ||
| 21 | |||
| 22 | out vec4 fragColor; | ||
| 23 | |||
| 24 | void 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 | |||
| 7 | in vec3 Position; | ||
| 8 | in vec4 Color; | ||
| 9 | in vec2 UV0; | ||
| 10 | in ivec2 UV2; | ||
| 11 | in vec3 Normal; | ||
| 12 | |||
| 13 | uniform sampler2D Sampler2; | ||
| 14 | |||
| 15 | uniform mat4 ModelViewMat; | ||
| 16 | uniform mat4 ProjMat; | ||
| 17 | uniform int FogShape; | ||
| 18 | uniform vec3 ChunkOffset; | ||
| 19 | |||
| 20 | out float vertexDistance; | ||
| 21 | out float dimension; | ||
| 22 | out vec4 vertexColor; | ||
| 23 | out vec4 lightColor; | ||
| 24 | out vec4 maxLightColor; | ||
| 25 | out vec2 texCoord0; | ||
| 26 | out vec3 faceLightingNormal; | ||
| 27 | out vec4 normal; | ||
| 28 | |||
| 29 | void 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 | } | ||