Commit f9686ec0 authored by hunterk's avatar hunterk
Browse files

update crt-guest-dr-venom

parent 9636b305
#version 130
/*
Average Luminance Shader, Smart Smoothing Difference Shader
Average Luminance Shader
Copyright (C) 2018-2019 guest(r) - guest.r@gmail.com
Copyright (C) 2018-2020 guest(r) - guest.r@gmail.com
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
......@@ -23,8 +23,6 @@
// Parameter lines go here:
#pragma parameter STH "Smart Smoothing Threshold" 0.7 0.4 1.2 0.05
#if defined(VERTEX)
#if __VERSION__ >= 130
......@@ -105,21 +103,15 @@ COMPAT_VARYING vec4 TEX0;
#ifdef PARAMETER_UNIFORM
// All parameter floats need to have COMPAT_PRECISION in front of them
uniform COMPAT_PRECISION float STH;
#else
#define STH 0.7
#endif
float df (vec3 A, vec3 B)
{
float diff = length(A-B);
float luma = clamp(length(0.5*min(A,B) + 0.25*(A+B) + 1e-8), 0.0001, 1.0);
float diff1 = diff/luma;
return 1.0 - clamp(7.0*(max(1.5*diff,diff1)-STH), 0.0, 1.0);
}
#endif
void main()
{
if (vTexCoord.x > 0.1 || vTexCoord.y > 0.1) discard;
float xtotal = floor(InputSize.x/64.0);
float ytotal = floor(InputSize.y/64.0);
......@@ -133,28 +125,12 @@ void main()
{
for (float j = 0.0; j <= ytotal; j++)
{
ltotal+= max(0.25, length(textureLod(Source, i*dx + j*dy + offset, 6.0).rgb));
ltotal+= max(0.15, length(textureLod(Source, i*dx + j*dy + offset, 6.0).rgb));
}
}
ltotal = 0.577350269 * ltotal / ((xtotal+1.0)*(ytotal+1.0));
dx = vec2(SourceSize.z, 0.0);
dy = vec2(0.0, SourceSize.w);
vec3 l1 = COMPAT_TEXTURE(PassPrev2Texture, TEX0.xy -dx).xyz;
vec3 ct = COMPAT_TEXTURE(PassPrev2Texture, TEX0.xy ).xyz;
vec3 r1 = COMPAT_TEXTURE(PassPrev2Texture, TEX0.xy +dx).xyz;
vec3 t1 = COMPAT_TEXTURE(PassPrev2Texture, TEX0.xy -dy).xyz;
vec3 b1 = COMPAT_TEXTURE(PassPrev2Texture, TEX0.xy +dy).xyz;
float dl = df(ct, l1);
float dr = df(ct, r1);
float dt = df(ct, t1);
float db = df(ct, b1);
float resx = dl; float resy = dr; float resz = floor(9.0*dt)/10.0 + floor(9.0*db)/100.0;
FragColor = vec4(resx,resy,resz,pow(ltotal, 0.65));
FragColor = vec4(pow(ltotal, 0.65));
}
#endif
......@@ -160,7 +160,7 @@ mat3(
const mat3 ToDCI =
mat3(
2.725394, -0.795168, 0.041242,
-1.018003, 1.689732, 0.022647,
-1.018003, 1.689732, -0.087639,
-0.440163, 0.022647, 1.100929
);
......
/*
CRT - Guest - Dr. Venom
Copyright (C) 2018-2019 guest(r) - guest.r@gmail.com
Copyright (C) 2018-2020 guest(r) - guest.r@gmail.com
Incorporates many good ideas and suggestions from Dr. Venom.
......@@ -26,17 +26,17 @@
#pragma parameter IOS "Smart Integer Scaling: 1.0:Y, 2.0:'X'+Y" 0.0 0.0 2.0 1.0
#pragma parameter OS "R. Bloom Overscan Mode" 1.0 0.0 2.0 1.0
#pragma parameter BLOOM "Raster bloom %" 0.0 0.0 20.0 1.0
#pragma parameter brightboost "Bright Boost Dark Pixels" 1.40 0.50 2.00 0.025
#pragma parameter brightboost1 "Bright Boost Bright Pixels" 1.15 0.50 2.00 0.025
#pragma parameter brightboost "Bright Boost Dark Pixels" 1.40 0.50 4.00 0.025
#pragma parameter brightboost1 "Bright Boost Bright Pixels" 1.10 0.50 3.00 0.025
#pragma parameter gsl "Scanline Type" 0.0 0.0 2.0 1.0
#pragma parameter scanline1 "Scanline beam shape low" 8.0 1.0 15.0 1.0
#pragma parameter scanline1 "Scanline beam shape low" 6.0 1.0 15.0 1.0
#pragma parameter scanline2 "Scanline beam shape high" 8.0 5.0 23.0 1.0
#pragma parameter beam_min "Scanline dark" 1.35 0.5 2.0 0.05
#pragma parameter beam_min "Scanline dark" 1.35 0.5 2.5 0.05
#pragma parameter beam_max "Scanline bright" 1.05 0.5 2.0 0.05
#pragma parameter beam_size "Increased bright scanline beam" 0.70 0.0 1.0 0.05
#pragma parameter spike "Scanline Spike Removal (0.0 - for speedup)" 1.25 0.0 2.0 0.25
#pragma parameter h_sharp "Horizontal sharpness" 5.25 1.5 20.0 0.25
#pragma parameter s_sharp "Substractive sharpness" 0.05 0.0 0.20 0.01
#pragma parameter spike "Scanline Spike Removal" 1.10 0.0 2.0 0.10
#pragma parameter h_sharp "Horizontal sharpness" 5.25 1.0 15.0 0.25
#pragma parameter s_sharp "Substractive sharpness" 0.40 0.0 1.0 0.10
#pragma parameter csize "Corner size" 0.0 0.0 0.07 0.01
#pragma parameter bsize "Border smoothness" 600.0 100.0 600.0 25.0
#pragma parameter warpX "CurvatureX (default 0.03)" 0.0 0.0 0.125 0.01
......@@ -48,11 +48,16 @@
#pragma parameter slotmask "Slot Mask Strength" 0.0 0.0 1.0 0.05
#pragma parameter slotwidth "Slot Mask Width" 2.0 2.0 6.0 0.5
#pragma parameter double_slot "Slot Mask Height: 2x1 or 4x1" 1.0 1.0 2.0 1.0
#pragma parameter mcut "Mask 5&6 cutoff" 0.2 0.0 0.5 0.05
#pragma parameter maskDark "Lottes maskDark" 0.5 0.0 2.0 0.05
#pragma parameter maskLight "Lottes maskLight" 1.5 0.0 2.0 0.05
#pragma parameter CGWG "CGWG Mask Str." 0.3 0.0 1.0 0.05
#pragma parameter slotms "Slot Mask Size" 1.0 1.0 2.0 1.0
#pragma parameter mcut "Mask 5-7 cutoff" 0.2 0.0 0.5 0.05
#pragma parameter maskDark "Lottes&Trinitron maskDark" 0.5 0.0 2.0 0.05
#pragma parameter maskLight "Lottes&Trinitron maskLight" 1.5 0.0 2.0 0.05
#pragma parameter CGWG "Mask 0&7 Mask Str." 0.3 0.0 1.0 0.05
#pragma parameter gamma_out "Gamma out" 2.4 1.0 3.5 0.05
#pragma parameter inter "Interlace Trigger Resolution :" 400.0 0.0 800.0 25.0
#pragma parameter interm "Interlace Mode (0.0 = OFF):" 1.0 0.0 3.0 1.0
#pragma parameter bloom "Bloom Strength" 0.0 0.0 2.0 0.10
#pragma parameter scans "Scanline 1&2 Saturation" 0.5 0.0 1.0 0.10
#if defined(VERTEX)
......@@ -164,11 +169,16 @@ uniform COMPAT_PRECISION float vertmask;
uniform COMPAT_PRECISION float slotmask;
uniform COMPAT_PRECISION float slotwidth;
uniform COMPAT_PRECISION float double_slot;
uniform COMPAT_PRECISION float slotms;
uniform COMPAT_PRECISION float mcut;
uniform COMPAT_PRECISION float maskDark;
uniform COMPAT_PRECISION float maskLight;
uniform COMPAT_PRECISION float CGWG;
uniform COMPAT_PRECISION float gamma_out;
uniform COMPAT_PRECISION float inter;
uniform COMPAT_PRECISION float interm;
uniform COMPAT_PRECISION float bloom;
uniform COMPAT_PRECISION float scans;
#else
#define TATE 0.00 // Screen orientation
#define IOS 0.00 // Smart Integer Scaling
......@@ -195,18 +205,23 @@ uniform COMPAT_PRECISION float gamma_out;
#define slotmask 0.00 // Slot Mask ON/OFF
#define slotwidth 2.00 // Slot Mask Width
#define double_slot 1.00 // Slot Mask Height
#define slotms 1.00 // Slot Mask Size
#define mcut 0.20 // Mask 5&6 cutoff
#define maskDark 0.50 // Dark "Phosphor"
#define maskLight 1.50 // Light "Phosphor"
#define CGWG 0.30 // CGWG Mask Strength
#define gamma_out 2.40 // output gamma
#define inter 400.00 // interlace resolution
#define interm 1.00 // interlace mode
#define bloom 0.00 // bloom effect
#define scans 0.50 // scanline saturation
#endif
#define eps 1e-10
float st(float x, float scanline)
float st(float x)
{
return exp2(-scanline*x*x);
return exp2(-10.0*x*x);
}
vec3 sw0(vec3 x, vec3 color, float scanline)
......@@ -223,16 +238,23 @@ vec3 sw1(vec3 x, vec3 color, float scanline)
vec3 tmp = mix(vec3(1.2*beam_min),vec3(beam_max), color);
vec3 ex = x*tmp;
float br = clamp(0.8*beam_min - 1.0, 0.2, 0.45);
return exp2(-scanline*ex*ex)/(1.0-br+br*color);
vec3 res = exp2(-scanline*ex*ex)/(1.0-br+br*mx);
mx = max(max(res.r,res.g),res.b);
float scans1 = scans; if (vertmask > 0.0) scans1=1.0;
return mix(vec3(mx), res, scans1);
}
vec3 sw2(vec3 x, vec3 color, float scanline)
{
vec3 tmp = mix(vec3(2.75*beam_min),vec3(beam_max), color);
tmp = mix(vec3(beam_max), tmp, pow(x, vec3(max(max(color.r, color.g),color.b)+0.3)));
float mx = max(max(color.r, color.g),color.b);
vec3 tmp = mix(vec3(2.5*beam_min),vec3(beam_max), color);
tmp = mix(vec3(beam_max), tmp, pow(abs(x), color+0.3));
vec3 ex = x*tmp;
return exp2(-scanline*ex*ex)/(0.6 + 0.4*color);
}
vec3 res = exp2(-scanline*ex*ex)/(0.6 + 0.4*mx);
mx = max(max(res.r,res.g),res.b);
float scans1 = scans; if (vertmask > 0.0) scans1=0.75;
return mix(vec3(mx), res, scans1);
}
// Shadow mask (1-4 from PD CRT Lottes shader).
vec3 Mask(vec2 pos, vec3 c)
......@@ -339,20 +361,22 @@ vec3 Mask(vec2 pos, vec3 c)
// Alternate mask 7
else if (shadowMask == 7.0)
{
float mc = 1.0 - CGWG;
float mx = max(max(c.r,c.g),c.b);
float maskTmp = min(1.6*max(mx-mcut,0.0)/(1.0-mcut) ,1.0 + 0.6*(1.0-mx));
float maskTmp = min(1.6*max(mx-mcut,0.0)/(1.0-mcut) , mc);
mask = vec3(maskTmp);
pos.x = fract(pos.x/2.0);
if (pos.x < 0.5) mask = vec3(1.0 + 0.6*(1.0-mx));
}
return mask;
}
}
float SlotMask(vec2 pos, vec3 c)
{
if (slotmask == 0.0) return 1.0;
pos = floor(pos/slotms);
float mx = pow(max(max(c.r,c.g),c.b),1.33);
float mlen = slotwidth*2.0;
float px = fract(pos.x/mlen);
......@@ -363,7 +387,7 @@ float SlotMask(vec2 pos, vec3 c)
if (py == double_slot && px >= 0.5) slot = slot_dark;
return slot;
}
}
// Distortion of scanlines, and end of screen alpha (PD Lottes Curvature)
vec2 Warp(vec2 pos)
......@@ -392,10 +416,16 @@ float corner(vec2 coord)
return clamp((cdist.x-dist)*bsize,0.0, 1.0);
}
vec3 declip(vec3 c, float b)
{
float m = max(max(c.r,c.g),c.b);
if (m > b) c = c*b/m;
return c;
}
void main()
{
float lum = COMPAT_TEXTURE(PassPrev5Texture, vec2(0.33,0.33)).a;
float lum = COMPAT_TEXTURE(PassPrev5Texture, vec2(0.05,0.05)).a;
// Calculating texel coordinates
......@@ -413,16 +443,16 @@ void main()
texcoord = Overscan(texcoord*(SourceSize.xy/InputSize.xy), factor, factor)*(InputSize.xy/SourceSize.xy);
vec2 pos = Warp(texcoord*(TextureSize.xy/InputSize.xy))*(InputSize.xy/TextureSize.xy);
vec2 pos0 = Warp(TEX0.xy*(TextureSize.xy/InputSize.xy))*(InputSize.xy/TextureSize.xy);
vec2 coffset = vec2(0.5, 0.5);
if ((interm == 1.0 || interm == 2.0) && inter <= mix(InputSize.y, InputSize.x, TATE)) coffset = ((TATE < 0.5) ? vec2(0.5,0.0) : vec2(0.0, 0.5));
vec2 ps = SourceSize.zw;
vec2 OGL2Pos = pos * SourceSize.xy - ((TATE < 0.5) ?
vec2(0.0,0.5) : vec2(0.5, 0.0));
vec2 OGL2Pos = pos * SourceSize.xy - coffset;
vec2 fp = fract(OGL2Pos);
vec2 dx = vec2(ps.x,0.0);
vec2 dy = vec2(0.0, ps.y);
vec2 pC4 = floor(OGL2Pos) * ps + 0.5*ps;
// Reading the texels
vec2 x2 = 2.0*dx;
vec2 y2 = 2.0*dy;
......@@ -439,84 +469,132 @@ void main()
fpx = fp.y;
}
float wl2 = 1.5 + fpx; wl2*=wl2; wl2 = exp2(-h_sharp*wl2); float twl2 = max(wl2 - s_sharp, -wl2);
float wl1 = 0.5 + fpx; wl1*=wl1; wl1 = exp2(-h_sharp*wl1); float twl1 = max(wl1 - s_sharp, -0.4*s_sharp);
float wct = 0.5 - fpx; wct*=wct; wct = exp2(-h_sharp*wct); float twct = max(wct - s_sharp, s_sharp);
float wr1 = 1.5 - fpx; wr1*=wr1; wr1 = exp2(-h_sharp*wr1); float twr1 = max(wr1 - s_sharp, -0.4*s_sharp);
float wr2 = 2.5 - fpx; wr2*=wr2; wr2 = exp2(-h_sharp*wr2); float twr2 = max(wr2 - s_sharp, -wr2);
float f = (TATE < 0.5) ? fp.y : fp.x;
vec2 pC4 = floor(OGL2Pos) * ps + 0.5*ps;
float zero = exp2(-h_sharp);
float sharp1 = s_sharp * zero;
float wl3 = 2.0 + fpx;
float wl2 = 1.0 + fpx;
float wl1 = fpx;
float wr1 = 1.0 - fpx;
float wr2 = 2.0 - fpx;
float wr3 = 3.0 - fpx;
float wtt = 1.0/(twl2+twl1+twct+twr1+twr2);
float wt = 1.0/(wl2+wl1+wct+wr1+wr2);
bool sharp = (s_sharp > 0.0);
wl3*=wl3; wl3 = exp2(-h_sharp*wl3);
wl2*=wl2; wl2 = exp2(-h_sharp*wl2);
wl1*=wl1; wl1 = exp2(-h_sharp*wl1);
wr1*=wr1; wr1 = exp2(-h_sharp*wr1);
wr2*=wr2; wr2 = exp2(-h_sharp*wr2);
wr3*=wr3; wr3 = exp2(-h_sharp*wr3);
vec3 l2 = COMPAT_TEXTURE(PassPrev4Texture, pC4 -off2).xyz;
vec3 l1 = COMPAT_TEXTURE(PassPrev4Texture, pC4 -offx).xyz;
vec3 ct = COMPAT_TEXTURE(PassPrev4Texture, pC4 ).xyz;
float fp1 = 1.-fpx;
float twl3 = max(wl3 - sharp1, 0.0);
float twl2 = max(wl2 - sharp1, mix(0.0,mix(-0.17, -0.025, fp.x),float(s_sharp > 0.05)));
float twl1 = max(wl1 - sharp1, 0.0);
float twr1 = max(wr1 - sharp1, 0.0);
float twr2 = max(wr2 - sharp1, mix(0.0,mix(-0.17, -0.025, 1.-fp.x),float(s_sharp > 0.05)));
float twr3 = max(wr3 - sharp1, 0.0);
float wtt = 1.0/(twl3+twl2+twl1+twr1+twr2+twr3);
float wt = 1.0/(wl2+wl1+wr1+wr2);
bool sharp = (s_sharp > 0.05);
vec3 l3 = COMPAT_TEXTURE(PassPrev4Texture, pC4 -off2).xyz;
vec3 l2 = COMPAT_TEXTURE(PassPrev4Texture, pC4 -offx).xyz;
vec3 l1 = COMPAT_TEXTURE(PassPrev4Texture, pC4 ).xyz;
vec3 r1 = COMPAT_TEXTURE(PassPrev4Texture, pC4 +offx).xyz;
vec3 r2 = COMPAT_TEXTURE(PassPrev4Texture, pC4 +off2).xyz;
vec3 r3 = COMPAT_TEXTURE(PassPrev4Texture, pC4 +offx+off2).xyz;
vec3 sl2 = COMPAT_TEXTURE(Texture, pC4 -off2).xyz;
vec3 sl1 = COMPAT_TEXTURE(Texture, pC4 -offx).xyz;
vec3 sct = COMPAT_TEXTURE(Texture, pC4 ).xyz;
vec3 sl2 = COMPAT_TEXTURE(Texture, pC4 -offx).xyz;
vec3 sl1 = COMPAT_TEXTURE(Texture, pC4 ).xyz;
vec3 sr1 = COMPAT_TEXTURE(Texture, pC4 +offx).xyz;
vec3 sr2 = COMPAT_TEXTURE(Texture, pC4 +off2).xyz;
vec3 color1 = (l2*twl2 + l1*twl1 + ct*twct + r1*twr1 + r2*twr2)*wtt;
if (sharp) color1 = clamp(color1, min(min(l1,r1),ct), max(max(l1,r1),ct));
vec3 color1 = (l3*twl3 + l2*twl2 + l1*twl1 + r1*twr1 + r2*twr2 + r3*twr3)*wtt;
vec3 colmin = min(min(l1,r1), min(l2,r2));
vec3 colmax = max(max(l1,r1), max(l2,r2));
if (sharp) color1 = clamp(color1, colmin, colmax);
vec3 gtmp = vec3(gamma_out*0.1);
vec3 scolor1 = color1;
if (spike > 0.0)
{
scolor1 = (sl2*wl2 + sl1*wl1 + sct*wct + sr1*wr1 + sr2*wr2)*wt;
scolor1 = pow(scolor1, gtmp);
scolor1 = mix(color1, scolor1, spike);
}
scolor1 = (sl2*wl2 + sl1*wl1 + sr1*wr1 + sr2*wr2)*wt;
scolor1 = pow(scolor1, gtmp); vec3 mcolor1 = scolor1;
scolor1 = mix(color1, scolor1, spike);
pC4+=offy;
l2 = COMPAT_TEXTURE(PassPrev4Texture, pC4 -off2).xyz;
l1 = COMPAT_TEXTURE(PassPrev4Texture, pC4 -offx).xyz;
ct = COMPAT_TEXTURE(PassPrev4Texture, pC4 ).xyz;
l3 = COMPAT_TEXTURE(PassPrev4Texture, pC4 -off2).xyz;
l2 = COMPAT_TEXTURE(PassPrev4Texture, pC4 -offx).xyz;
l1 = COMPAT_TEXTURE(PassPrev4Texture, pC4 ).xyz;
r1 = COMPAT_TEXTURE(PassPrev4Texture, pC4 +offx).xyz;
r2 = COMPAT_TEXTURE(PassPrev4Texture, pC4 +off2).xyz;
r3 = COMPAT_TEXTURE(PassPrev4Texture, pC4 +offx+off2).xyz;
sl2 = COMPAT_TEXTURE(Texture, pC4 -off2).xyz;
sl1 = COMPAT_TEXTURE(Texture, pC4 -offx).xyz;
sct = COMPAT_TEXTURE(Texture, pC4 ).xyz;
sl2 = COMPAT_TEXTURE(Texture, pC4 -offx).xyz;
sl1 = COMPAT_TEXTURE(Texture, pC4 ).xyz;
sr1 = COMPAT_TEXTURE(Texture, pC4 +offx).xyz;
sr2 = COMPAT_TEXTURE(Texture, pC4 +off2).xyz;
vec3 color2 = (l2*twl2 + l1*twl1 + ct*twct + r1*twr1 + r2*twr2)*wtt;
if (sharp) color2 = clamp(color2, min(min(l1,r1),ct), max(max(l1,r1),ct));
vec3 color2 = (l3*twl3 + l2*twl2 + l1*twl1 + r1*twr1 + r2*twr2 + r3*twr3)*wtt;
colmin = min(min(l1,r1), min(l2,r2));
colmax = max(max(l1,r1), max(l2,r2));
if (sharp) color2 = clamp(color2, colmin, colmax);
vec3 scolor2 = color2;
if (spike > 0.0)
{
scolor2 = (sl2*wl2 + sl1*wl1 + sct*wct + sr1*wr1 + sr2*wr2)*wt;
scolor2 = pow(scolor2, gtmp);
scolor2 = mix(color2, scolor2, spike);
}
scolor2 = (sl2*wl2 + sl1*wl1 + sr1*wr1 + sr2*wr2)*wt;
scolor2 = pow(scolor2, gtmp); vec3 mcolor2 = scolor2;
scolor2 = mix(color2, scolor2, spike);
// calculating scanlines
vec3 color0 = color1;
if ((interm == 1.0 || interm == 2.0) && inter <= mix(InputSize.y, InputSize.x, TATE))
{
pC4-= 2.*offy;
l3 = COMPAT_TEXTURE(PassPrev4Texture, pC4 -off2).xyz;
l2 = COMPAT_TEXTURE(PassPrev4Texture, pC4 -offx).xyz;
l1 = COMPAT_TEXTURE(PassPrev4Texture, pC4 ).xyz;
r1 = COMPAT_TEXTURE(PassPrev4Texture, pC4 +offx).xyz;
r2 = COMPAT_TEXTURE(PassPrev4Texture, pC4 +off2).xyz;
r3 = COMPAT_TEXTURE(PassPrev4Texture, pC4 +offx+off2).xyz;
color0 = (l3*twl3 + l2*twl2 + l1*twl1 + r1*twr1 + r2*twr2 + r3*twr3)*wtt;
colmin = min(min(l1,r1), min(l2,r2));
colmax = max(max(l1,r1), max(l2,r2));
float f = (TATE < 0.5) ? fp.y : fp.x;
if (sharp) color0 = clamp(color0, colmin, colmax);
}
// calculating scanlines
float shape1 = mix(scanline1, scanline2, f);
float shape2 = mix(scanline1, scanline2, 1.0-f);
float wt1 = st(f, shape1);
float wt2 = st(1.0-f, shape2);
float wt1 = st(f);
float wt2 = st(1.0-f);
vec3 color0 = color1*wt1 + color2*wt2;
vec3 color00 = color1*wt1 + color2*wt2;
vec3 scolor0 = scolor1*wt1 + scolor2*wt2;
vec3 mcolor = (mcolor1*wt1 + mcolor2*wt2)/(wt1+wt2);
vec3 ctmp = color0/(wt1+wt2);
vec3 ctmp = color00/(wt1+wt2);
vec3 sctmp = scolor0/(wt1+wt2);
vec3 tmp = pow(ctmp, vec3(1.0/gamma_out));
mcolor = clamp(mix(ctmp, mcolor, 1.5),0.0,1.0);
mcolor = pow(mcolor, vec3(1.4/gamma_out));
vec3 w1,w2 = vec3(0.0);
......@@ -533,25 +611,71 @@ void main()
if (gsl == 2.0) { w1 = sw2(f1,cref1,shape1); w2 = sw2(f2,cref2,shape2);}
vec3 color = color1*w1 + color2*w2;
color = min(color, 1.0);
if (interm > 0.5 && inter <= mix(InputSize.y, InputSize.x, TATE))
{
float line_no = floor(mod(mix( OGL2Pos.y, OGL2Pos.x, TATE),2.0));
float frame_no = floor(mod(float(FrameCount),2.0));
if (interm == 1.0)
{
vec3 icolor1 = mix(color1, color0, abs(line_no-frame_no));
vec3 icolor2 = mix(color1, color2, abs(line_no-frame_no));
color = mix(icolor1, icolor2, f);
}
else if (interm == 2.0)
{
float v0 = exp2(-2.25*2.25);
float v1 = exp2(-2.25*(0.5+f)*(0.5+f)) - v0;
float v2 = exp2(-2.25*(0.5-f)*(0.5-f)) - v0;
float v3 = exp2(-2.25*(1.5-f)*(1.5-f)) - v0;
color = (v1*color0 + v2*color1 + v3*color2)/(v1+v2+v3);
}
else color = mix(color1, color2, f);
mcolor = sqrt(color);
}
ctmp = 0.5*(ctmp+tmp);
color*=mix(brightboost, brightboost1, max(max(ctmp.r,ctmp.g),ctmp.b));
color = min(color, 1.0);
// Apply Mask
color *= (TATE < 0.5) ? Mask(gl_FragCoord.xy * 1.000001,tmp) :
Mask(gl_FragCoord.yx * 1.000001,tmp);
vec3 orig1 = color; float pixbr = max(max(ctmp.r,ctmp.g),ctmp.b); vec3 orig = ctmp; w1 = w1+w2; float w3 = max(max(w1.r,w1.g),w1.b);
vec3 cmask = vec3(1.0); vec3 cmask1 = cmask; vec3 one = vec3(1.0);
cmask*= (TATE < 0.5) ? Mask(gl_FragCoord.xy * 1.000001,mcolor) :
Mask(gl_FragCoord.yx * 1.000001,mcolor);
color = color*cmask;
color = min(color,1.0);
color *= (TATE < 0.5) ? SlotMask(gl_FragCoord.xy * 1.000001,tmp) :
cmask1 *= (TATE < 0.5) ? SlotMask(gl_FragCoord.xy * 1.000001,tmp) :
SlotMask(gl_FragCoord.yx * 1.000001,tmp);
color = color*cmask1; cmask = cmask*cmask1; cmask = min(cmask, 1.0);
vec3 Bloom = COMPAT_TEXTURE(PassPrev2Texture, pos).xyz;
color+=glow*Bloom;
vec3 Bloom1 = 2.0*Bloom*Bloom;
Bloom1 = min(Bloom1, 0.75);
float bmax = max(max(Bloom1.r,Bloom1.g),Bloom1.b);
float pmax = mix(0.8, 0.7, pixbr);
Bloom1 = min(Bloom1, pmax*bmax)/pmax;
Bloom1 = mix(min( Bloom1, color), Bloom1, 0.5*(orig1+color));
Bloom1 = bloom*Bloom1;
color = color + Bloom1;
color = min(color, 1.0);
if (interm < 0.5 || inter > mix(InputSize.y, InputSize.x, TATE)) color = declip(color, pow(w3,0.6));
color = min(color, mix(cmask,one,0.5));
color = color + glow*Bloom;
color = pow(color, vec3(1.0/gamma_out));
FragColor = vec4(color*corner(pos0), 1.0);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment