You've already forked minecraft-assets
Create/Update assets for version 1.20.5-pre4
This commit is contained in:
1
assets/minecraft/shaders/program/_all.json
Normal file
1
assets/minecraft/shaders/program/_all.json
Normal file
File diff suppressed because one or more lines are too long
1
assets/minecraft/shaders/program/_list.json
Normal file
1
assets/minecraft/shaders/program/_list.json
Normal file
@@ -0,0 +1 @@
|
||||
{"directories":[],"files":["bits.fsh","bits.json","blit.fsh","blit.json","blit.vsh","blur.vsh","box_blur.fsh","box_blur.json","color_convolve.fsh","color_convolve.json","entity_outline.json","entity_outline_box_blur.fsh","entity_outline_box_blur.json","entity_sobel.fsh","invert.fsh","invert.json","invert.vsh","rotscale.vsh","screenquad.vsh","sobel.vsh","spider.json","spiderclip.fsh","transparency.fsh","transparency.json"]}
|
||||
29
assets/minecraft/shaders/program/bits.fsh
Normal file
29
assets/minecraft/shaders/program/bits.fsh
Normal file
@@ -0,0 +1,29 @@
|
||||
#version 150
|
||||
|
||||
uniform sampler2D DiffuseSampler;
|
||||
|
||||
in vec2 texCoord;
|
||||
in vec2 oneTexel;
|
||||
|
||||
uniform vec2 InSize;
|
||||
|
||||
uniform float Resolution;
|
||||
uniform float Saturation;
|
||||
uniform float MosaicSize;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
vec2 mosaicInSize = InSize / MosaicSize;
|
||||
vec2 fractPix = fract(texCoord * mosaicInSize) / mosaicInSize;
|
||||
|
||||
vec4 baseTexel = texture(DiffuseSampler, 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;
|
||||
}
|
||||
21
assets/minecraft/shaders/program/bits.json
Normal file
21
assets/minecraft/shaders/program/bits.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"blend": {
|
||||
"func": "add",
|
||||
"srcrgb": "srcalpha",
|
||||
"dstrgb": "1-srcalpha"
|
||||
},
|
||||
"vertex": "sobel",
|
||||
"fragment": "bits",
|
||||
"attributes": [ "Position" ],
|
||||
"samplers": [
|
||||
{ "name": "DiffuseSampler" }
|
||||
],
|
||||
"uniforms": [
|
||||
{ "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 ] },
|
||||
{ "name": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
|
||||
{ "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
|
||||
{ "name": "Resolution", "type": "float", "count": 1, "values": [ 4.0 ] },
|
||||
{ "name": "Saturation", "type": "float", "count": 1, "values": [ 1.5 ] },
|
||||
{ "name": "MosaicSize", "type": "float", "count": 1, "values": [ 8.0 ] }
|
||||
]
|
||||
}
|
||||
13
assets/minecraft/shaders/program/blit.fsh
Normal file
13
assets/minecraft/shaders/program/blit.fsh
Normal file
@@ -0,0 +1,13 @@
|
||||
#version 150
|
||||
|
||||
uniform sampler2D DiffuseSampler;
|
||||
|
||||
uniform vec4 ColorModulate;
|
||||
|
||||
in vec2 texCoord;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main(){
|
||||
fragColor = texture(DiffuseSampler, texCoord) * ColorModulate;
|
||||
}
|
||||
18
assets/minecraft/shaders/program/blit.json
Normal file
18
assets/minecraft/shaders/program/blit.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"blend": {
|
||||
"func": "add",
|
||||
"srcrgb": "srcalpha",
|
||||
"dstrgb": "1-srcalpha"
|
||||
},
|
||||
"vertex": "blit",
|
||||
"fragment": "blit",
|
||||
"attributes": [ "Position" ],
|
||||
"samplers": [
|
||||
{ "name": "DiffuseSampler" }
|
||||
],
|
||||
"uniforms": [
|
||||
{ "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 ] },
|
||||
{ "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
|
||||
{ "name": "ColorModulate", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }
|
||||
]
|
||||
}
|
||||
15
assets/minecraft/shaders/program/blit.vsh
Normal file
15
assets/minecraft/shaders/program/blit.vsh
Normal file
@@ -0,0 +1,15 @@
|
||||
#version 150
|
||||
|
||||
in vec4 Position;
|
||||
|
||||
uniform mat4 ProjMat;
|
||||
uniform vec2 OutSize;
|
||||
|
||||
out vec2 texCoord;
|
||||
|
||||
void main(){
|
||||
vec4 outPos = ProjMat * vec4(Position.xy, 0.0, 1.0);
|
||||
gl_Position = vec4(outPos.xy, 0.2, 1.0);
|
||||
|
||||
texCoord = Position.xy / OutSize;
|
||||
}
|
||||
21
assets/minecraft/shaders/program/blur.vsh
Normal file
21
assets/minecraft/shaders/program/blur.vsh
Normal file
@@ -0,0 +1,21 @@
|
||||
#version 150
|
||||
|
||||
in vec4 Position;
|
||||
|
||||
uniform mat4 ProjMat;
|
||||
uniform vec2 InSize;
|
||||
uniform vec2 OutSize;
|
||||
uniform vec2 BlurDir;
|
||||
|
||||
out vec2 texCoord;
|
||||
out vec2 sampleStep;
|
||||
|
||||
void main() {
|
||||
vec4 outPos = ProjMat * vec4(Position.xy, 0.0, 1.0);
|
||||
gl_Position = vec4(outPos.xy, 0.2, 1.0);
|
||||
|
||||
vec2 oneTexel = 1.0 / InSize;
|
||||
sampleStep = oneTexel * BlurDir;
|
||||
|
||||
texCoord = Position.xy / OutSize;
|
||||
}
|
||||
24
assets/minecraft/shaders/program/box_blur.fsh
Normal file
24
assets/minecraft/shaders/program/box_blur.fsh
Normal file
@@ -0,0 +1,24 @@
|
||||
#version 150
|
||||
|
||||
uniform sampler2D DiffuseSampler;
|
||||
|
||||
in vec2 texCoord;
|
||||
in vec2 sampleStep;
|
||||
|
||||
uniform float Radius;
|
||||
uniform float RadiusMultiplier;
|
||||
|
||||
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() {
|
||||
vec4 blurred = vec4(0.0);
|
||||
float actualRadius = round(Radius * RadiusMultiplier);
|
||||
for (float a = -actualRadius + 0.5; a <= actualRadius; a += 2.0) {
|
||||
blurred += texture(DiffuseSampler, texCoord + sampleStep * a);
|
||||
}
|
||||
blurred += texture(DiffuseSampler, texCoord + sampleStep * actualRadius) / 2.0;
|
||||
fragColor = blurred / (actualRadius + 0.5);
|
||||
}
|
||||
21
assets/minecraft/shaders/program/box_blur.json
Normal file
21
assets/minecraft/shaders/program/box_blur.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"blend": {
|
||||
"func": "add",
|
||||
"srcrgb": "one",
|
||||
"dstrgb": "zero"
|
||||
},
|
||||
"vertex": "blur",
|
||||
"fragment": "box_blur",
|
||||
"attributes": [ "Position" ],
|
||||
"samplers": [
|
||||
{ "name": "DiffuseSampler" }
|
||||
],
|
||||
"uniforms": [
|
||||
{ "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 ] },
|
||||
{ "name": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
|
||||
{ "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
|
||||
{ "name": "BlurDir", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
|
||||
{ "name": "Radius", "type": "float", "count": 1, "values": [ 5.0 ] },
|
||||
{ "name": "RadiusMultiplier", "type": "float", "count": 1, "values": [ 1.0 ] }
|
||||
]
|
||||
}
|
||||
38
assets/minecraft/shaders/program/color_convolve.fsh
Normal file
38
assets/minecraft/shaders/program/color_convolve.fsh
Normal file
@@ -0,0 +1,38 @@
|
||||
#version 150
|
||||
|
||||
uniform sampler2D DiffuseSampler;
|
||||
|
||||
in vec2 texCoord;
|
||||
in vec2 oneTexel;
|
||||
|
||||
uniform vec2 InSize;
|
||||
|
||||
uniform vec3 Gray;
|
||||
uniform vec3 RedMatrix;
|
||||
uniform vec3 GreenMatrix;
|
||||
uniform vec3 BlueMatrix;
|
||||
uniform vec3 Offset;
|
||||
uniform vec3 ColorScale;
|
||||
uniform float Saturation;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
vec4 InTexel = texture(DiffuseSampler, 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);
|
||||
|
||||
// Offset & Scale
|
||||
OutColor = (OutColor * ColorScale) + Offset;
|
||||
|
||||
// Saturation
|
||||
float Luma = dot(OutColor, Gray);
|
||||
vec3 Chroma = OutColor - Luma;
|
||||
OutColor = (Chroma * Saturation) + Luma;
|
||||
|
||||
fragColor = vec4(OutColor, 1.0);
|
||||
}
|
||||
25
assets/minecraft/shaders/program/color_convolve.json
Normal file
25
assets/minecraft/shaders/program/color_convolve.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"blend": {
|
||||
"func": "add",
|
||||
"srcrgb": "one",
|
||||
"dstrgb": "zero"
|
||||
},
|
||||
"vertex": "sobel",
|
||||
"fragment": "color_convolve",
|
||||
"attributes": [ "Position" ],
|
||||
"samplers": [
|
||||
{ "name": "DiffuseSampler" }
|
||||
],
|
||||
"uniforms": [
|
||||
{ "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 ] },
|
||||
{ "name": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
|
||||
{ "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
|
||||
{ "name": "Gray", "type": "float", "count": 3, "values": [ 0.3, 0.59, 0.11 ] },
|
||||
{ "name": "RedMatrix", "type": "float", "count": 3, "values": [ 1.0, 0.0, 0.0 ] },
|
||||
{ "name": "GreenMatrix", "type": "float", "count": 3, "values": [ 0.0, 1.0, 0.0 ] },
|
||||
{ "name": "BlueMatrix", "type": "float", "count": 3, "values": [ 0.0, 0.0, 1.0 ] },
|
||||
{ "name": "Offset", "type": "float", "count": 3, "values": [ 0.0, 0.0, 0.0 ] },
|
||||
{ "name": "ColorScale", "type": "float", "count": 3, "values": [ 1.0, 1.0, 1.0 ] },
|
||||
{ "name": "Saturation", "type": "float", "count": 1, "values": [ 1.8 ] }
|
||||
]
|
||||
}
|
||||
18
assets/minecraft/shaders/program/entity_outline.json
Normal file
18
assets/minecraft/shaders/program/entity_outline.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"blend": {
|
||||
"func": "add",
|
||||
"srcrgb": "srcalpha",
|
||||
"dstrgb": "1-srcalpha"
|
||||
},
|
||||
"vertex": "sobel",
|
||||
"fragment": "entity_sobel",
|
||||
"attributes": [ "Position" ],
|
||||
"samplers": [
|
||||
{ "name": "DiffuseSampler" }
|
||||
],
|
||||
"uniforms": [
|
||||
{ "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 ] },
|
||||
{ "name": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
|
||||
{ "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }
|
||||
]
|
||||
}
|
||||
18
assets/minecraft/shaders/program/entity_outline_box_blur.fsh
Normal file
18
assets/minecraft/shaders/program/entity_outline_box_blur.fsh
Normal file
@@ -0,0 +1,18 @@
|
||||
#version 150
|
||||
|
||||
uniform sampler2D DiffuseSampler;
|
||||
|
||||
in vec2 texCoord;
|
||||
in vec2 sampleStep;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
vec4 blurred = vec4(0.0);
|
||||
float radius = 2.0;
|
||||
for (float a = -radius + 0.5; a <= radius; a += 2.0) {
|
||||
blurred += texture(DiffuseSampler, texCoord + sampleStep * a);
|
||||
}
|
||||
blurred += texture(DiffuseSampler, texCoord + sampleStep * radius) / 2.0;
|
||||
fragColor = vec4((blurred / (radius + 0.5)).rgb, blurred.a);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"blend": {
|
||||
"func": "add",
|
||||
"srcrgb": "one",
|
||||
"dstrgb": "zero"
|
||||
},
|
||||
"vertex": "blur",
|
||||
"fragment": "entity_outline_box_blur",
|
||||
"attributes": [ "Position" ],
|
||||
"samplers": [
|
||||
{ "name": "DiffuseSampler" }
|
||||
],
|
||||
"uniforms": [
|
||||
{ "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 ] },
|
||||
{ "name": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
|
||||
{ "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
|
||||
{ "name": "BlurDir", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }
|
||||
]
|
||||
}
|
||||
23
assets/minecraft/shaders/program/entity_sobel.fsh
Normal file
23
assets/minecraft/shaders/program/entity_sobel.fsh
Normal file
@@ -0,0 +1,23 @@
|
||||
#version 150
|
||||
|
||||
uniform sampler2D DiffuseSampler;
|
||||
|
||||
in vec2 texCoord;
|
||||
in vec2 oneTexel;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main(){
|
||||
vec4 center = texture(DiffuseSampler, texCoord);
|
||||
vec4 left = texture(DiffuseSampler, texCoord - vec2(oneTexel.x, 0.0));
|
||||
vec4 right = texture(DiffuseSampler, texCoord + vec2(oneTexel.x, 0.0));
|
||||
vec4 up = texture(DiffuseSampler, texCoord - vec2(0.0, oneTexel.y));
|
||||
vec4 down = texture(DiffuseSampler, 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);
|
||||
}
|
||||
16
assets/minecraft/shaders/program/invert.fsh
Normal file
16
assets/minecraft/shaders/program/invert.fsh
Normal file
@@ -0,0 +1,16 @@
|
||||
#version 150
|
||||
|
||||
uniform sampler2D DiffuseSampler;
|
||||
|
||||
in vec2 texCoord;
|
||||
|
||||
uniform float InverseAmount;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main(){
|
||||
vec4 diffuseColor = texture(DiffuseSampler, texCoord);
|
||||
vec4 invertColor = 1.0 - diffuseColor;
|
||||
vec4 outColor = mix(diffuseColor, invertColor, InverseAmount);
|
||||
fragColor = vec4(outColor.rgb, 1.0);
|
||||
}
|
||||
19
assets/minecraft/shaders/program/invert.json
Normal file
19
assets/minecraft/shaders/program/invert.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"blend": {
|
||||
"func": "add",
|
||||
"srcrgb": "one",
|
||||
"dstrgb": "zero"
|
||||
},
|
||||
"vertex": "blit",
|
||||
"fragment": "invert",
|
||||
"attributes": [ "Position" ],
|
||||
"samplers": [
|
||||
{ "name": "DiffuseSampler" }
|
||||
],
|
||||
"uniforms": [
|
||||
{ "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 ] },
|
||||
{ "name": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
|
||||
{ "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
|
||||
{ "name": "InverseAmount", "type": "float", "count": 1, "values": [ 0.0 ] }
|
||||
]
|
||||
}
|
||||
20
assets/minecraft/shaders/program/invert.vsh
Normal file
20
assets/minecraft/shaders/program/invert.vsh
Normal file
@@ -0,0 +1,20 @@
|
||||
#version 150
|
||||
|
||||
in vec4 Position;
|
||||
|
||||
uniform mat4 ProjMat;
|
||||
uniform vec2 InSize;
|
||||
uniform vec2 OutSize;
|
||||
|
||||
out vec2 texCoord;
|
||||
|
||||
void main(){
|
||||
vec4 outPos = ProjMat * vec4(Position.xy, 0.0, 1.0);
|
||||
gl_Position = vec4(outPos.xy, 0.2, 1.0);
|
||||
|
||||
vec2 sizeRatio = OutSize / InSize;
|
||||
texCoord = Position.xy / OutSize;
|
||||
texCoord.x = texCoord.x * sizeRatio.x;
|
||||
texCoord.y = texCoord.y * sizeRatio.y;
|
||||
texCoord.y = sizeRatio.y - texCoord.y;
|
||||
}
|
||||
30
assets/minecraft/shaders/program/rotscale.vsh
Normal file
30
assets/minecraft/shaders/program/rotscale.vsh
Normal file
@@ -0,0 +1,30 @@
|
||||
#version 150
|
||||
|
||||
in vec4 Position;
|
||||
|
||||
uniform mat4 ProjMat;
|
||||
uniform vec2 InSize;
|
||||
uniform vec2 OutSize;
|
||||
|
||||
uniform vec2 InScale;
|
||||
uniform vec2 InOffset;
|
||||
uniform float InRotation;
|
||||
uniform float Time;
|
||||
|
||||
out vec2 texCoord;
|
||||
out vec2 scaledCoord;
|
||||
|
||||
void main(){
|
||||
vec4 outPos = ProjMat * vec4(Position.xy, 0.0, 1.0);
|
||||
gl_Position = vec4(outPos.xy, 0.2, 1.0);
|
||||
|
||||
texCoord = Position.xy / OutSize;
|
||||
|
||||
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;
|
||||
}
|
||||
14
assets/minecraft/shaders/program/screenquad.vsh
Normal file
14
assets/minecraft/shaders/program/screenquad.vsh
Normal file
@@ -0,0 +1,14 @@
|
||||
#version 150
|
||||
|
||||
in vec4 Position;
|
||||
|
||||
uniform mat4 ProjMat;
|
||||
uniform vec2 OutSize;
|
||||
|
||||
out vec2 texCoord;
|
||||
|
||||
void main() {
|
||||
vec4 outPos = ProjMat * vec4(Position.xy, 0.0, 1.0);
|
||||
gl_Position = vec4(outPos.xy, 0.2, 1.0);
|
||||
texCoord = Position.xy / OutSize;
|
||||
}
|
||||
19
assets/minecraft/shaders/program/sobel.vsh
Normal file
19
assets/minecraft/shaders/program/sobel.vsh
Normal file
@@ -0,0 +1,19 @@
|
||||
#version 150
|
||||
|
||||
in vec4 Position;
|
||||
|
||||
uniform mat4 ProjMat;
|
||||
uniform vec2 InSize;
|
||||
uniform vec2 OutSize;
|
||||
|
||||
out vec2 texCoord;
|
||||
out vec2 oneTexel;
|
||||
|
||||
void main(){
|
||||
vec4 outPos = ProjMat * vec4(Position.xy, 0.0, 1.0);
|
||||
gl_Position = vec4(outPos.xy, 0.2, 1.0);
|
||||
|
||||
oneTexel = 1.0 / InSize;
|
||||
|
||||
texCoord = Position.xy / OutSize;
|
||||
}
|
||||
25
assets/minecraft/shaders/program/spider.json
Normal file
25
assets/minecraft/shaders/program/spider.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"blend": {
|
||||
"func": "add",
|
||||
"srcrgb": "one",
|
||||
"dstrgb": "zero"
|
||||
},
|
||||
"vertex": "rotscale",
|
||||
"fragment": "spiderclip",
|
||||
"attributes": [ "Position" ],
|
||||
"samplers": [
|
||||
{ "name": "DiffuseSampler" },
|
||||
{ "name": "BlurSampler" }
|
||||
],
|
||||
"uniforms": [
|
||||
{ "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 ] },
|
||||
{ "name": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
|
||||
{ "name": "InScale", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
|
||||
{ "name": "InOffset", "type": "float", "count": 2, "values": [ 0.0, 0.0 ] },
|
||||
{ "name": "InRotation", "type": "float", "count": 1, "values": [ 0.0 ] },
|
||||
{ "name": "Time", "type": "float", "count": 1, "values": [ 0.0 ] },
|
||||
{ "name": "Scissor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 1.0, 1.0 ] },
|
||||
{ "name": "Vignette", "type": "float", "count": 4, "values": [ 0.0, 0.0, 1.0, 1.0 ] },
|
||||
{ "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }
|
||||
]
|
||||
}
|
||||
33
assets/minecraft/shaders/program/spiderclip.fsh
Normal file
33
assets/minecraft/shaders/program/spiderclip.fsh
Normal file
@@ -0,0 +1,33 @@
|
||||
#version 150
|
||||
|
||||
uniform sampler2D DiffuseSampler;
|
||||
uniform sampler2D BlurSampler;
|
||||
|
||||
in vec2 texCoord;
|
||||
in vec2 scaledCoord;
|
||||
|
||||
uniform vec2 InSize;
|
||||
uniform vec4 Scissor;
|
||||
uniform vec4 Vignette;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
vec4 ScaledTexel = texture(DiffuseSampler, 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);
|
||||
}
|
||||
70
assets/minecraft/shaders/program/transparency.fsh
Normal file
70
assets/minecraft/shaders/program/transparency.fsh
Normal file
@@ -0,0 +1,70 @@
|
||||
#version 150
|
||||
|
||||
uniform sampler2D DiffuseSampler;
|
||||
uniform sampler2D DiffuseDepthSampler;
|
||||
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;
|
||||
|
||||
#define NUM_LAYERS 6
|
||||
|
||||
vec4 color_layers[NUM_LAYERS];
|
||||
float depth_layers[NUM_LAYERS];
|
||||
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( DiffuseSampler, texCoord ).rgb, 1.0 );
|
||||
depth_layers[0] = texture( DiffuseDepthSampler, 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 );
|
||||
}
|
||||
28
assets/minecraft/shaders/program/transparency.json
Normal file
28
assets/minecraft/shaders/program/transparency.json
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"blend": {
|
||||
"func": "add",
|
||||
"srcrgb": "one",
|
||||
"dstrgb": "zero"
|
||||
},
|
||||
"vertex": "screenquad",
|
||||
"fragment": "transparency",
|
||||
"attributes": [ "Position" ],
|
||||
"samplers": [
|
||||
{ "name": "DiffuseSampler" },
|
||||
{ "name": "DiffuseDepthSampler" },
|
||||
{ "name": "TranslucentSampler" },
|
||||
{ "name": "TranslucentDepthSampler" },
|
||||
{ "name": "ItemEntitySampler" },
|
||||
{ "name": "ItemEntityDepthSampler" },
|
||||
{ "name": "ParticlesSampler" },
|
||||
{ "name": "ParticlesDepthSampler" },
|
||||
{ "name": "CloudsSampler" },
|
||||
{ "name": "CloudsDepthSampler" },
|
||||
{ "name": "WeatherSampler" },
|
||||
{ "name": "WeatherDepthSampler" }
|
||||
],
|
||||
"uniforms": [
|
||||
{ "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 ] },
|
||||
{ "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user