revert to vanilla assets
This commit is contained in:
35
public/assets/minecraft/shaders/post/bits.fsh
Normal file
35
public/assets/minecraft/shaders/post/bits.fsh
Normal file
@@ -0,0 +1,35 @@
|
||||
#version 330
|
||||
|
||||
uniform sampler2D InSampler;
|
||||
|
||||
in vec2 texCoord;
|
||||
|
||||
layout(std140) uniform SamplerInfo {
|
||||
vec2 OutSize;
|
||||
vec2 InSize;
|
||||
};
|
||||
|
||||
layout(std140) uniform BitsConfig {
|
||||
float Resolution;
|
||||
float MosaicSize;
|
||||
};
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
const float Saturation = 1.5;
|
||||
|
||||
void main() {
|
||||
vec2 oneTexel = 1.0 / InSize;
|
||||
vec2 mosaicInSize = InSize / MosaicSize;
|
||||
vec2 fractPix = fract(texCoord * mosaicInSize) / mosaicInSize;
|
||||
|
||||
vec4 baseTexel = texture(InSampler, texCoord - fractPix);
|
||||
|
||||
vec3 fractTexel = baseTexel.rgb - fract(baseTexel.rgb * Resolution) / Resolution;
|
||||
float luma = dot(fractTexel, vec3(0.3, 0.59, 0.11));
|
||||
vec3 chroma = (fractTexel - luma) * Saturation;
|
||||
baseTexel.rgb = luma + chroma;
|
||||
baseTexel.a = 1.0;
|
||||
|
||||
fragColor = baseTexel;
|
||||
}
|
||||
15
public/assets/minecraft/shaders/post/blit.fsh
Normal file
15
public/assets/minecraft/shaders/post/blit.fsh
Normal file
@@ -0,0 +1,15 @@
|
||||
#version 330
|
||||
|
||||
uniform sampler2D InSampler;
|
||||
|
||||
layout(std140) uniform BlitConfig {
|
||||
vec4 ColorModulate;
|
||||
};
|
||||
|
||||
in vec2 texCoord;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main(){
|
||||
fragColor = texture(InSampler, texCoord) * ColorModulate;
|
||||
}
|
||||
35
public/assets/minecraft/shaders/post/box_blur.fsh
Normal file
35
public/assets/minecraft/shaders/post/box_blur.fsh
Normal file
@@ -0,0 +1,35 @@
|
||||
#version 330
|
||||
|
||||
#moj_import <minecraft:globals.glsl>
|
||||
|
||||
uniform sampler2D InSampler;
|
||||
|
||||
layout(std140) uniform SamplerInfo {
|
||||
vec2 OutSize;
|
||||
vec2 InSize;
|
||||
};
|
||||
|
||||
layout(std140) uniform BlurConfig {
|
||||
vec2 BlurDir;
|
||||
float Radius;
|
||||
};
|
||||
|
||||
in vec2 texCoord;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
// This shader relies on GL_LINEAR sampling to reduce the amount of texture samples in half.
|
||||
// Instead of sampling each pixel position with a step of 1 we sample between pixels with a step of 2.
|
||||
// In the end we sample the last pixel with a half weight, since the amount of pixels to sample is always odd (actualRadius * 2 + 1).
|
||||
void main() {
|
||||
vec2 oneTexel = 1.0 / InSize;
|
||||
vec2 sampleStep = oneTexel * BlurDir;
|
||||
|
||||
vec4 blurred = vec4(0.0);
|
||||
float actualRadius = Radius >= 0.5 ? round(Radius) : float(MenuBlurRadius);
|
||||
for (float a = -actualRadius + 0.5; a <= actualRadius; a += 2.0) {
|
||||
blurred += texture(InSampler, texCoord + sampleStep * a);
|
||||
}
|
||||
blurred += texture(InSampler, texCoord + sampleStep * actualRadius) / 2.0;
|
||||
fragColor = blurred / (actualRadius + 0.5);
|
||||
}
|
||||
39
public/assets/minecraft/shaders/post/color_convolve.fsh
Normal file
39
public/assets/minecraft/shaders/post/color_convolve.fsh
Normal file
@@ -0,0 +1,39 @@
|
||||
#version 330
|
||||
|
||||
uniform sampler2D InSampler;
|
||||
|
||||
in vec2 texCoord;
|
||||
|
||||
layout(std140) uniform SamplerInfo {
|
||||
vec2 OutSize;
|
||||
vec2 InSize;
|
||||
};
|
||||
|
||||
layout(std140) uniform ColorConfig {
|
||||
vec3 RedMatrix;
|
||||
vec3 GreenMatrix;
|
||||
vec3 BlueMatrix;
|
||||
};
|
||||
|
||||
const vec3 Gray = vec3(0.3, 0.59, 0.11);
|
||||
const float Saturation = 1.8;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
vec2 oneTexel = 1.0 / InSize;
|
||||
vec4 InTexel = texture(InSampler, texCoord);
|
||||
|
||||
// Color Matrix
|
||||
float RedValue = dot(InTexel.rgb, RedMatrix);
|
||||
float GreenValue = dot(InTexel.rgb, GreenMatrix);
|
||||
float BlueValue = dot(InTexel.rgb, BlueMatrix);
|
||||
vec3 OutColor = vec3(RedValue, GreenValue, BlueValue);
|
||||
|
||||
// Saturation
|
||||
float Luma = dot(OutColor, Gray);
|
||||
vec3 Chroma = OutColor - Luma;
|
||||
OutColor = (Chroma * Saturation) + Luma;
|
||||
|
||||
fragColor = vec4(OutColor, 1.0);
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
#version 330
|
||||
|
||||
layout(std140) uniform SamplerInfo {
|
||||
vec2 OutSize;
|
||||
vec2 InSize;
|
||||
};
|
||||
|
||||
layout(std140) uniform BlurConfig {
|
||||
vec2 BlurDir;
|
||||
float Radius;
|
||||
};
|
||||
|
||||
uniform sampler2D InSampler;
|
||||
|
||||
in vec2 texCoord;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
vec2 oneTexel = 1.0 / InSize;
|
||||
vec2 sampleStep = oneTexel * BlurDir;
|
||||
|
||||
vec4 blurred = vec4(0.0);
|
||||
float radius = 2.0;
|
||||
for (float a = -radius + 0.5; a <= radius; a += 2.0) {
|
||||
blurred += texture(InSampler, texCoord + sampleStep * a);
|
||||
}
|
||||
blurred += texture(InSampler, texCoord + sampleStep * radius) / 2.0;
|
||||
fragColor = vec4((blurred / (radius + 0.5)).rgb, blurred.a);
|
||||
}
|
||||
29
public/assets/minecraft/shaders/post/entity_sobel.fsh
Normal file
29
public/assets/minecraft/shaders/post/entity_sobel.fsh
Normal file
@@ -0,0 +1,29 @@
|
||||
#version 330
|
||||
|
||||
uniform sampler2D InSampler;
|
||||
|
||||
layout(std140) uniform SamplerInfo {
|
||||
vec2 OutSize;
|
||||
vec2 InSize;
|
||||
};
|
||||
|
||||
in vec2 texCoord;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main(){
|
||||
vec2 oneTexel = 1.0 / InSize;
|
||||
|
||||
vec4 center = texture(InSampler, texCoord);
|
||||
vec4 left = texture(InSampler, texCoord - vec2(oneTexel.x, 0.0));
|
||||
vec4 right = texture(InSampler, texCoord + vec2(oneTexel.x, 0.0));
|
||||
vec4 up = texture(InSampler, texCoord - vec2(0.0, oneTexel.y));
|
||||
vec4 down = texture(InSampler, texCoord + vec2(0.0, oneTexel.y));
|
||||
float leftDiff = abs(center.a - left.a);
|
||||
float rightDiff = abs(center.a - right.a);
|
||||
float upDiff = abs(center.a - up.a);
|
||||
float downDiff = abs(center.a - down.a);
|
||||
float total = clamp(leftDiff + rightDiff + upDiff + downDiff, 0.0, 1.0);
|
||||
vec3 outColor = center.rgb * center.a + left.rgb * left.a + right.rgb * right.a + up.rgb * up.a + down.rgb * down.a;
|
||||
fragColor = vec4(outColor * 0.2, total);
|
||||
}
|
||||
25
public/assets/minecraft/shaders/post/invert.fsh
Normal file
25
public/assets/minecraft/shaders/post/invert.fsh
Normal file
@@ -0,0 +1,25 @@
|
||||
#version 330
|
||||
|
||||
uniform sampler2D InSampler;
|
||||
|
||||
in vec2 texCoord;
|
||||
|
||||
layout(std140) uniform SamplerInfo {
|
||||
vec2 OutSize;
|
||||
vec2 InSize;
|
||||
};
|
||||
|
||||
layout(std140) uniform InvertConfig {
|
||||
float InverseAmount;
|
||||
};
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main(){
|
||||
vec2 sizeRatio = OutSize / InSize;
|
||||
|
||||
vec4 diffuseColor = texture(InSampler, texCoord);
|
||||
vec4 invertColor = 1.0 - diffuseColor;
|
||||
vec4 outColor = mix(diffuseColor, invertColor, InverseAmount);
|
||||
fragColor = vec4(outColor.rgb, 1.0);
|
||||
}
|
||||
31
public/assets/minecraft/shaders/post/rotscale.vsh
Normal file
31
public/assets/minecraft/shaders/post/rotscale.vsh
Normal file
@@ -0,0 +1,31 @@
|
||||
#version 330
|
||||
|
||||
layout(std140) uniform SamplerInfo {
|
||||
vec2 OutSize;
|
||||
vec2 InSize;
|
||||
};
|
||||
|
||||
layout(std140) uniform RotScaleConfig {
|
||||
vec2 InScale;
|
||||
vec2 InOffset;
|
||||
float InRotation;
|
||||
};
|
||||
|
||||
out vec2 texCoord;
|
||||
out vec2 scaledCoord;
|
||||
|
||||
void main(){
|
||||
vec2 uv = vec2((gl_VertexID << 1) & 2, gl_VertexID & 2);
|
||||
vec4 pos = vec4(uv * vec2(2, 2) + vec2(-1, -1), 0, 1);
|
||||
|
||||
gl_Position = pos;
|
||||
texCoord = uv;
|
||||
|
||||
float Deg2Rad = 0.0174532925;
|
||||
float InRadians = InRotation * Deg2Rad;
|
||||
float Cosine = cos(InRadians);
|
||||
float Sine = sin(InRadians);
|
||||
float RotU = texCoord.x * Cosine - texCoord.y * Sine;
|
||||
float RotV = texCoord.y * Cosine + texCoord.x * Sine;
|
||||
scaledCoord = vec2(RotU, RotV) * InScale + InOffset;
|
||||
}
|
||||
39
public/assets/minecraft/shaders/post/spiderclip.fsh
Normal file
39
public/assets/minecraft/shaders/post/spiderclip.fsh
Normal file
@@ -0,0 +1,39 @@
|
||||
#version 330
|
||||
|
||||
uniform sampler2D InSampler;
|
||||
uniform sampler2D BlurSampler;
|
||||
|
||||
in vec2 texCoord;
|
||||
in vec2 scaledCoord;
|
||||
|
||||
layout(std140) uniform SamplerInfo {
|
||||
vec2 OutSize;
|
||||
vec2 InSize;
|
||||
};
|
||||
|
||||
layout(std140) uniform SpiderConfig {
|
||||
vec4 Scissor;
|
||||
vec4 Vignette;
|
||||
};
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
vec4 ScaledTexel = texture(InSampler, scaledCoord);
|
||||
vec4 BlurTexel = texture(BlurSampler, texCoord);
|
||||
vec4 OutTexel = ScaledTexel;
|
||||
|
||||
// -- Alpha Clipping --
|
||||
if (scaledCoord.x < Scissor.x) OutTexel = BlurTexel;
|
||||
if (scaledCoord.y < Scissor.y) OutTexel = BlurTexel;
|
||||
if (scaledCoord.x > Scissor.z) OutTexel = BlurTexel;
|
||||
if (scaledCoord.y > Scissor.w) OutTexel = BlurTexel;
|
||||
|
||||
clamp(scaledCoord, 0.0, 1.0);
|
||||
|
||||
if (scaledCoord.x < Vignette.x) OutTexel = mix(BlurTexel, OutTexel, (Scissor.x - scaledCoord.x) / (Scissor.x - Vignette.x));
|
||||
if (scaledCoord.y < Vignette.y) OutTexel = mix(BlurTexel, OutTexel, (Scissor.y - scaledCoord.y) / (Scissor.y - Vignette.y));
|
||||
if (scaledCoord.x > Vignette.z) OutTexel = mix(BlurTexel, OutTexel, (Scissor.z - scaledCoord.x) / (Scissor.z - Vignette.z));
|
||||
if (scaledCoord.y > Vignette.w) OutTexel = mix(BlurTexel, OutTexel, (Scissor.w - scaledCoord.y) / (Scissor.w - Vignette.w));
|
||||
fragColor = vec4(OutTexel.rgb, 1.0);
|
||||
}
|
||||
68
public/assets/minecraft/shaders/post/transparency.fsh
Normal file
68
public/assets/minecraft/shaders/post/transparency.fsh
Normal file
@@ -0,0 +1,68 @@
|
||||
#version 330
|
||||
|
||||
uniform sampler2D MainSampler;
|
||||
uniform sampler2D MainDepthSampler;
|
||||
uniform sampler2D TranslucentSampler;
|
||||
uniform sampler2D TranslucentDepthSampler;
|
||||
uniform sampler2D ItemEntitySampler;
|
||||
uniform sampler2D ItemEntityDepthSampler;
|
||||
uniform sampler2D ParticlesSampler;
|
||||
uniform sampler2D ParticlesDepthSampler;
|
||||
uniform sampler2D WeatherSampler;
|
||||
uniform sampler2D WeatherDepthSampler;
|
||||
uniform sampler2D CloudsSampler;
|
||||
uniform sampler2D CloudsDepthSampler;
|
||||
|
||||
in vec2 texCoord;
|
||||
|
||||
vec4 color_layers[6] = vec4[](vec4(0.0), vec4(0.0), vec4(0.0), vec4(0.0), vec4(0.0), vec4(0.0));
|
||||
float depth_layers[6] = float[](0, 0, 0, 0, 0, 0);
|
||||
int active_layers = 0;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void try_insert(vec4 color, float depth) {
|
||||
if (color.a == 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
color_layers[active_layers] = color;
|
||||
depth_layers[active_layers] = depth;
|
||||
|
||||
int jj = active_layers++;
|
||||
int ii = jj - 1;
|
||||
while (jj > 0 && depth_layers[jj] < depth_layers[ii]) {
|
||||
float depthTemp = depth_layers[ii];
|
||||
depth_layers[ii] = depth_layers[jj];
|
||||
depth_layers[jj] = depthTemp;
|
||||
|
||||
vec4 colorTemp = color_layers[ii];
|
||||
color_layers[ii] = color_layers[jj];
|
||||
color_layers[jj] = colorTemp;
|
||||
|
||||
jj = ii--;
|
||||
}
|
||||
}
|
||||
|
||||
vec3 blend(vec3 dst, vec4 src) {
|
||||
return (dst * (1.0 - src.a)) + src.rgb;
|
||||
}
|
||||
|
||||
void main() {
|
||||
color_layers[0] = vec4(texture(MainSampler, texCoord).rgb, 1.0);
|
||||
depth_layers[0] = texture(MainDepthSampler, texCoord).r;
|
||||
active_layers = 1;
|
||||
|
||||
try_insert(texture(TranslucentSampler, texCoord), texture(TranslucentDepthSampler, texCoord).r);
|
||||
try_insert(texture(ItemEntitySampler, texCoord), texture(ItemEntityDepthSampler, texCoord).r);
|
||||
try_insert(texture(ParticlesSampler, texCoord), texture(ParticlesDepthSampler, texCoord).r);
|
||||
try_insert(texture(WeatherSampler, texCoord), texture(WeatherDepthSampler, texCoord).r);
|
||||
try_insert(texture(CloudsSampler, texCoord), texture(CloudsDepthSampler, texCoord).r);
|
||||
|
||||
vec3 texelAccum = color_layers[0].rgb;
|
||||
for (int ii = 1; ii < active_layers; ++ii) {
|
||||
texelAccum = blend(texelAccum, color_layers[ii]);
|
||||
}
|
||||
|
||||
fragColor = vec4(texelAccum.rgb, 1.0);
|
||||
}
|
||||
Reference in New Issue
Block a user