mirror of
https://github.com/italicsjenga/slang-shaders.git
synced 2024-11-23 00:01:31 +11:00
update crt-guest to match latest glsl
This commit is contained in:
parent
368bdb8fd9
commit
0513ebd358
|
@ -1,4 +1,4 @@
|
||||||
shaders = 8
|
shaders = 7
|
||||||
|
|
||||||
shader0 = shaders/guest/afterglow.slang
|
shader0 = shaders/guest/afterglow.slang
|
||||||
filter_linear0 = false
|
filter_linear0 = false
|
||||||
|
@ -14,35 +14,30 @@ alias1 = temp_pass
|
||||||
shader2 = shaders/guest/avg-lum.slang
|
shader2 = shaders/guest/avg-lum.slang
|
||||||
filter_linear2 = false
|
filter_linear2 = false
|
||||||
scale_type2 = source
|
scale_type2 = source
|
||||||
scale2 = 0.0625
|
scale2 = 1.0
|
||||||
mipmap_input2 = true
|
mipmap_input2 = true
|
||||||
alias2 = lum_pass
|
alias2 = lum_pass
|
||||||
|
|
||||||
shader3 = ../stock.slang
|
shader3 = shaders/guest/linearize.slang
|
||||||
filter_linear3 = false
|
filter_linear3 = false
|
||||||
scale_type3 = source
|
scale_type3 = source
|
||||||
scale3 = 16.0
|
scale3 = 1.0
|
||||||
|
float_framebuffer3 = true
|
||||||
|
alias3 = linearize_pass
|
||||||
|
|
||||||
shader4 = shaders/guest/linearize.slang
|
shader4 = shaders/guest/blur_horiz.slang
|
||||||
filter_linear4 = false
|
filter_linear4 = false
|
||||||
scale_type4 = source
|
scale_type4 = source
|
||||||
scale4 = 1.0
|
scale4 = 1.0
|
||||||
float_framebuffer4 = true
|
float_framebuffer4 = true
|
||||||
alias4 = linearize_pass
|
|
||||||
|
|
||||||
shader5 = shaders/guest/blur_horiz.slang
|
shader5 = shaders/guest/blur_vert.slang
|
||||||
filter_linear5 = false
|
filter_linear5 = false
|
||||||
scale_type5 = source
|
scale_type5 = source
|
||||||
scale5 = 1.0
|
scale5 = 1.0
|
||||||
float_framebuffer5 = true
|
float_framebuffer5 = true
|
||||||
|
|
||||||
shader6 = shaders/guest/blur_vert.slang
|
shader6 = shaders/guest/crt-guest-dr-venom.slang
|
||||||
filter_linear6 = false
|
filter_linear6 = true
|
||||||
scale_type6 = source
|
scale_type6 = viewport
|
||||||
scale6 = 1.0
|
scale6 = 1.0
|
||||||
float_framebuffer6 = true
|
|
||||||
|
|
||||||
shader7 = shaders/guest/crt-guest-dr-venom.slang
|
|
||||||
filter_linear7 = true
|
|
||||||
scale_type7 = viewport
|
|
||||||
scale7 = 1.0
|
|
||||||
|
|
|
@ -29,12 +29,9 @@ layout(push_constant) uniform Push
|
||||||
vec4 OutputSize;
|
vec4 OutputSize;
|
||||||
uint FrameCount;
|
uint FrameCount;
|
||||||
float grade;
|
float grade;
|
||||||
float mixfactor;
|
|
||||||
} params;
|
} params;
|
||||||
|
|
||||||
#pragma parameter mixfactor "Motionblur Fadeout" 0.75 0.0 1.0 0.01
|
#pragma parameter grade "Raster Bloom Grade" 0.65 0.10 1.0 0.05
|
||||||
|
|
||||||
#pragma parameter grade "Blooming grade" 0.70 0.10 1.0 0.05
|
|
||||||
|
|
||||||
layout(std140, set = 0, binding = 0) uniform UBO
|
layout(std140, set = 0, binding = 0) uniform UBO
|
||||||
{
|
{
|
||||||
|
@ -56,17 +53,25 @@ void main()
|
||||||
layout(location = 0) in vec2 vTexCoord;
|
layout(location = 0) in vec2 vTexCoord;
|
||||||
layout(location = 0) out vec4 FragColor;
|
layout(location = 0) out vec4 FragColor;
|
||||||
layout(set = 0, binding = 2) uniform sampler2D Source;
|
layout(set = 0, binding = 2) uniform sampler2D Source;
|
||||||
layout(set = 0, binding = 3) uniform sampler2D PassFeedback3;
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
float mip_level = max(log2(params.SourceSize.x), log2(params.SourceSize.y));
|
float xtotal = floor(params.SourceSize.x/32.0);
|
||||||
vec4 current = pow(textureLod(Source, vTexCoord, 8), vec4(2.2));
|
float ytotal = floor(params.SourceSize.y/32.0);
|
||||||
vec4 fdback = pow(textureLod(PassFeedback3, vTexCoord, 8), vec4(2.2));
|
|
||||||
vec4 mixed = (1.0 - params.mixfactor) * current + params.mixfactor * fdback;
|
float ltotal = 0.0;
|
||||||
mixed = pow(mixed, vec4(1.0 / 2.2));
|
vec2 dx = vec2(params.SourceSize.z, 0.0)*32.0;
|
||||||
float black_compensation = (params.SourceSize.x*params.SourceSize.y)/(params.SourceSize.x*params.SourceSize.y);
|
vec2 dy = vec2(0.0, params.SourceSize.w)*32.0;
|
||||||
float lum = length(mixed.rgb * black_compensation);
|
|
||||||
lum = lum * inversesqrt(3.0);
|
for (float i = 0.0; i <= xtotal; i++)
|
||||||
FragColor = vec4(pow(lum, params.grade));
|
{
|
||||||
|
for (float j = 0.0; j <= ytotal; j++)
|
||||||
|
{
|
||||||
|
ltotal += length(textureLod(Source, i*dx + j*dy, 5.0).rgb);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ltotal = inversesqrt(3.0)*ltotal / ((xtotal+1.0)*(ytotal+1.0));
|
||||||
|
|
||||||
|
FragColor = vec4(pow(ltotal, params.grade));
|
||||||
}
|
}
|
|
@ -13,8 +13,8 @@ layout(push_constant) uniform Push
|
||||||
float GLOW_FALLOFF_H;
|
float GLOW_FALLOFF_H;
|
||||||
} params;
|
} params;
|
||||||
|
|
||||||
#pragma parameter TAPSH "H. Glow Radius" 4.0 1.0 6.0 1.0
|
#pragma parameter TAPSH "H. Glow Radius" 4.0 1.0 10.0 1.0
|
||||||
#pragma parameter GLOW_FALLOFF_H "GLOW_FALLOFF H" 0.30 0.10 1.0 0.01
|
#pragma parameter GLOW_FALLOFF_H "Horizontal Glow Grade" 0.30 0.0 1.0 0.01
|
||||||
|
|
||||||
layout(std140, set = 0, binding = 0) uniform UBO
|
layout(std140, set = 0, binding = 0) uniform UBO
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,8 +13,8 @@ layout(push_constant) uniform Push
|
||||||
float GLOW_FALLOFF_V;
|
float GLOW_FALLOFF_V;
|
||||||
} params;
|
} params;
|
||||||
|
|
||||||
#pragma parameter TAPSV "V. Glow Radius" 4.0 1.0 6.0 1.0
|
#pragma parameter TAPSV "V. Glow Radius" 4.0 1.0 10.0 1.0
|
||||||
#pragma parameter GLOW_FALLOFF_V "GLOW_FALLOFF_V" 0.30 0.10 1.0 0.01
|
#pragma parameter GLOW_FALLOFF_V "Vertical Glow Grade" 0.30 0.0 1.0 0.01
|
||||||
|
|
||||||
layout(std140, set = 0, binding = 0) uniform UBO
|
layout(std140, set = 0, binding = 0) uniform UBO
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,7 +3,9 @@
|
||||||
/*
|
/*
|
||||||
CRT - Guest - Dr. Venom
|
CRT - Guest - Dr. Venom
|
||||||
|
|
||||||
Copyright (C) 2018 guest(r) - guest.r@gmail.com
|
Copyright (C) 2018-2019 guest(r) - guest.r@gmail.com
|
||||||
|
|
||||||
|
Incorporates many good ideas and suggestions from Dr. Venom.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU General Public License
|
modify it under the terms of the GNU General Public License
|
||||||
|
@ -25,61 +27,74 @@ layout(push_constant) uniform Push
|
||||||
{
|
{
|
||||||
vec4 SourceSize;
|
vec4 SourceSize;
|
||||||
vec4 OutputSize;
|
vec4 OutputSize;
|
||||||
float OS;
|
float TATE; // Screen orientation
|
||||||
float BLOOM;
|
float IOS; // Smart Integer Scaling
|
||||||
float brightboost;
|
float OS; // Do overscan
|
||||||
float saturation;
|
float BLOOM; // Bloom overscan percentage
|
||||||
float scanline;
|
float brightboost; // adjust brightness
|
||||||
float beam_min;
|
float saturation; // 1.0 is normal saturation
|
||||||
float beam_max;
|
float gsl; // Alternate scanlines
|
||||||
float h_sharp;
|
float scanline; // scanline param, vertical sharpness
|
||||||
float l_sharp;
|
float beam_min; // dark area beam min - wide
|
||||||
float gamma_out;
|
float beam_max; // bright area beam max - narrow
|
||||||
float warpX;
|
float h_sharp; // pixel sharpness
|
||||||
float warpY;
|
float s_sharp; // substractive sharpness
|
||||||
float glow;
|
float csize; // corner size
|
||||||
float shadowMask;
|
float warpX; // Curvature X
|
||||||
float maskDark;
|
float warpY; // Curvature Y
|
||||||
float maskLight;
|
float glow; // Glow Strength
|
||||||
float CGWG;
|
float shadowMask; // Mask Style
|
||||||
float GTW;
|
float maskDark; // Dark "Phosphor"
|
||||||
|
float maskLight; // Light "Phosphor"
|
||||||
|
float CGWG; // CGWG Mask Strength
|
||||||
|
float GTW; // Gamma tweak
|
||||||
|
float gamma_out; // output gamma
|
||||||
} params;
|
} params;
|
||||||
|
|
||||||
#pragma parameter OS "Do Overscan" 1.0 0.0 2.0 1.0
|
#pragma parameter TATE "TATE Mode" 0.0 0.0 1.0 1.0
|
||||||
|
#define TATE params.TATE
|
||||||
|
#pragma parameter IOS "Smart Integer Scaling" 0.0 0.0 1.0 1.0
|
||||||
|
#define IOS params.IOS
|
||||||
|
#pragma parameter OS "R. Bloom Overscan Mode" 2.0 0.0 2.0 1.0
|
||||||
#define OS params.OS
|
#define OS params.OS
|
||||||
#pragma parameter BLOOM "Bloom percentage" 5.0 0.0 20.0 1.0
|
#pragma parameter BLOOM "Raster bloom %" 0.0 0.0 20.0 1.0
|
||||||
#define BLOOM params.BLOOM
|
#define BLOOM params.BLOOM
|
||||||
#pragma parameter brightboost "Bright boost" 1.10 0.50 2.00 0.01
|
#pragma parameter brightboost "Bright boost" 1.10 0.50 2.00 0.01
|
||||||
#define brightboost params.brightboost
|
#define brightboost params.brightboost
|
||||||
#pragma parameter saturation "Saturation adjustment" 1.0 0.1 2.0 0.05
|
#pragma parameter saturation "Saturation adjustment" 1.0 0.1 2.0 0.05
|
||||||
#define saturation params.saturation
|
#define saturation params.saturation
|
||||||
|
#pragma parameter gsl "Alternate scanlines" 0.0 0.0 1.0 1.0
|
||||||
|
#define gsl params.gsl
|
||||||
#pragma parameter scanline "Scanline adjust" 8.0 1.0 12.0 1.0
|
#pragma parameter scanline "Scanline adjust" 8.0 1.0 12.0 1.0
|
||||||
#define scanline params.scanline
|
#define scanline params.scanline
|
||||||
#pragma parameter beam_min "Scanline dark" 1.40 0.5 2.0 0.05
|
#pragma parameter beam_min "Scanline dark" 1.30 0.5 2.0 0.05
|
||||||
#define beam_min params.beam_min
|
#define beam_min params.beam_min
|
||||||
#pragma parameter beam_max "Scanline bright" 0.80 0.5 2.0 0.05
|
#pragma parameter beam_max "Scanline bright" 1.0 0.5 2.0 0.05
|
||||||
#define beam_max params.beam_max
|
#define beam_max params.beam_max
|
||||||
#pragma parameter h_sharp "Horizontal sharpness" 5.0 1.5 20.0 0.25
|
#pragma parameter h_sharp "Horizontal sharpness" 5.0 1.5 20.0 0.25
|
||||||
#define h_sharp params.h_sharp
|
#define h_sharp params.h_sharp
|
||||||
#pragma parameter l_sharp "Substractive sharpness" 0.0 0.0 0.30 0.01
|
#pragma parameter s_sharp "Substractive sharpness" 0.0 0.0 0.20 0.01
|
||||||
#define l_sharp params.l_sharp
|
#define s_sharp params.s_sharp
|
||||||
#pragma parameter gamma_out "Gamma out" 2.4 1.0 3.0 0.05
|
#pragma parameter csize "Corner size" 0.0 0.0 0.05 0.01
|
||||||
#define gamma_out params.gamma_out
|
#define csize params.csize
|
||||||
#pragma parameter warpX "warpX" 0.031 0.0 0.125 0.01
|
#pragma parameter warpX "CurvatureX (default 0.03)" 0.0 0.0 0.125 0.01
|
||||||
#define warpX params.warpX
|
#define warpX params.warpX
|
||||||
#pragma parameter warpY "warpY" 0.041 0.0 0.125 0.01
|
#pragma parameter warpY "CurvatureY (default 0.04)" 0.0 0.0 0.125 0.01
|
||||||
#define warpY params.warpY
|
#define warpY params.warpY
|
||||||
#pragma parameter glow "Glow Strength" 0.06 0.0 0.5 0.01
|
#pragma parameter glow "Glow Strength" 0.04 0.0 0.5 0.01
|
||||||
#define glow params.glow
|
#define glow params.glow
|
||||||
#pragma parameter shadowMask "Mask Style (0 = CGWG)" 0.0 0.0 4.0 1.0
|
#pragma parameter shadowMask "Mask Style (0 = CGWG)" 0.0 -1.0 5.0 1.0
|
||||||
|
#define shadowMask params.shadowMask
|
||||||
#pragma parameter maskDark "Lottes maskDark" 0.5 0.0 2.0 0.1
|
#pragma parameter maskDark "Lottes maskDark" 0.5 0.0 2.0 0.1
|
||||||
#define maskDark params.maskDark
|
#define maskDark params.maskDark
|
||||||
#pragma parameter maskLight "Lottes maskLight" 1.5 0.0 2.0 0.1
|
#pragma parameter maskLight "Lottes maskLight" 1.5 0.0 2.0 0.1
|
||||||
#define maskLight params.maskLight
|
#define maskLight params.maskLight
|
||||||
#pragma parameter CGWG "CGWG Mask Str." 0.4 0.0 1.0 0.1
|
#pragma parameter CGWG "CGWG Mask Str." 0.4 0.0 1.0 0.05
|
||||||
#define CGWG params.CGWG
|
#define CGWG params.CGWG
|
||||||
#pragma parameter GTW "Gamma Tweak" 1.10 0.5 1.5 0.01
|
#pragma parameter GTW "Gamma Tweak" 1.10 0.5 1.5 0.01
|
||||||
#define GTW params.GTW
|
#define GTW params.GTW
|
||||||
|
#pragma parameter gamma_out "Gamma out" 2.4 1.0 3.0 0.05
|
||||||
|
#define gamma_out params.gamma_out
|
||||||
|
|
||||||
layout(std140, set = 0, binding = 0) uniform UBO
|
layout(std140, set = 0, binding = 0) uniform UBO
|
||||||
{
|
{
|
||||||
|
@ -106,6 +121,10 @@ layout(set = 0, binding = 4) uniform sampler2D linearize_pass;
|
||||||
|
|
||||||
#define eps 1e-10
|
#define eps 1e-10
|
||||||
|
|
||||||
|
float b_min = 1.0 + 7.0*(beam_min - 0.5)*0.666666666;
|
||||||
|
float b_max = 1.0 + 7.0*(beam_max - 0.5)*0.666666666;
|
||||||
|
float scn_s = 0.3 + 0.7*(scanline - 1.0)*0.090909090;
|
||||||
|
|
||||||
vec3 sw(float x, vec3 color)
|
vec3 sw(float x, vec3 color)
|
||||||
{
|
{
|
||||||
vec3 tmp = mix(vec3(beam_min),vec3(beam_max), color);
|
vec3 tmp = mix(vec3(beam_min),vec3(beam_max), color);
|
||||||
|
@ -113,23 +132,43 @@ vec3 sw(float x, vec3 color)
|
||||||
return exp2(-scanline*ex*ex);
|
return exp2(-scanline*ex*ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vec3 sw2(float x, vec3 c)
|
||||||
|
{
|
||||||
|
vec3 s = mix(vec3(b_min), vec3(b_max), c);
|
||||||
|
return clamp(smoothstep(vec3(0.0), vec3(scn_s), pow(vec3(x),s)), 0.0001, 1.0);
|
||||||
|
}
|
||||||
|
|
||||||
// Shadow mask (mostly from PD Lottes shader).
|
// Shadow mask (mostly from PD Lottes shader).
|
||||||
vec3 Mask(vec2 pos)
|
vec3 Mask(vec2 pos)
|
||||||
{
|
{
|
||||||
vec3 mask = vec3(maskDark, maskDark, maskDark);
|
vec3 mask = vec3(maskDark, maskDark, maskDark);
|
||||||
|
|
||||||
// Phosphor.
|
|
||||||
if (params.shadowMask == 0.0)
|
|
||||||
{
|
|
||||||
float mf = floor(mod(pos.x,2.0));
|
float mf = floor(mod(pos.x,2.0));
|
||||||
|
float mf2 = floor(mod(pos.x + pos.y,2.0));
|
||||||
float mc = 1.0 - CGWG;
|
float mc = 1.0 - CGWG;
|
||||||
if (mf == 0.0) { mask.r = 1.0; mask.g = mc; mask.b = 1.0; }
|
float mc2 = mc * 0.7;
|
||||||
else { mask.r = mc; mask.g = 1.0; mask.b = mc; };
|
|
||||||
|
// No mask
|
||||||
|
if (shadowMask == -1.0)
|
||||||
|
{
|
||||||
|
mask = vec3(1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Light mask.
|
||||||
|
else if (shadowMask == 5.0)
|
||||||
|
{
|
||||||
|
if (mf2 == 0.0) { mask = vec3(1.0); }
|
||||||
|
else { mask = vec3(mc2); }
|
||||||
|
}
|
||||||
|
|
||||||
|
// Phosphor.
|
||||||
|
else if (shadowMask == 0.0)
|
||||||
|
{
|
||||||
|
if (mf == 0.0) { mask.r = 1.0; mask.g = mc; mask.b = 1.0; }
|
||||||
|
else { mask.r = mc; mask.g = 1.0; mask.b = mc; }
|
||||||
|
}
|
||||||
|
|
||||||
// Very compressed TV style shadow mask.
|
// Very compressed TV style shadow mask.
|
||||||
else if (params.shadowMask == 1.0)
|
else if (shadowMask == 1.0)
|
||||||
{
|
{
|
||||||
float line = maskLight;
|
float line = maskLight;
|
||||||
float odd = 0.0;
|
float odd = 0.0;
|
||||||
|
@ -148,7 +187,7 @@ vec3 Mask(vec2 pos)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Aperture-grille.
|
// Aperture-grille.
|
||||||
else if (params.shadowMask == 2.0)
|
else if (shadowMask == 2.0)
|
||||||
{
|
{
|
||||||
pos.x = fract(pos.x/3.0);
|
pos.x = fract(pos.x/3.0);
|
||||||
|
|
||||||
|
@ -158,7 +197,7 @@ vec3 Mask(vec2 pos)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stretched VGA style shadow mask (same as prior shaders).
|
// Stretched VGA style shadow mask (same as prior shaders).
|
||||||
else if (params.shadowMask == 3.0)
|
else if (shadowMask == 3.0)
|
||||||
{
|
{
|
||||||
pos.x += pos.y*3.0;
|
pos.x += pos.y*3.0;
|
||||||
pos.x = fract(pos.x/6.0);
|
pos.x = fract(pos.x/6.0);
|
||||||
|
@ -169,7 +208,7 @@ vec3 Mask(vec2 pos)
|
||||||
}
|
}
|
||||||
|
|
||||||
// VGA style shadow mask.
|
// VGA style shadow mask.
|
||||||
else if (params.shadowMask == 4.0)
|
else if (shadowMask == 4.0)
|
||||||
{
|
{
|
||||||
pos.xy = floor(pos.xy*vec2(1.0, 0.5));
|
pos.xy = floor(pos.xy*vec2(1.0, 0.5));
|
||||||
pos.x += pos.y*3.0;
|
pos.x += pos.y*3.0;
|
||||||
|
@ -197,40 +236,57 @@ vec2 Overscan(vec2 pos, float dx, float dy){
|
||||||
return pos*0.5+0.5;
|
return pos*0.5+0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float Overscan2(float pos, float dy){
|
||||||
|
pos=pos*2.0-1.0;
|
||||||
|
pos*=dy;
|
||||||
|
return pos*0.5+0.5;
|
||||||
|
}
|
||||||
|
|
||||||
// Borrowed from cgwg's crt-geom, under GPL
|
// Borrowed from cgwg's crt-geom, under GPL
|
||||||
|
|
||||||
float corner(vec2 coord)
|
float corner(vec2 coord)
|
||||||
{
|
{
|
||||||
coord *= params.SourceSize.xy / params.SourceSize.xy;
|
|
||||||
coord = (coord - vec2(0.5)) * 1.0 + vec2(0.5);
|
coord = (coord - vec2(0.5)) * 1.0 + vec2(0.5);
|
||||||
coord = min(coord, vec2(1.0)-coord) * vec2(1.0, params.SourceSize.y/params.SourceSize.x);
|
coord = min(coord, vec2(1.0)-coord) * vec2(1.0, params.OutputSize.y*params.OutputSize.z);
|
||||||
vec2 cdist = vec2(0.003);
|
vec2 cdist = vec2(max(csize,0.002));
|
||||||
coord = (cdist - min(coord,cdist));
|
coord = (cdist - min(coord,cdist));
|
||||||
float dist = sqrt(dot(coord,coord));
|
float dist = sqrt(dot(coord,coord));
|
||||||
return clamp((cdist.x-dist)*600.0,0.0, 1.0);
|
return clamp((cdist.x-dist)*700.0,0.0, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
const float sqrt3 = 1.732050807568877;
|
const float sqrt3 = 1.732050807568877;
|
||||||
|
|
||||||
vec3 gamma_correct(vec3 color, vec3 tmp)
|
vec3 gamma_correct(vec3 color, vec3 tmp)
|
||||||
{
|
{
|
||||||
float l = length(color)/sqrt3;
|
return color*mix(GTW, 1.0, max(max(tmp.r,tmp.g),tmp.b));
|
||||||
float g = mix(1.0/GTW, 1.0, max(max(tmp.r,tmp.g),tmp.b));
|
|
||||||
l = pow(l,g)*sqrt3;
|
|
||||||
return l*normalize(color + vec3(eps));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec3 lum = texture(lum_pass, vec2(0.1,0.1)).xyz;
|
vec3 lum = texture(lum_pass, vec2(0.33,0.33)).xyz;
|
||||||
|
|
||||||
|
// Calculating texel coordinates
|
||||||
|
|
||||||
|
vec2 texcoord = vTexCoord.xy;
|
||||||
|
if (IOS == 1.0){
|
||||||
|
vec2 ofactor = params.OutputSize.xy*params.SourceSize.zw;
|
||||||
|
vec2 intfactor = round(ofactor);
|
||||||
|
vec2 diff = ofactor/intfactor;
|
||||||
|
vec2 smartcoord;
|
||||||
|
smartcoord.x = Overscan2(vTexCoord.x, diff.x);
|
||||||
|
smartcoord.y = Overscan2(vTexCoord.y, diff.y);
|
||||||
|
texcoord = (TATE > 0.5) ? vec2(smartcoord.x, texcoord.y) :
|
||||||
|
vec2(texcoord.x, smartcoord.y);
|
||||||
|
}
|
||||||
|
|
||||||
float factor = 1.00 + (1.0-0.5*OS)*BLOOM/100.0 - lum.x*BLOOM/100.0;
|
float factor = 1.00 + (1.0-0.5*OS)*BLOOM/100.0 - lum.x*BLOOM/100.0;
|
||||||
vec2 texcoord = Overscan(vTexCoord.xy*(params.SourceSize.xy/params.SourceSize.xy), factor, factor)*(params.SourceSize.xy/params.SourceSize.xy);
|
texcoord = Overscan(texcoord, factor, factor);
|
||||||
vec2 pos = Warp(texcoord);
|
vec2 pos = Warp(texcoord);
|
||||||
vec2 pos0 = Warp(texcoord);
|
vec2 pos0 = Warp(vTexCoord.xy);
|
||||||
|
|
||||||
vec2 ps = params.SourceSize.zw;
|
vec2 ps = params.SourceSize.zw;
|
||||||
vec2 OGL2Pos = pos * params.SourceSize.xy - vec2(0.0,0.5);
|
vec2 OGL2Pos = pos * params.SourceSize.xy - ((TATE < 0.5) ?
|
||||||
|
vec2(0.0,0.5) : vec2(0.5, 0.0));
|
||||||
vec2 fp = fract(OGL2Pos);
|
vec2 fp = fract(OGL2Pos);
|
||||||
vec2 dx = vec2(ps.x,0.0);
|
vec2 dx = vec2(ps.x,0.0);
|
||||||
vec2 dy = vec2(0.0, ps.y);
|
vec2 dy = vec2(0.0, ps.y);
|
||||||
|
@ -239,42 +295,57 @@ void main()
|
||||||
|
|
||||||
// Reading the texels
|
// Reading the texels
|
||||||
vec2 x2 = 2.0*dx;
|
vec2 x2 = 2.0*dx;
|
||||||
|
vec2 y2 = 2.0*dy;
|
||||||
|
|
||||||
float wl = exp2(-h_sharp*0.36)*l_sharp;
|
vec2 offx = dx;
|
||||||
|
vec2 off2 = x2;
|
||||||
|
vec2 offy = dy;
|
||||||
|
float fpx = fp.x;
|
||||||
|
if(TATE > 0.5)
|
||||||
|
{
|
||||||
|
offx = dy;
|
||||||
|
off2 = y2;
|
||||||
|
offy = dx;
|
||||||
|
fpx = fp.y;
|
||||||
|
}
|
||||||
|
|
||||||
float wl2 = 1.5 + fp.x; wl2*=wl2; wl2 = exp2(-h_sharp*wl2); wl2 = max(wl2 - wl, -wl2);
|
bool sharp = (s_sharp > 0.0);
|
||||||
float wl1 = 0.5 + fp.x; wl1*=wl1; wl1 = exp2(-h_sharp*wl1); wl1 = max(wl1 - wl, -0.25);
|
|
||||||
float wct = 0.5 - fp.x; wct*=wct; wct = exp2(-h_sharp*wct);
|
float wl2 = 1.5 + fpx; wl2*=wl2; wl2 = exp2(-h_sharp*wl2); wl2 = max(wl2 - s_sharp, -wl2);
|
||||||
float wr1 = 1.5 - fp.x; wr1*=wr1; wr1 = exp2(-h_sharp*wr1); wr1 = max(wr1 - wl, -0.25);
|
float wl1 = 0.5 + fpx; wl1*=wl1; wl1 = exp2(-h_sharp*wl1); wl1 = max(wl1 - s_sharp, -0.4*s_sharp);
|
||||||
float wr2 = 2.5 - fp.x; wr2*=wr2; wr2 = exp2(-h_sharp*wr2); wr2 = max(wr2 - wl, -wr2);
|
float wct = 0.5 - fpx; wct*=wct; wct = exp2(-h_sharp*wct); wct = max(wct - s_sharp, s_sharp);
|
||||||
|
float wr1 = 1.5 - fpx; wr1*=wr1; wr1 = exp2(-h_sharp*wr1); wr1 = max(wr1 - s_sharp, -0.4*s_sharp);
|
||||||
|
float wr2 = 2.5 - fpx; wr2*=wr2; wr2 = exp2(-h_sharp*wr2); wr2 = max(wr2 - s_sharp, -wr2);
|
||||||
|
|
||||||
float wt = 1.0/(wl2+wl1+wct+wr1+wr2);
|
float wt = 1.0/(wl2+wl1+wct+wr1+wr2);
|
||||||
|
|
||||||
vec3 l2 = texture(linearize_pass, pC4 -x2).xyz;
|
vec3 l2 = texture(linearize_pass, pC4 -off2).xyz;
|
||||||
vec3 l1 = texture(linearize_pass, pC4 -dx).xyz;
|
vec3 l1 = texture(linearize_pass, pC4 -offx).xyz;
|
||||||
vec3 ct = texture(linearize_pass, pC4 ).xyz;
|
vec3 ct = texture(linearize_pass, pC4 ).xyz;
|
||||||
vec3 r1 = texture(linearize_pass, pC4 +dx).xyz;
|
vec3 r1 = texture(linearize_pass, pC4 +offx).xyz;
|
||||||
vec3 r2 = texture(linearize_pass, pC4 +x2).xyz;
|
vec3 r2 = texture(linearize_pass, pC4 +off2).xyz;
|
||||||
|
|
||||||
vec3 color1 = (l2*wl2 + l1*wl1 + ct*wct + r1*wr1 + r2*wr2)*wt;
|
vec3 color1 = (l2*wl2 + l1*wl1 + ct*wct + r1*wr1 + r2*wr2)*wt;
|
||||||
if (l_sharp > 0.0) color1 = clamp(color1, 0.8*min(min(l1,r1),ct), 1.2*max(max(l1,r1),ct));
|
if (sharp) color1 = clamp(color1, min(min(l1,r1),ct), max(max(l1,r1),ct));
|
||||||
|
|
||||||
l2 = texture(linearize_pass, pC4 -x2 +dy).xyz;
|
l2 = texture(linearize_pass, pC4 -off2 +offy).xyz;
|
||||||
l1 = texture(linearize_pass, pC4 -dx +dy).xyz;
|
l1 = texture(linearize_pass, pC4 -offx +offy).xyz;
|
||||||
ct = texture(linearize_pass, pC4 +dy).xyz;
|
ct = texture(linearize_pass, pC4 +offy).xyz;
|
||||||
r1 = texture(linearize_pass, pC4 +dx +dy).xyz;
|
r1 = texture(linearize_pass, pC4 +offx +offy).xyz;
|
||||||
r2 = texture(linearize_pass, pC4 +x2 +dy).xyz;
|
r2 = texture(linearize_pass, pC4 +off2 +offy).xyz;
|
||||||
|
|
||||||
vec3 color2 = (l2*wl2 + l1*wl1 + ct*wct + r1*wr1 + r2*wr2)*wt;
|
vec3 color2 = (l2*wl2 + l1*wl1 + ct*wct + r1*wr1 + r2*wr2)*wt;
|
||||||
if (l_sharp > 0.0) color2 = clamp(color2, 0.8*min(min(l1,r1),ct), 1.2*max(max(l1,r1),ct));
|
if (sharp) color2 = clamp(color2, min(min(l1,r1),ct), max(max(l1,r1),ct));
|
||||||
|
|
||||||
// calculating scanlines
|
// calculating scanlines
|
||||||
|
|
||||||
float f = fp.y;
|
float f = (TATE < 0.5) ? fp.y : fp.x;
|
||||||
|
|
||||||
vec3 w1 = sw(f,color1);
|
vec3 w1 = sw(f,color1);
|
||||||
vec3 w2 = sw(1.0-f,color2);
|
vec3 w2 = sw(1.0-f,color2);
|
||||||
|
|
||||||
|
if (gsl == 1.0) { w1 = sw2(1.0-f,color1); w2 = sw2(f,color2);}
|
||||||
|
|
||||||
vec3 color = color1*w1 + color2*w2;
|
vec3 color = color1*w1 + color2*w2;
|
||||||
vec3 ctmp = color/(w1+w2);
|
vec3 ctmp = color/(w1+w2);
|
||||||
|
|
||||||
|
@ -288,7 +359,8 @@ void main()
|
||||||
|
|
||||||
// Apply Mask
|
// Apply Mask
|
||||||
|
|
||||||
color = color*Mask(vTexCoord * params.OutputSize.xy);
|
color *= (TATE < 0.5) ? Mask(gl_FragCoord.xy * 1.000001) :
|
||||||
|
Mask(gl_FragCoord.yx * 1.000001);
|
||||||
|
|
||||||
vec3 Bloom = texture(Source, pos).xyz;
|
vec3 Bloom = texture(Source, pos).xyz;
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ layout(push_constant) uniform Push
|
||||||
float WP;
|
float WP;
|
||||||
} params;
|
} params;
|
||||||
|
|
||||||
#pragma parameter WP "D65 to D50 strength %" 0.0 -100.0 100.0 10.0
|
#pragma parameter WP "D65 to D50 strength %" 0.0 -100.0 100.0 5.0
|
||||||
|
|
||||||
layout(std140, set = 0, binding = 0) uniform UBO
|
layout(std140, set = 0, binding = 0) uniform UBO
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,7 +9,7 @@ layout(push_constant) uniform Push
|
||||||
float GAMMA_INPUT;
|
float GAMMA_INPUT;
|
||||||
} params;
|
} params;
|
||||||
|
|
||||||
#pragma parameter GAMMA_INPUT "Gamma Input" 2.4 0.1 5.0 0.01
|
#pragma parameter GAMMA_INPUT "Gamma Input" 2.4 0.1 5.0 0.05
|
||||||
|
|
||||||
layout(std140, set = 0, binding = 0) uniform UBO
|
layout(std140, set = 0, binding = 0) uniform UBO
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue