From fe459ce01c518e21f52f2359ce3992815996e048 Mon Sep 17 00:00:00 2001 From: metallic77 <43163462+metallic77@users.noreply.github.com> Date: Mon, 15 May 2023 04:16:26 +0300 Subject: [PATCH] update fake-crt-geom-potato (#429) fix small mistakes in crt-geom-potato --- crt/fake-crt-geom-potato.slangp | 2 +- crt/shaders/crt-sines.slang | 6 +++--- crt/shaders/fake-crt-geom-potato.slang | 19 +++++++++++-------- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/crt/fake-crt-geom-potato.slangp b/crt/fake-crt-geom-potato.slangp index d0077c8..89c0928 100644 --- a/crt/fake-crt-geom-potato.slangp +++ b/crt/fake-crt-geom-potato.slangp @@ -1,5 +1,5 @@ shaders = 1 shader0 = shaders/fake-crt-geom-potato.slang -filter_linear0 = true +filter_linear0 = false scale_type0 = viewport diff --git a/crt/shaders/crt-sines.slang b/crt/shaders/crt-sines.slang index 8422870..ea8e0da 100644 --- a/crt/shaders/crt-sines.slang +++ b/crt/shaders/crt-sines.slang @@ -155,7 +155,6 @@ void main() vec3 lumweight=vec3(0.213,0.715,0.072); float lum = dot(color,lumweight); - color = pow(color,vec3(INGAMMA)); //APPLY MASK float MSK = mix(MSK1,MSK2,lum); @@ -165,9 +164,10 @@ void main() float SCANLINE = mix(SCANLINE1,SCANLINE2,lum); //INTERLACING MODE FIX SCANLINES if (INTERLACE > 0.0 && global.OriginalSize.y > 400.0 ) scan; else - scan= SCANLINE * sin(fract(vTexCoord.y*SourceSize.y/SCALE)*3.141529) +(1.0-SCANLINE); + color *= SCANLINE * sin(fract(vTexCoord.y*SourceSize.y/SCALE)*3.141529) +(1.0-SCANLINE); + color = pow(color,vec3(INGAMMA)); - color *=mix(scan*mask, scan, dot(color, vec3(FADE))); + color =mix(color, color*mask, dot(color, vec3(FADE))); color *= mix(1.0,BOOST,lum); color *= vec3(1.0+WPR, 1.0-WPR/2.0, 1.0-WPR/2.0); diff --git a/crt/shaders/fake-crt-geom-potato.slang b/crt/shaders/fake-crt-geom-potato.slang index 4af0541..3c93701 100644 --- a/crt/shaders/fake-crt-geom-potato.slang +++ b/crt/shaders/fake-crt-geom-potato.slang @@ -16,13 +16,13 @@ layout(push_constant) uniform Push // Parameter lines go here: -#pragma parameter boost "Bright boost " 1.00 1.00 2.00 0.02 +#pragma parameter boost "Bright boost " 1.20 1.00 2.00 0.02 #define boost params.boost -#pragma parameter SCANLINE "Scanline Intensity" 0.70 0.0 1.0 0.05 +#pragma parameter SCANLINE "Scanline Intensity" 0.50 0.0 1.0 0.05 #define SCANLINE params.SCANLINE -#pragma parameter cgwg "Mask Intensity " 0.8 0.0 1.0 0.05 +#pragma parameter cgwg "Mask Intensity " 0.3 0.0 1.0 0.05 #define cgwg params.cgwg @@ -63,12 +63,15 @@ void main() vec3 res = texture(Source, pos).rgb; - res *=res; res *= SCANLINE * sin(fract(p.y)*pi) +(1.0-SCANLINE); - -// apply the mask - res *= cgwg * sin(fract(pos.x*0.5*params.OutputSize.x)*pi) +(1.0-cgwg); - res = sqrt(res); + + //scanlines will misalign if res*res is run before scanlines applied. + res *= res; + + // apply the mask + res *= cgwg*(sin(pos.x*params.OutputSize.x*pi))+1.0-cgwg ; + + res = sqrt(res); res *= boost; FragColor = vec4(res,1.0);