You've already forked minecraft-assets
Create/Update assets for version 1.19-pre1
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":["antialias.fsh","antialias.json","bits.fsh","bits.json","blit.fsh","blit.json","blit.vsh","blobs.fsh","blobs.json","blobs.vsh","blobs2.fsh","blobs2.json","blur.fsh","blur.json","bumpy.fsh","bumpy.json","bumpy.vsh","color_convolve.fsh","color_convolve.json","deconverge.fsh","deconverge.json","downscale.fsh","downscale.json","downscale.vsh","entity_outline.json","entity_sobel.fsh","flip.json","flip.vsh","fxaa.fsh","fxaa.json","fxaa.vsh","invert.fsh","invert.json","invert.vsh","notch.fsh","notch.json","ntsc_decode.fsh","ntsc_decode.json","ntsc_encode.fsh","ntsc_encode.json","outline.fsh","outline.json","outline_combine.fsh","outline_combine.json","outline_soft.fsh","outline_soft.json","outline_watercolor.fsh","outline_watercolor.json","overlay.fsh","overlay.json","phosphor.fsh","phosphor.json","rotscale.vsh","scan_pincushion.fsh","scan_pincushion.json","screenquad.vsh","sobel.fsh","sobel.json","sobel.vsh","spider.json","spiderclip.fsh","transparency.fsh","transparency.json","wobble.fsh","wobble.json"]}
|
||||
31
assets/minecraft/shaders/program/antialias.fsh
Normal file
31
assets/minecraft/shaders/program/antialias.fsh
Normal file
@@ -0,0 +1,31 @@
|
||||
#version 150
|
||||
|
||||
uniform sampler2D DiffuseSampler;
|
||||
|
||||
in vec2 texCoord;
|
||||
in vec2 oneTexel;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main(){
|
||||
vec4 c = texture (DiffuseSampler, texCoord);
|
||||
vec4 u1 = texture (DiffuseSampler, texCoord + vec2 ( 0.0, -oneTexel.y ));
|
||||
vec4 u2 = texture (DiffuseSampler, texCoord + vec2 ( 0.0, -oneTexel.y * 2.0));
|
||||
vec4 d1 = texture (DiffuseSampler, texCoord + vec2 ( 0.0, oneTexel.y ));
|
||||
vec4 d2 = texture (DiffuseSampler, texCoord + vec2 ( 0.0, oneTexel.y * 2.0));
|
||||
vec4 l1 = texture (DiffuseSampler, texCoord + vec2 (-oneTexel.x, 0.0));
|
||||
vec4 l2 = texture (DiffuseSampler, texCoord + vec2 (-oneTexel.x * 2.0, 0.0));
|
||||
vec4 r1 = texture (DiffuseSampler, texCoord + vec2 ( oneTexel.x, 0.0));
|
||||
vec4 r2 = texture (DiffuseSampler, texCoord + vec2 ( oneTexel.x * 2.0, 0.0));
|
||||
|
||||
vec4 v1 = mix (c, mix (l1, l2, 0.667), 0.75);
|
||||
vec4 v2 = mix (c, mix (r1, r2, 0.667), 0.75);
|
||||
vec4 v3 = mix (c, mix (u1, u2, 0.667), 0.75);
|
||||
vec4 v4 = mix (c, mix (d1, d2, 0.667), 0.75);
|
||||
|
||||
vec4 v5 = mix (v1, v2, 0.5);
|
||||
vec4 v6 = mix (v3, v4, 0.5);
|
||||
|
||||
vec4 color = mix (v5, v6, 0.5);
|
||||
fragColor = vec4(color.rgb, 1.0);
|
||||
}
|
||||
18
assets/minecraft/shaders/program/antialias.json
Normal file
18
assets/minecraft/shaders/program/antialias.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"blend": {
|
||||
"func": "add",
|
||||
"srcrgb": "one",
|
||||
"dstrgb": "zero"
|
||||
},
|
||||
"vertex": "blobs",
|
||||
"fragment": "antialias",
|
||||
"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 ] }
|
||||
]
|
||||
}
|
||||
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;
|
||||
}
|
||||
45
assets/minecraft/shaders/program/blobs.fsh
Normal file
45
assets/minecraft/shaders/program/blobs.fsh
Normal file
@@ -0,0 +1,45 @@
|
||||
#version 150
|
||||
|
||||
uniform sampler2D DiffuseSampler;
|
||||
|
||||
in vec2 texCoord;
|
||||
in vec2 oneTexel;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main(){
|
||||
vec4 u = texture(DiffuseSampler, texCoord + vec2( 0.0, -oneTexel.y));
|
||||
vec4 d = texture(DiffuseSampler, texCoord + vec2( 0.0, oneTexel.y));
|
||||
vec4 l = texture(DiffuseSampler, texCoord + vec2(-oneTexel.x, 0.0));
|
||||
vec4 r = texture(DiffuseSampler, texCoord + vec2( oneTexel.x, 0.0));
|
||||
|
||||
vec4 v1 = min(l, r);
|
||||
vec4 v2 = min(u, d);
|
||||
vec4 v3 = min(v1, v2);
|
||||
|
||||
vec4 ul = texture(DiffuseSampler, texCoord + vec2(-oneTexel.x, -oneTexel.y));
|
||||
vec4 dr = texture(DiffuseSampler, texCoord + vec2( oneTexel.x, oneTexel.y));
|
||||
vec4 dl = texture(DiffuseSampler, texCoord + vec2(-oneTexel.x, oneTexel.y));
|
||||
vec4 ur = texture(DiffuseSampler, texCoord + vec2( oneTexel.x, -oneTexel.y));
|
||||
|
||||
vec4 v4 = min(ul, dr);
|
||||
vec4 v5 = min(ur, dl);
|
||||
vec4 v6 = min(v4, v5);
|
||||
|
||||
vec4 v7 = min(v3, v6);
|
||||
|
||||
vec4 uu = texture(DiffuseSampler, texCoord + vec2( 0.0, -oneTexel.y * 2.0));
|
||||
vec4 dd = texture(DiffuseSampler, texCoord + vec2( 0.0, oneTexel.y * 2.0));
|
||||
vec4 ll = texture(DiffuseSampler, texCoord + vec2(-oneTexel.x * 2.0, 0.0));
|
||||
vec4 rr = texture(DiffuseSampler, texCoord + vec2( oneTexel.x * 2.0, 0.0));
|
||||
|
||||
vec4 v8 = min(uu, dd);
|
||||
vec4 v9 = min(ll, rr);
|
||||
vec4 v10 = min(v8, v9);
|
||||
|
||||
vec4 v11 = min(v7, v10);
|
||||
|
||||
vec4 c = texture(DiffuseSampler, texCoord);
|
||||
vec4 color = min(c, v11);
|
||||
fragColor = vec4(color.rgb, 1.0);
|
||||
}
|
||||
18
assets/minecraft/shaders/program/blobs.json
Normal file
18
assets/minecraft/shaders/program/blobs.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"blend": {
|
||||
"func": "add",
|
||||
"srcrgb": "one",
|
||||
"dstrgb": "zero"
|
||||
},
|
||||
"vertex": "blobs",
|
||||
"fragment": "blobs",
|
||||
"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 ] }
|
||||
]
|
||||
}
|
||||
17
assets/minecraft/shaders/program/blobs.vsh
Normal file
17
assets/minecraft/shaders/program/blobs.vsh
Normal file
@@ -0,0 +1,17 @@
|
||||
#version 150
|
||||
|
||||
in vec4 Position;
|
||||
|
||||
uniform mat4 ProjMat;
|
||||
uniform vec2 InSize;
|
||||
|
||||
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 = outPos.xy * 0.5 + 0.5;
|
||||
}
|
||||
32
assets/minecraft/shaders/program/blobs2.fsh
Normal file
32
assets/minecraft/shaders/program/blobs2.fsh
Normal file
@@ -0,0 +1,32 @@
|
||||
#version 150
|
||||
|
||||
uniform sampler2D DiffuseSampler;
|
||||
|
||||
in vec2 texCoord;
|
||||
in vec2 oneTexel;
|
||||
|
||||
uniform float Radius;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main(){
|
||||
vec4 c = texture(DiffuseSampler, texCoord);
|
||||
vec4 maxVal = c;
|
||||
for(float u = 0.0; u <= Radius; u += 1.0) {
|
||||
for(float v = 0.0; v <= Radius; v += 1.0) {
|
||||
float weight = (((sqrt(u * u + v * v) / (Radius)) > 1.0) ? 0.0 : 1.0);
|
||||
|
||||
vec4 s0 = texture(DiffuseSampler, texCoord + vec2(-u * oneTexel.x, -v * oneTexel.y));
|
||||
vec4 s1 = texture(DiffuseSampler, texCoord + vec2( u * oneTexel.x, v * oneTexel.y));
|
||||
vec4 s2 = texture(DiffuseSampler, texCoord + vec2(-u * oneTexel.x, v * oneTexel.y));
|
||||
vec4 s3 = texture(DiffuseSampler, texCoord + vec2( u * oneTexel.x, -v * oneTexel.y));
|
||||
|
||||
vec4 o0 = max(s0, s1);
|
||||
vec4 o1 = max(s2, s3);
|
||||
vec4 tempMax = max(o0, o1);
|
||||
maxVal = mix(maxVal, max(maxVal, tempMax), weight);
|
||||
}
|
||||
}
|
||||
|
||||
fragColor = vec4(maxVal.rgb, 1.0);
|
||||
}
|
||||
18
assets/minecraft/shaders/program/blobs2.json
Normal file
18
assets/minecraft/shaders/program/blobs2.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"blend": {
|
||||
"func": "add",
|
||||
"srcrgb": "one",
|
||||
"dstrgb": "zero"
|
||||
},
|
||||
"vertex": "blobs",
|
||||
"fragment": "blobs2",
|
||||
"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": "Radius", "type": "float", "count": 1, "values": [ 7.0 ] }
|
||||
]
|
||||
}
|
||||
33
assets/minecraft/shaders/program/blur.fsh
Normal file
33
assets/minecraft/shaders/program/blur.fsh
Normal file
@@ -0,0 +1,33 @@
|
||||
#version 150
|
||||
|
||||
uniform sampler2D DiffuseSampler;
|
||||
|
||||
in vec2 texCoord;
|
||||
in vec2 oneTexel;
|
||||
|
||||
uniform vec2 InSize;
|
||||
|
||||
uniform vec2 BlurDir;
|
||||
uniform float Radius;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
vec4 blurred = vec4(0.0);
|
||||
float totalStrength = 0.0;
|
||||
float totalAlpha = 0.0;
|
||||
float totalSamples = 0.0;
|
||||
for(float r = -Radius; r <= Radius; r += 1.0) {
|
||||
vec4 sampleValue = texture(DiffuseSampler, texCoord + oneTexel * r * BlurDir);
|
||||
|
||||
// Accumulate average alpha
|
||||
totalAlpha = totalAlpha + sampleValue.a;
|
||||
totalSamples = totalSamples + 1.0;
|
||||
|
||||
// Accumulate smoothed blur
|
||||
float strength = 1.0 - abs(r / Radius);
|
||||
totalStrength = totalStrength + strength;
|
||||
blurred = blurred + sampleValue;
|
||||
}
|
||||
fragColor = vec4(blurred.rgb / (Radius * 2.0 + 1.0), totalAlpha);
|
||||
}
|
||||
20
assets/minecraft/shaders/program/blur.json
Normal file
20
assets/minecraft/shaders/program/blur.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"blend": {
|
||||
"func": "add",
|
||||
"srcrgb": "one",
|
||||
"dstrgb": "zero"
|
||||
},
|
||||
"vertex": "sobel",
|
||||
"fragment": "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 ] }
|
||||
]
|
||||
}
|
||||
36
assets/minecraft/shaders/program/bumpy.fsh
Normal file
36
assets/minecraft/shaders/program/bumpy.fsh
Normal file
@@ -0,0 +1,36 @@
|
||||
#version 150
|
||||
|
||||
uniform sampler2D DiffuseSampler;
|
||||
|
||||
in vec2 texCoord;
|
||||
in vec2 oneTexel;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main(){
|
||||
vec4 c = texture(DiffuseSampler, texCoord);
|
||||
vec4 u = texture(DiffuseSampler, texCoord + vec2( 0.0, -oneTexel.y));
|
||||
vec4 d = texture(DiffuseSampler, texCoord + vec2( 0.0, oneTexel.y));
|
||||
vec4 l = texture(DiffuseSampler, texCoord + vec2(-oneTexel.x, 0.0));
|
||||
vec4 r = texture(DiffuseSampler, texCoord + vec2( oneTexel.x, 0.0));
|
||||
|
||||
vec4 nc = normalize(c);
|
||||
vec4 nu = normalize(u);
|
||||
vec4 nd = normalize(d);
|
||||
vec4 nl = normalize(l);
|
||||
vec4 nr = normalize(r);
|
||||
|
||||
float du = dot(nc, nu);
|
||||
float dd = dot(nc, nd);
|
||||
float dl = dot(nc, nl);
|
||||
float dr = dot(nc, nr);
|
||||
|
||||
float i = 64.0;
|
||||
|
||||
float f = 1.0;
|
||||
f += (du * i) - (dd * i);
|
||||
f += (dr * i) - (dl * i);
|
||||
|
||||
vec4 color = c * clamp(f, 0.5, 2.0);
|
||||
fragColor = vec4(color.rgb, 1.0);
|
||||
}
|
||||
18
assets/minecraft/shaders/program/bumpy.json
Normal file
18
assets/minecraft/shaders/program/bumpy.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"blend": {
|
||||
"func": "add",
|
||||
"srcrgb": "one",
|
||||
"dstrgb": "zero"
|
||||
},
|
||||
"vertex": "bumpy",
|
||||
"fragment": "bumpy",
|
||||
"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 ] }
|
||||
]
|
||||
}
|
||||
17
assets/minecraft/shaders/program/bumpy.vsh
Normal file
17
assets/minecraft/shaders/program/bumpy.vsh
Normal file
@@ -0,0 +1,17 @@
|
||||
#version 150
|
||||
|
||||
in vec4 Position;
|
||||
|
||||
uniform mat4 ProjMat;
|
||||
uniform vec2 InSize;
|
||||
|
||||
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 = outPos.xy * 0.5 + 0.5;
|
||||
}
|
||||
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 ] }
|
||||
]
|
||||
}
|
||||
30
assets/minecraft/shaders/program/deconverge.fsh
Normal file
30
assets/minecraft/shaders/program/deconverge.fsh
Normal file
@@ -0,0 +1,30 @@
|
||||
#version 150
|
||||
|
||||
uniform sampler2D DiffuseSampler;
|
||||
|
||||
in vec2 texCoord;
|
||||
in vec2 oneTexel;
|
||||
|
||||
uniform vec2 InSize;
|
||||
|
||||
uniform vec3 ConvergeX;
|
||||
uniform vec3 ConvergeY;
|
||||
uniform vec3 RadialConvergeX;
|
||||
uniform vec3 RadialConvergeY;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
vec3 CoordX = texCoord.x * RadialConvergeX;
|
||||
vec3 CoordY = texCoord.y * RadialConvergeY;
|
||||
|
||||
CoordX += ConvergeX * oneTexel.x - (RadialConvergeX - 1.0) * 0.5;
|
||||
CoordY += ConvergeY * oneTexel.y - (RadialConvergeY - 1.0) * 0.5;
|
||||
|
||||
float RedValue = texture(DiffuseSampler, vec2(CoordX.x, CoordY.x)).r;
|
||||
float GreenValue = texture(DiffuseSampler, vec2(CoordX.y, CoordY.y)).g;
|
||||
float BlueValue = texture(DiffuseSampler, vec2(CoordX.z, CoordY.z)).b;
|
||||
float AlphaValue = texture(DiffuseSampler, texCoord).a;
|
||||
|
||||
fragColor = vec4(RedValue, GreenValue, BlueValue, 1.0);
|
||||
}
|
||||
22
assets/minecraft/shaders/program/deconverge.json
Normal file
22
assets/minecraft/shaders/program/deconverge.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"blend": {
|
||||
"func": "add",
|
||||
"srcrgb": "one",
|
||||
"dstrgb": "zero"
|
||||
},
|
||||
"vertex": "sobel",
|
||||
"fragment": "deconverge",
|
||||
"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": "ConvergeX", "type": "float", "count": 3, "values": [ -4.0, 0.0, 2.0 ] },
|
||||
{ "name": "ConvergeY", "type": "float", "count": 3, "values": [ 0.0, -4.0, 2.0 ] },
|
||||
{ "name": "RadialConvergeX", "type": "float", "count": 3, "values": [ 1.0, 1.0, 1.0 ] },
|
||||
{ "name": "RadialConvergeY", "type": "float", "count": 3, "values": [ 1.0, 1.0, 1.0 ] }
|
||||
]
|
||||
}
|
||||
19
assets/minecraft/shaders/program/downscale.fsh
Normal file
19
assets/minecraft/shaders/program/downscale.fsh
Normal file
@@ -0,0 +1,19 @@
|
||||
#version 150
|
||||
|
||||
uniform sampler2D DiffuseSampler;
|
||||
|
||||
in vec2 texCoord;
|
||||
in vec2 oneTexel;
|
||||
|
||||
uniform vec2 InSize;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
vec3 Texel0 = texture(DiffuseSampler, texCoord).rgb;
|
||||
vec3 Texel1 = texture(DiffuseSampler, texCoord + vec2(oneTexel.x, 0.0)).rgb;
|
||||
vec3 Texel2 = texture(DiffuseSampler, texCoord + vec2(0.0, oneTexel.y)).rgb;
|
||||
vec3 Texel3 = texture(DiffuseSampler, texCoord + oneTexel).rgb;
|
||||
|
||||
fragColor = vec4((Texel0 + Texel1 + Texel2 + Texel3) * 0.25, 1.0);
|
||||
}
|
||||
18
assets/minecraft/shaders/program/downscale.json
Normal file
18
assets/minecraft/shaders/program/downscale.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"blend": {
|
||||
"func": "add",
|
||||
"srcrgb": "one",
|
||||
"dstrgb": "zero"
|
||||
},
|
||||
"vertex": "downscale",
|
||||
"fragment": "downscale",
|
||||
"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/downscale.vsh
Normal file
18
assets/minecraft/shaders/program/downscale.vsh
Normal file
@@ -0,0 +1,18 @@
|
||||
#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 = outPos.xy * 0.5 + 0.5;
|
||||
}
|
||||
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 ] }
|
||||
]
|
||||
}
|
||||
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);
|
||||
}
|
||||
20
assets/minecraft/shaders/program/flip.json
Normal file
20
assets/minecraft/shaders/program/flip.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"blend": {
|
||||
"func": "add",
|
||||
"srcrgb": "one",
|
||||
"dstrgb": "zero"
|
||||
},
|
||||
"vertex": "flip",
|
||||
"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": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
|
||||
{ "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
|
||||
{ "name": "ScreenSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
|
||||
{ "name": "ColorModulate", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] }
|
||||
]
|
||||
}
|
||||
23
assets/minecraft/shaders/program/flip.vsh
Normal file
23
assets/minecraft/shaders/program/flip.vsh
Normal file
@@ -0,0 +1,23 @@
|
||||
#version 150
|
||||
|
||||
in vec4 Position;
|
||||
|
||||
uniform mat4 ProjMat;
|
||||
uniform vec2 InSize;
|
||||
uniform vec2 OutSize;
|
||||
uniform vec2 ScreenSize;
|
||||
|
||||
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 inOutRatio = OutSize / InSize;
|
||||
vec2 inScreenRatio = ScreenSize / InSize;
|
||||
texCoord = Position.xy / OutSize;
|
||||
texCoord.y = 1.0 - texCoord.y;
|
||||
texCoord.x = texCoord.x * inOutRatio.x;
|
||||
texCoord.y = texCoord.y * inOutRatio.y;
|
||||
texCoord.y -= 1.0 - inScreenRatio.y;
|
||||
}
|
||||
73
assets/minecraft/shaders/program/fxaa.fsh
Normal file
73
assets/minecraft/shaders/program/fxaa.fsh
Normal file
@@ -0,0 +1,73 @@
|
||||
#version 150
|
||||
|
||||
uniform sampler2D DiffuseSampler;
|
||||
uniform vec2 OutSize;
|
||||
|
||||
uniform float VxOffset;
|
||||
uniform float SpanMax;
|
||||
uniform float ReduceMul;
|
||||
|
||||
in vec2 texCoord;
|
||||
in vec4 posPos;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
vec3 FxaaPixelShader(
|
||||
vec4 posPos, // Output of FxaaVertexShader interpolated across screen.
|
||||
sampler2D tex, // Input texture.
|
||||
vec2 rcpFrame) // Constant {1.0/frameWidth, 1.0/frameHeight}.
|
||||
{
|
||||
|
||||
#define FXAA_REDUCE_MIN (1.0/128.0)
|
||||
//#define FXAA_REDUCE_MUL (1.0/8.0)
|
||||
//#define FXAA_SPAN_MAX 8.0
|
||||
|
||||
vec3 rgbNW = texture(tex, posPos.zw).xyz;
|
||||
vec3 rgbNE = textureOffset(tex, posPos.zw, ivec2(1,0)).xyz;
|
||||
vec3 rgbSW = textureOffset(tex, posPos.zw, ivec2(0,1)).xyz;
|
||||
vec3 rgbSE = textureOffset(tex, posPos.zw, ivec2(1,1)).xyz;
|
||||
|
||||
vec3 rgbM = texture(tex, posPos.xy).xyz;
|
||||
|
||||
vec3 luma = vec3(0.299, 0.587, 0.114);
|
||||
float lumaNW = dot(rgbNW, luma);
|
||||
float lumaNE = dot(rgbNE, luma);
|
||||
float lumaSW = dot(rgbSW, luma);
|
||||
float lumaSE = dot(rgbSE, luma);
|
||||
float lumaM = dot(rgbM, luma);
|
||||
|
||||
float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));
|
||||
float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));
|
||||
|
||||
vec2 dir;
|
||||
dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));
|
||||
dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));
|
||||
|
||||
float dirReduce = max(
|
||||
(lumaNW + lumaNE + lumaSW + lumaSE) * (0.25 * ReduceMul),
|
||||
FXAA_REDUCE_MIN);
|
||||
float rcpDirMin = 1.0/(min(abs(dir.x), abs(dir.y)) + dirReduce);
|
||||
dir = min(vec2( SpanMax, SpanMax),
|
||||
max(vec2(-SpanMax, -SpanMax),
|
||||
dir * rcpDirMin)) * rcpFrame.xy;
|
||||
|
||||
vec3 rgbA = (1.0/2.0) * (
|
||||
texture(tex, posPos.xy + dir * vec2(1.0/3.0 - 0.5)).xyz +
|
||||
texture(tex, posPos.xy + dir * vec2(2.0/3.0 - 0.5)).xyz);
|
||||
vec3 rgbB = rgbA * (1.0/2.0) + (1.0/4.0) * (
|
||||
texture(tex, posPos.xy + dir * vec2(0.0/3.0 - 0.5)).xyz +
|
||||
texture(tex, posPos.xy + dir * vec2(3.0/3.0 - 0.5)).xyz);
|
||||
|
||||
float lumaB = dot(rgbB, luma);
|
||||
|
||||
if ((lumaB < lumaMin) || (lumaB > lumaMax)) {
|
||||
return rgbA;
|
||||
} else {
|
||||
return rgbB;
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec4 baseTexel = texture(DiffuseSampler, posPos.xy);
|
||||
fragColor = vec4(FxaaPixelShader(posPos, DiffuseSampler, 1.0 / OutSize), 1.0);
|
||||
}
|
||||
20
assets/minecraft/shaders/program/fxaa.json
Normal file
20
assets/minecraft/shaders/program/fxaa.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"blend": {
|
||||
"func": "add",
|
||||
"srcrgb": "one",
|
||||
"dstrgb": "zero"
|
||||
},
|
||||
"vertex": "fxaa",
|
||||
"fragment": "fxaa",
|
||||
"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": "SpanMax", "type": "float", "count": 1, "values": [ 8.0 ] },
|
||||
{ "name": "SubPixelShift", "type": "float", "count": 1, "values": [ 0.25 ] },
|
||||
{ "name": "ReduceMul", "type": "float", "count": 1, "values": [ 0.125 ] }
|
||||
]
|
||||
}
|
||||
20
assets/minecraft/shaders/program/fxaa.vsh
Normal file
20
assets/minecraft/shaders/program/fxaa.vsh
Normal file
@@ -0,0 +1,20 @@
|
||||
#version 150
|
||||
|
||||
in vec4 Position;
|
||||
|
||||
uniform mat4 ProjMat;
|
||||
uniform vec2 OutSize;
|
||||
|
||||
uniform float SubPixelShift;
|
||||
|
||||
out vec2 texCoord;
|
||||
out vec4 posPos;
|
||||
|
||||
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;
|
||||
posPos.xy = texCoord.xy;
|
||||
posPos.zw = texCoord.xy - (1.0/OutSize * vec2(0.5 + SubPixelShift));
|
||||
}
|
||||
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;
|
||||
}
|
||||
25
assets/minecraft/shaders/program/notch.fsh
Normal file
25
assets/minecraft/shaders/program/notch.fsh
Normal file
@@ -0,0 +1,25 @@
|
||||
#version 150
|
||||
|
||||
uniform sampler2D DiffuseSampler;
|
||||
uniform sampler2D DitherSampler;
|
||||
|
||||
in vec2 texCoord;
|
||||
|
||||
uniform vec2 InSize;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
vec2 halfSize = InSize * 0.5;
|
||||
|
||||
vec2 steppedCoord = texCoord;
|
||||
steppedCoord.x = float(int(steppedCoord.x*halfSize.x)) / halfSize.x;
|
||||
steppedCoord.y = float(int(steppedCoord.y*halfSize.y)) / halfSize.y;
|
||||
|
||||
vec4 noise = texture(DitherSampler, steppedCoord * halfSize / 4.0);
|
||||
vec4 col = texture(DiffuseSampler, steppedCoord) + noise * vec4(1.0/12.0, 1.0/12.0, 1.0/6.0, 1.0);
|
||||
float r = float(int(col.r*8.0))/8.0;
|
||||
float g = float(int(col.g*8.0))/8.0;
|
||||
float b = float(int(col.b*4.0))/4.0;
|
||||
fragColor = vec4(r, g, b, 1.0);
|
||||
}
|
||||
19
assets/minecraft/shaders/program/notch.json
Normal file
19
assets/minecraft/shaders/program/notch.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"blend": {
|
||||
"func": "add",
|
||||
"srcrgb": "one",
|
||||
"dstrgb": "zero"
|
||||
},
|
||||
"vertex": "sobel",
|
||||
"fragment": "notch",
|
||||
"attributes": [ "Position" ],
|
||||
"samplers": [
|
||||
{ "name": "DiffuseSampler" },
|
||||
{ "name": "DitherSampler" }
|
||||
],
|
||||
"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 ] }
|
||||
]
|
||||
}
|
||||
134
assets/minecraft/shaders/program/ntsc_decode.fsh
Normal file
134
assets/minecraft/shaders/program/ntsc_decode.fsh
Normal file
@@ -0,0 +1,134 @@
|
||||
#version 150
|
||||
|
||||
uniform sampler2D DiffuseSampler;
|
||||
uniform sampler2D BaseSampler;
|
||||
|
||||
in vec2 texCoord;
|
||||
in vec2 oneTexel;
|
||||
|
||||
uniform vec2 InSize;
|
||||
|
||||
const vec4 Zero = vec4(0.0);
|
||||
const vec4 One = vec4(1.0);
|
||||
|
||||
const float Pi = 3.1415926535;
|
||||
const float Pi2 = 6.283185307;
|
||||
|
||||
const vec4 A2 = vec4(1.0);
|
||||
const vec4 B = vec4(0.5);
|
||||
const float P = 1.0;
|
||||
const float CCFrequency = 3.59754545;
|
||||
const float NotchWidth = 2.0;
|
||||
const float NotchUpperFrequency = 3.59754545 + NotchWidth;
|
||||
const float NotchLowerFrequency = 3.59754545 - NotchWidth;
|
||||
const float YFrequency = 6.0;
|
||||
const float IFrequency = 1.2;
|
||||
const float QFrequency = 0.6;
|
||||
const float ScanTime = 52.6;
|
||||
const vec3 YIQ2R = vec3(1.0, 0.956, 0.621);
|
||||
const vec3 YIQ2G = vec3(1.0, -0.272, -0.647);
|
||||
const vec3 YIQ2B = vec3(1.0, -1.106, 1.703);
|
||||
const vec4 MinC = vec4(-1.1183);
|
||||
const vec4 CRange = vec4(3.2366);
|
||||
const float Pi2Length = Pi2 / 83.0;
|
||||
const vec4 NotchOffset = vec4(0.0, 1.0, 2.0, 3.0);
|
||||
const vec4 W = vec4(Pi2 * CCFrequency * ScanTime);
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
vec4 YAccum = Zero;
|
||||
vec4 IAccum = Zero;
|
||||
vec4 QAccum = Zero;
|
||||
float QuadXSize = InSize.x * 4.0;
|
||||
float TimePerSample = ScanTime / QuadXSize;
|
||||
|
||||
// Frequency cutoffs for the individual portions of the signal that we extract.
|
||||
// Y1 and Y2 are the positive and negative frequency limits of the notch filter on Y.
|
||||
// Y3 is the center of the frequency response of the Y filter.
|
||||
// I is the center of the frequency response of the I filter.
|
||||
// Q is the center of the frequency response of the Q filter.
|
||||
float Fc_y1 = NotchLowerFrequency * TimePerSample;
|
||||
float Fc_y2 = NotchUpperFrequency * TimePerSample;
|
||||
float Fc_y3 = YFrequency * TimePerSample;
|
||||
float Fc_i = IFrequency * TimePerSample;
|
||||
float Fc_q = QFrequency * TimePerSample;
|
||||
float Pi2Fc_y1 = Fc_y1 * Pi2;
|
||||
float Pi2Fc_y2 = Fc_y2 * Pi2;
|
||||
float Pi2Fc_y3 = Fc_y3 * Pi2;
|
||||
float Pi2Fc_i = Fc_i * Pi2;
|
||||
float Pi2Fc_q = Fc_q * Pi2;
|
||||
float Fc_y1_2 = Fc_y1 * 2.0;
|
||||
float Fc_y2_2 = Fc_y2 * 2.0;
|
||||
float Fc_y3_2 = Fc_y3 * 2.0;
|
||||
float Fc_i_2 = Fc_i * 2.0;
|
||||
float Fc_q_2 = Fc_q * 2.0;
|
||||
vec4 CoordY = vec4(texCoord.y);
|
||||
|
||||
vec4 BaseTexel = texture(DiffuseSampler, texCoord);
|
||||
// 83 composite samples wide, 4 composite pixels per texel
|
||||
for (float n = -41.0; n < 42.0; n += 4.0)
|
||||
{
|
||||
vec4 n4 = n + NotchOffset;
|
||||
vec4 CoordX = texCoord.x + oneTexel.x * n4 * 0.25;
|
||||
vec2 TexCoord = vec2(CoordX.x, CoordY.y);
|
||||
vec4 C = texture(DiffuseSampler, TexCoord) * CRange + MinC;
|
||||
vec4 WT = W * (CoordX + A2 * CoordY * InSize.y + B);
|
||||
vec4 Cosine = 0.54 + 0.46 * cos(Pi2Length * n4);
|
||||
|
||||
vec4 SincYIn1 = Pi2Fc_y1 * n4;
|
||||
vec4 SincYIn2 = Pi2Fc_y2 * n4;
|
||||
vec4 SincYIn3 = Pi2Fc_y3 * n4;
|
||||
vec4 SincY1 = sin(SincYIn1) / SincYIn1;
|
||||
vec4 SincY2 = sin(SincYIn2) / SincYIn2;
|
||||
vec4 SincY3 = sin(SincYIn3) / SincYIn3;
|
||||
|
||||
// These zero-checks could be made more efficient, but we are trying to support
|
||||
// downlevel GLSL
|
||||
if(SincYIn1.x == 0.0) SincY1.x = 1.0;
|
||||
if(SincYIn1.y == 0.0) SincY1.y = 1.0;
|
||||
if(SincYIn1.z == 0.0) SincY1.z = 1.0;
|
||||
if(SincYIn1.w == 0.0) SincY1.w = 1.0;
|
||||
if(SincYIn2.x == 0.0) SincY2.x = 1.0;
|
||||
if(SincYIn2.y == 0.0) SincY2.y = 1.0;
|
||||
if(SincYIn2.z == 0.0) SincY2.z = 1.0;
|
||||
if(SincYIn2.w == 0.0) SincY2.w = 1.0;
|
||||
if(SincYIn3.x == 0.0) SincY3.x = 1.0;
|
||||
if(SincYIn3.y == 0.0) SincY3.y = 1.0;
|
||||
if(SincYIn3.z == 0.0) SincY3.z = 1.0;
|
||||
if(SincYIn3.w == 0.0) SincY3.w = 1.0;
|
||||
vec4 IdealY = (Fc_y1_2 * SincY1 - Fc_y2_2 * SincY2) + Fc_y3_2 * SincY3;
|
||||
vec4 FilterY = Cosine * IdealY;
|
||||
|
||||
vec4 SincIIn = Pi2Fc_i * n4;
|
||||
vec4 SincI = sin(SincIIn) / SincIIn;
|
||||
if(SincIIn.x == 0.0) SincI.x = 1.0;
|
||||
if(SincIIn.y == 0.0) SincI.y = 1.0;
|
||||
if(SincIIn.z == 0.0) SincI.z = 1.0;
|
||||
if(SincIIn.w == 0.0) SincI.w = 1.0;
|
||||
vec4 IdealI = Fc_i_2 * SincI;
|
||||
vec4 FilterI = Cosine * IdealI;
|
||||
|
||||
vec4 SincQIn = Pi2Fc_q * n4;
|
||||
vec4 SincQ = sin(SincQIn) / SincQIn;
|
||||
if(SincQIn.x == 0.0) SincQ.x = 1.0;
|
||||
if(SincQIn.y == 0.0) SincQ.y = 1.0;
|
||||
if(SincQIn.z == 0.0) SincQ.z = 1.0;
|
||||
if(SincQIn.w == 0.0) SincQ.w = 1.0;
|
||||
vec4 IdealQ = Fc_q_2 * SincQ;
|
||||
vec4 FilterQ = Cosine * IdealQ;
|
||||
|
||||
YAccum += C * FilterY;
|
||||
IAccum += C * cos(WT) * FilterI;
|
||||
QAccum += C * sin(WT) * FilterQ;
|
||||
}
|
||||
|
||||
float Y = dot(YAccum, One);
|
||||
float I = dot(IAccum, One) * 2.0;
|
||||
float Q = dot(QAccum, One) * 2.0;
|
||||
|
||||
vec3 YIQ = vec3(Y, I, Q);
|
||||
vec3 OutRGB = vec3(dot(YIQ, YIQ2R), dot(YIQ, YIQ2G), dot(YIQ, YIQ2B));
|
||||
|
||||
fragColor = vec4(OutRGB, 1.0);
|
||||
}
|
||||
19
assets/minecraft/shaders/program/ntsc_decode.json
Normal file
19
assets/minecraft/shaders/program/ntsc_decode.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"blend": {
|
||||
"func": "add",
|
||||
"srcrgb": "one",
|
||||
"dstrgb": "zero"
|
||||
},
|
||||
"vertex": "sobel",
|
||||
"fragment": "ntsc_decode",
|
||||
"attributes": [ "Position" ],
|
||||
"samplers": [
|
||||
{ "name": "DiffuseSampler" },
|
||||
{ "name": "BaseSampler" }
|
||||
],
|
||||
"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 ] }
|
||||
]
|
||||
}
|
||||
52
assets/minecraft/shaders/program/ntsc_encode.fsh
Normal file
52
assets/minecraft/shaders/program/ntsc_encode.fsh
Normal file
@@ -0,0 +1,52 @@
|
||||
#version 150
|
||||
|
||||
uniform sampler2D DiffuseSampler;
|
||||
|
||||
in vec2 texCoord;
|
||||
in vec2 oneTexel;
|
||||
|
||||
uniform vec2 InSize;
|
||||
|
||||
const float Pi2 = 6.283185307;
|
||||
|
||||
const vec4 A2 = vec4(1.0);
|
||||
const vec4 B = vec4(0.5);
|
||||
const float P = 1.0;
|
||||
const float CCFrequency = 3.59754545;
|
||||
const float ScanTime = 52.6;
|
||||
const float Pi2ScanTime = Pi2 * ScanTime;
|
||||
const vec4 YTransform = vec4(0.299, 0.587, 0.114, 0.0);
|
||||
const vec4 ITransform = vec4(0.595716, -0.274453, -0.321263, 0.0);
|
||||
const vec4 QTransform = vec4(0.211456, -0.522591, 0.31135, 0.0);
|
||||
const vec4 MinC = vec4(-1.1183);
|
||||
const vec4 InvCRange = vec4(1.0 / 3.2366);
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
vec2 InverseP = vec2(P, 0.0) * oneTexel;
|
||||
|
||||
// UVs for four linearly-interpolated samples spread 0.25 texels apart
|
||||
vec2 C0 = texCoord;
|
||||
vec2 C1 = texCoord + InverseP * 0.25;
|
||||
vec2 C2 = texCoord + InverseP * 0.50;
|
||||
vec2 C3 = texCoord + InverseP * 0.75;
|
||||
vec4 Cx = vec4(C0.x, C1.x, C2.x, C3.x);
|
||||
vec4 Cy = vec4(C0.y, C1.y, C2.y, C3.y);
|
||||
|
||||
vec4 Texel0 = texture(DiffuseSampler, C0);
|
||||
vec4 Texel1 = texture(DiffuseSampler, C1);
|
||||
vec4 Texel2 = texture(DiffuseSampler, C2);
|
||||
vec4 Texel3 = texture(DiffuseSampler, C3);
|
||||
|
||||
// Calculate the expected time of the sample.
|
||||
vec4 T = A2 * Cy * vec4(InSize.y) + B + Cx;
|
||||
vec4 W = vec4(Pi2ScanTime * CCFrequency);
|
||||
vec4 TW = T * W;
|
||||
vec4 Y = vec4(dot(Texel0, YTransform), dot(Texel1, YTransform), dot(Texel2, YTransform), dot(Texel3, YTransform));
|
||||
vec4 I = vec4(dot(Texel0, ITransform), dot(Texel1, ITransform), dot(Texel2, ITransform), dot(Texel3, ITransform));
|
||||
vec4 Q = vec4(dot(Texel0, QTransform), dot(Texel1, QTransform), dot(Texel2, QTransform), dot(Texel3, QTransform));
|
||||
|
||||
vec4 Encoded = Y + I * cos(TW) + Q * sin(TW);
|
||||
fragColor = (Encoded - MinC) * InvCRange;
|
||||
}
|
||||
18
assets/minecraft/shaders/program/ntsc_encode.json
Normal file
18
assets/minecraft/shaders/program/ntsc_encode.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"blend": {
|
||||
"func": "add",
|
||||
"srcrgb": "one",
|
||||
"dstrgb": "zero"
|
||||
},
|
||||
"vertex": "sobel",
|
||||
"fragment": "ntsc_encode",
|
||||
"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 ] }
|
||||
]
|
||||
}
|
||||
23
assets/minecraft/shaders/program/outline.fsh
Normal file
23
assets/minecraft/shaders/program/outline.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 up = texture(DiffuseSampler, texCoord + vec2( 0.0, -oneTexel.y));
|
||||
vec4 down = texture(DiffuseSampler, texCoord + vec2( oneTexel.x, 0.0));
|
||||
vec4 left = texture(DiffuseSampler, texCoord + vec2(-oneTexel.x, 0.0));
|
||||
vec4 right = texture(DiffuseSampler, texCoord + vec2( 0.0, oneTexel.y));
|
||||
vec4 uDiff = center - up;
|
||||
vec4 dDiff = center - down;
|
||||
vec4 lDiff = center - left;
|
||||
vec4 rDiff = center - right;
|
||||
vec4 sum = uDiff + dDiff + lDiff + rDiff;
|
||||
vec3 clamped = clamp(center.rgb - sum.rgb, 0.0, 1.0);
|
||||
fragColor = vec4(clamped, 1.0);
|
||||
}
|
||||
18
assets/minecraft/shaders/program/outline.json
Normal file
18
assets/minecraft/shaders/program/outline.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"blend": {
|
||||
"func": "add",
|
||||
"srcrgb": "one",
|
||||
"dstrgb": "zero"
|
||||
},
|
||||
"vertex": "sobel",
|
||||
"fragment": "outline",
|
||||
"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 ] }
|
||||
]
|
||||
}
|
||||
15
assets/minecraft/shaders/program/outline_combine.fsh
Normal file
15
assets/minecraft/shaders/program/outline_combine.fsh
Normal file
@@ -0,0 +1,15 @@
|
||||
#version 150
|
||||
|
||||
uniform sampler2D DiffuseSampler;
|
||||
uniform sampler2D OutlineSampler;
|
||||
|
||||
in vec2 texCoord;
|
||||
in vec2 oneTexel;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main(){
|
||||
vec4 diffuseTexel = texture(DiffuseSampler, texCoord);
|
||||
vec4 outlineTexel = texture(OutlineSampler, texCoord);
|
||||
fragColor = vec4(diffuseTexel.rgb + diffuseTexel.rgb * outlineTexel.rgb * vec3(0.75), 1.0);
|
||||
}
|
||||
19
assets/minecraft/shaders/program/outline_combine.json
Normal file
19
assets/minecraft/shaders/program/outline_combine.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"blend": {
|
||||
"func": "add",
|
||||
"srcrgb": "one",
|
||||
"dstrgb": "zero"
|
||||
},
|
||||
"vertex": "sobel",
|
||||
"fragment": "outline_combine",
|
||||
"attributes": [ "Position" ],
|
||||
"samplers": [
|
||||
{ "name": "DiffuseSampler" },
|
||||
{ "name": "OutlineSampler" }
|
||||
],
|
||||
"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 ] }
|
||||
]
|
||||
}
|
||||
48
assets/minecraft/shaders/program/outline_soft.fsh
Normal file
48
assets/minecraft/shaders/program/outline_soft.fsh
Normal file
@@ -0,0 +1,48 @@
|
||||
#version 150
|
||||
|
||||
uniform sampler2D DiffuseSampler;
|
||||
|
||||
in vec2 texCoord;
|
||||
in vec2 oneTexel;
|
||||
|
||||
uniform float LumaRamp;
|
||||
uniform float LumaLevel;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main(){
|
||||
vec4 center = texture(DiffuseSampler, texCoord);
|
||||
vec4 up = texture(DiffuseSampler, texCoord + vec2( 0.0, -oneTexel.y));
|
||||
vec4 up2 = texture(DiffuseSampler, texCoord + vec2( 0.0, -oneTexel.y) * 2.0);
|
||||
vec4 down = texture(DiffuseSampler, texCoord + vec2( oneTexel.x, 0.0));
|
||||
vec4 down2 = texture(DiffuseSampler, texCoord + vec2( oneTexel.x, 0.0) * 2.0);
|
||||
vec4 left = texture(DiffuseSampler, texCoord + vec2(-oneTexel.x, 0.0));
|
||||
vec4 left2 = texture(DiffuseSampler, texCoord + vec2(-oneTexel.x, 0.0) * 2.0);
|
||||
vec4 right = texture(DiffuseSampler, texCoord + vec2( 0.0, oneTexel.y));
|
||||
vec4 right2 = texture(DiffuseSampler, texCoord + vec2( 0.0, oneTexel.y) * 2.0);
|
||||
vec4 uDiff = abs(center - up);
|
||||
vec4 dDiff = abs(center - down);
|
||||
vec4 lDiff = abs(center - left);
|
||||
vec4 rDiff = abs(center - right);
|
||||
vec4 u2Diff = abs(center - up2);
|
||||
vec4 d2Diff = abs(center - down2);
|
||||
vec4 l2Diff = abs(center - left2);
|
||||
vec4 r2Diff = abs(center - right2);
|
||||
vec4 sum = uDiff + dDiff + lDiff + rDiff + u2Diff + d2Diff + l2Diff + r2Diff;
|
||||
vec4 gray = vec4(0.3, 0.59, 0.11, 0.0);
|
||||
float sumLuma = 1.0 - dot(clamp(sum, 0.0, 1.0), gray);
|
||||
|
||||
// Get luminance of center pixel and adjust
|
||||
float centerLuma = dot(center + (center - pow(center, vec4(LumaRamp))), gray);
|
||||
|
||||
// Quantize the luma value
|
||||
centerLuma = centerLuma - fract(centerLuma * LumaLevel) / LumaLevel;
|
||||
|
||||
// Re-scale to full range
|
||||
centerLuma = centerLuma * (LumaLevel / (LumaLevel - 1.0));
|
||||
|
||||
// Blend with outline
|
||||
centerLuma = centerLuma * sumLuma;
|
||||
|
||||
fragColor = vec4(centerLuma, centerLuma, centerLuma, 1.0);
|
||||
}
|
||||
20
assets/minecraft/shaders/program/outline_soft.json
Normal file
20
assets/minecraft/shaders/program/outline_soft.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"blend": {
|
||||
"func": "add",
|
||||
"srcrgb": "one",
|
||||
"dstrgb": "zero"
|
||||
},
|
||||
"vertex": "sobel",
|
||||
"fragment": "outline_soft",
|
||||
"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": "LumaRamp", "type": "float", "count": 1, "values": [ 16.0 ] },
|
||||
{ "name": "LumaLevel", "type": "float", "count": 1, "values": [ 4.0 ] }
|
||||
]
|
||||
}
|
||||
43
assets/minecraft/shaders/program/outline_watercolor.fsh
Normal file
43
assets/minecraft/shaders/program/outline_watercolor.fsh
Normal file
@@ -0,0 +1,43 @@
|
||||
#version 150
|
||||
|
||||
uniform sampler2D DiffuseSampler;
|
||||
|
||||
in vec2 texCoord;
|
||||
in vec2 oneTexel;
|
||||
|
||||
uniform float LumaRamp;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main(){
|
||||
vec4 center = texture(DiffuseSampler, texCoord);
|
||||
vec4 up = texture(DiffuseSampler, texCoord + vec2( 0.0, -oneTexel.y));
|
||||
vec4 up2 = texture(DiffuseSampler, texCoord + vec2( 0.0, -oneTexel.y) * 2.0);
|
||||
vec4 down = texture(DiffuseSampler, texCoord + vec2( oneTexel.x, 0.0));
|
||||
vec4 down2 = texture(DiffuseSampler, texCoord + vec2( oneTexel.x, 0.0) * 2.0);
|
||||
vec4 left = texture(DiffuseSampler, texCoord + vec2(-oneTexel.x, 0.0));
|
||||
vec4 left2 = texture(DiffuseSampler, texCoord + vec2(-oneTexel.x, 0.0) * 2.0);
|
||||
vec4 right = texture(DiffuseSampler, texCoord + vec2( 0.0, oneTexel.y));
|
||||
vec4 right2 = texture(DiffuseSampler, texCoord + vec2( 0.0, oneTexel.y) * 2.0);
|
||||
vec4 ul = texture(DiffuseSampler, texCoord + vec2(-oneTexel.x, -oneTexel.y));
|
||||
vec4 ur = texture(DiffuseSampler, texCoord + vec2( oneTexel.x, -oneTexel.y));
|
||||
vec4 bl = texture(DiffuseSampler, texCoord + vec2(-oneTexel.x, oneTexel.y));
|
||||
vec4 br = texture(DiffuseSampler, texCoord + vec2( oneTexel.x, oneTexel.y));
|
||||
vec4 gray = vec4(0.3, 0.59, 0.11, 0.0);
|
||||
float uDiff = dot(abs(center - up), gray);
|
||||
float dDiff = dot(abs(center - down), gray);
|
||||
float lDiff = dot(abs(center - left), gray);
|
||||
float rDiff = dot(abs(center - right), gray);
|
||||
float u2Diff = dot(abs(center - up2), gray);
|
||||
float d2Diff = dot(abs(center - down2), gray);
|
||||
float l2Diff = dot(abs(center - left2), gray);
|
||||
float r2Diff = dot(abs(center - right2), gray);
|
||||
float ulDiff = dot(abs(center - ul), gray);
|
||||
float urDiff = dot(abs(center - ur), gray);
|
||||
float blDiff = dot(abs(center - bl), gray);
|
||||
float brDiff = dot(abs(center - br), gray);
|
||||
float sum = uDiff + dDiff + lDiff + rDiff + u2Diff + d2Diff + l2Diff + r2Diff + ulDiff + urDiff + blDiff + brDiff;
|
||||
float sumLuma = clamp(sum, 0.0, 1.0);
|
||||
|
||||
fragColor = vec4(sumLuma, sumLuma, sumLuma, 1.0);
|
||||
}
|
||||
19
assets/minecraft/shaders/program/outline_watercolor.json
Normal file
19
assets/minecraft/shaders/program/outline_watercolor.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"blend": {
|
||||
"func": "add",
|
||||
"srcrgb": "one",
|
||||
"dstrgb": "zero"
|
||||
},
|
||||
"vertex": "sobel",
|
||||
"fragment": "outline_watercolor",
|
||||
"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": "LumaRamp", "type": "float", "count": 1, "values": [ 16.0 ] }
|
||||
]
|
||||
}
|
||||
29
assets/minecraft/shaders/program/overlay.fsh
Normal file
29
assets/minecraft/shaders/program/overlay.fsh
Normal file
@@ -0,0 +1,29 @@
|
||||
#version 150
|
||||
|
||||
uniform sampler2D DiffuseSampler;
|
||||
uniform sampler2D OverlaySampler;
|
||||
|
||||
uniform vec2 InSize;
|
||||
|
||||
in vec2 texCoord;
|
||||
|
||||
uniform float MosaicSize;
|
||||
uniform vec3 RedMatrix;
|
||||
uniform vec3 GreenMatrix;
|
||||
uniform vec3 BlueMatrix;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main(){
|
||||
vec2 mosaicInSize = InSize / MosaicSize;
|
||||
vec2 fractPix = fract(texCoord * mosaicInSize) / mosaicInSize;
|
||||
|
||||
vec4 baseTexel = texture(DiffuseSampler, texCoord - fractPix);
|
||||
float red = dot(baseTexel.rgb, RedMatrix);
|
||||
float green = dot(baseTexel.rgb, GreenMatrix);
|
||||
float blue = dot(baseTexel.rgb, BlueMatrix);
|
||||
|
||||
vec4 overlayTexel = texture(OverlaySampler, vec2(texCoord.x, 1.0 - texCoord.y));
|
||||
overlayTexel.a = 1.0;
|
||||
fragColor = mix(vec4(red, green, blue, 1.0), overlayTexel, overlayTexel.a);
|
||||
}
|
||||
23
assets/minecraft/shaders/program/overlay.json
Normal file
23
assets/minecraft/shaders/program/overlay.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"blend": {
|
||||
"func": "add",
|
||||
"srcrgb": "one",
|
||||
"dstrgb": "zero"
|
||||
},
|
||||
"vertex": "blit",
|
||||
"fragment": "overlay",
|
||||
"attributes": [ "Position" ],
|
||||
"samplers": [
|
||||
{ "name": "OverlaySampler" },
|
||||
{ "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": "MosaicSize", "type": "float", "count": 1, "values": [ 1.0 ] },
|
||||
{ "name": "RedMatrix", "type": "float", "count": 3, "values": [ 1.0, 0.0, 0.0 ] },
|
||||
{ "name": "GreenMatrix", "type": "float", "count": 3, "values": [ 0.0, 1.0, 1.0 ] },
|
||||
{ "name": "BlueMatrix", "type": "float", "count": 3, "values": [ 0.0, 0.0, 1.0 ] }
|
||||
]
|
||||
}
|
||||
20
assets/minecraft/shaders/program/phosphor.fsh
Normal file
20
assets/minecraft/shaders/program/phosphor.fsh
Normal file
@@ -0,0 +1,20 @@
|
||||
#version 150
|
||||
|
||||
uniform sampler2D DiffuseSampler;
|
||||
uniform sampler2D PrevSampler;
|
||||
|
||||
in vec2 texCoord;
|
||||
in vec2 oneTexel;
|
||||
|
||||
uniform vec2 InSize;
|
||||
|
||||
uniform vec3 Phosphor;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
vec4 CurrTexel = texture(DiffuseSampler, texCoord);
|
||||
vec4 PrevTexel = texture(PrevSampler, texCoord);
|
||||
|
||||
fragColor = vec4(max(PrevTexel.rgb * Phosphor, CurrTexel.rgb), 1.0);
|
||||
}
|
||||
20
assets/minecraft/shaders/program/phosphor.json
Normal file
20
assets/minecraft/shaders/program/phosphor.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"blend": {
|
||||
"func": "add",
|
||||
"srcrgb": "one",
|
||||
"dstrgb": "zero"
|
||||
},
|
||||
"vertex": "sobel",
|
||||
"fragment": "phosphor",
|
||||
"attributes": [ "Position" ],
|
||||
"samplers": [
|
||||
{ "name": "DiffuseSampler" },
|
||||
{ "name": "PrevSampler" }
|
||||
],
|
||||
"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": "Phosphor", "type": "float", "count": 3, "values": [ 0.3, 0.3, 0.3 ] }
|
||||
]
|
||||
}
|
||||
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;
|
||||
}
|
||||
66
assets/minecraft/shaders/program/scan_pincushion.fsh
Normal file
66
assets/minecraft/shaders/program/scan_pincushion.fsh
Normal file
@@ -0,0 +1,66 @@
|
||||
#version 150
|
||||
|
||||
uniform sampler2D DiffuseSampler;
|
||||
|
||||
in vec2 texCoord;
|
||||
in vec2 oneTexel;
|
||||
|
||||
uniform vec2 InSize;
|
||||
|
||||
const vec4 Zero = vec4(0.0);
|
||||
const vec4 Half = vec4(0.5);
|
||||
const vec4 One = vec4(1.0);
|
||||
const vec4 Two = vec4(2.0);
|
||||
|
||||
const float Pi = 3.1415926535;
|
||||
const float PincushionAmount = 0.02;
|
||||
const float CurvatureAmount = 0.02;
|
||||
const float ScanlineAmount = 0.8;
|
||||
const float ScanlineScale = 1.0;
|
||||
const float ScanlineHeight = 1.0;
|
||||
const float ScanlineBrightScale = 1.0;
|
||||
const float ScanlineBrightOffset = 0.0;
|
||||
const float ScanlineOffset = 0.0;
|
||||
const vec3 Floor = vec3(0.05, 0.05, 0.05);
|
||||
const vec3 Power = vec3(0.8, 0.8, 0.8);
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
vec4 InTexel = texture(DiffuseSampler, texCoord);
|
||||
|
||||
vec2 PinUnitCoord = texCoord * Two.xy - One.xy;
|
||||
float PincushionR2 = pow(length(PinUnitCoord), 2.0);
|
||||
vec2 PincushionCurve = PinUnitCoord * PincushionAmount * PincushionR2;
|
||||
vec2 ScanCoord = texCoord;
|
||||
|
||||
ScanCoord *= One.xy - PincushionAmount * 0.2;
|
||||
ScanCoord += PincushionAmount * 0.1;
|
||||
ScanCoord += PincushionCurve;
|
||||
|
||||
vec2 CurvatureClipCurve = PinUnitCoord * CurvatureAmount * PincushionR2;
|
||||
vec2 ScreenClipCoord = texCoord;
|
||||
ScreenClipCoord -= Half.xy;
|
||||
ScreenClipCoord *= One.xy - CurvatureAmount * 0.2;
|
||||
ScreenClipCoord += Half.xy;
|
||||
ScreenClipCoord += CurvatureClipCurve;
|
||||
|
||||
// -- Alpha Clipping --
|
||||
if (ScanCoord.x < 0.0) discard;
|
||||
if (ScanCoord.y < 0.0) discard;
|
||||
if (ScanCoord.x > 1.0) discard;
|
||||
if (ScanCoord.y > 1.0) discard;
|
||||
|
||||
// -- Scanline Simulation --
|
||||
float InnerSine = ScanCoord.y * InSize.y * ScanlineScale * 0.25;
|
||||
float ScanBrightMod = sin(InnerSine * Pi + ScanlineOffset * InSize.y * 0.25);
|
||||
float ScanBrightness = mix(1.0, (pow(ScanBrightMod * ScanBrightMod, ScanlineHeight) * ScanlineBrightScale + 1.0) * 0.5, ScanlineAmount);
|
||||
vec3 ScanlineTexel = InTexel.rgb * ScanBrightness;
|
||||
|
||||
// -- Color Compression (increasing the floor of the signal without affecting the ceiling) --
|
||||
ScanlineTexel = Floor + (One.xyz - Floor) * ScanlineTexel;
|
||||
|
||||
ScanlineTexel.rgb = pow(ScanlineTexel.rgb, Power);
|
||||
|
||||
fragColor = vec4(ScanlineTexel.rgb, 1.0);
|
||||
}
|
||||
18
assets/minecraft/shaders/program/scan_pincushion.json
Normal file
18
assets/minecraft/shaders/program/scan_pincushion.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"blend": {
|
||||
"func": "add",
|
||||
"srcrgb": "one",
|
||||
"dstrgb": "zero"
|
||||
},
|
||||
"vertex": "sobel",
|
||||
"fragment": "scan_pincushion",
|
||||
"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 ] }
|
||||
]
|
||||
}
|
||||
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;
|
||||
}
|
||||
22
assets/minecraft/shaders/program/sobel.fsh
Normal file
22
assets/minecraft/shaders/program/sobel.fsh
Normal file
@@ -0,0 +1,22 @@
|
||||
#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));
|
||||
vec4 leftDiff = center - left;
|
||||
vec4 rightDiff = center - right;
|
||||
vec4 upDiff = center - up;
|
||||
vec4 downDiff = center - down;
|
||||
vec4 total = clamp(leftDiff + rightDiff + upDiff + downDiff, 0.0, 1.0);
|
||||
fragColor = vec4(total.rgb, 1.0);
|
||||
}
|
||||
18
assets/minecraft/shaders/program/sobel.json
Normal file
18
assets/minecraft/shaders/program/sobel.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"blend": {
|
||||
"func": "add",
|
||||
"srcrgb": "one",
|
||||
"dstrgb": "zero"
|
||||
},
|
||||
"vertex": "sobel",
|
||||
"fragment": "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 ] }
|
||||
]
|
||||
}
|
||||
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 ] }
|
||||
]
|
||||
}
|
||||
60
assets/minecraft/shaders/program/wobble.fsh
Normal file
60
assets/minecraft/shaders/program/wobble.fsh
Normal file
@@ -0,0 +1,60 @@
|
||||
#version 150
|
||||
|
||||
uniform sampler2D DiffuseSampler;
|
||||
|
||||
in vec2 texCoord;
|
||||
in vec2 oneTexel;
|
||||
|
||||
uniform vec2 InSize;
|
||||
|
||||
uniform float Time;
|
||||
uniform vec2 Frequency;
|
||||
uniform vec2 WobbleAmount;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
vec3 hue(float h)
|
||||
{
|
||||
float r = abs(h * 6.0 - 3.0) - 1.0;
|
||||
float g = 2.0 - abs(h * 6.0 - 2.0);
|
||||
float b = 2.0 - abs(h * 6.0 - 4.0);
|
||||
return clamp(vec3(r,g,b), 0.0, 1.0);
|
||||
}
|
||||
|
||||
vec3 HSVtoRGB(vec3 hsv) {
|
||||
return ((hue(hsv.x) - 1.0) * hsv.y + 1.0) * hsv.z;
|
||||
}
|
||||
|
||||
vec3 RGBtoHSV(vec3 rgb) {
|
||||
vec3 hsv = vec3(0.0);
|
||||
hsv.z = max(rgb.r, max(rgb.g, rgb.b));
|
||||
float min = min(rgb.r, min(rgb.g, rgb.b));
|
||||
float c = hsv.z - min;
|
||||
|
||||
if (c != 0.0)
|
||||
{
|
||||
hsv.y = c / hsv.z;
|
||||
vec3 delta = (hsv.z - rgb) / c;
|
||||
delta.rgb -= delta.brg;
|
||||
delta.rg += vec2(2.0, 4.0);
|
||||
if (rgb.r >= hsv.z) {
|
||||
hsv.x = delta.b;
|
||||
} else if (rgb.g >= hsv.z) {
|
||||
hsv.x = delta.r;
|
||||
} else {
|
||||
hsv.x = delta.g;
|
||||
}
|
||||
hsv.x = fract(hsv.x / 6.0);
|
||||
}
|
||||
return hsv;
|
||||
}
|
||||
|
||||
void main() {
|
||||
float xOffset = sin(texCoord.y * Frequency.x + Time * 3.1415926535 * 2.0) * WobbleAmount.x;
|
||||
float yOffset = cos(texCoord.x * Frequency.y + Time * 3.1415926535 * 2.0) * WobbleAmount.y;
|
||||
vec2 offset = vec2(xOffset, yOffset);
|
||||
vec4 rgb = texture(DiffuseSampler, texCoord + offset);
|
||||
vec3 hsv = RGBtoHSV(rgb.rgb);
|
||||
hsv.x = fract(hsv.x + Time);
|
||||
fragColor = vec4(HSVtoRGB(hsv), 1.0);
|
||||
}
|
||||
21
assets/minecraft/shaders/program/wobble.json
Normal file
21
assets/minecraft/shaders/program/wobble.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"blend": {
|
||||
"func": "add",
|
||||
"srcrgb": "one",
|
||||
"dstrgb": "zero"
|
||||
},
|
||||
"vertex": "sobel",
|
||||
"fragment": "wobble",
|
||||
"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": "Time", "type": "float", "count": 1, "values": [ 0.0 ] },
|
||||
{ "name": "Frequency", "type": "float", "count": 2, "values": [ 512.0, 288.0 ] },
|
||||
{ "name": "WobbleAmount", "type": "float", "count": 2, "values": [ 0.002, 0.002 ] }
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user