From 4e7d3480f5ef346ad198dca0d6f682137c535e91 Mon Sep 17 00:00:00 2001 From: metallic77 <43163462+metallic77@users.noreply.github.com> Date: Fri, 16 Jun 2023 17:27:18 +0300 Subject: [PATCH] small update and a preset (#449) update crt-simple, add crt-geom-simple preset --- crt/shaders/crt-simple.slang | 7 +++++-- presets/crt-geom-simple.slangp | 27 +++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 presets/crt-geom-simple.slangp diff --git a/crt/shaders/crt-simple.slang b/crt/shaders/crt-simple.slang index 8f8fe02..4ee9e9a 100644 --- a/crt/shaders/crt-simple.slang +++ b/crt/shaders/crt-simple.slang @@ -12,18 +12,20 @@ * * */ + layout(push_constant) uniform Push { vec4 SourceSize; vec4 OriginalSize; vec4 OutputSize; uint FrameCount; - float DISTORTION,SCANLINE,INPUTGAMMA,OUTPUTGAMMA,MASK,SIZE; + float DISTORTION,SCANLINE,INPUTGAMMA,OUTPUTGAMMA,MASK,SIZE,DOWNSCALE; } params; // Parameter lines go here: #pragma parameter DISTORTION "Distortion" 0.12 0.0 0.30 0.01 #pragma parameter SCANLINE "Scanline Weight" 0.3 0.2 0.6 0.05 +#pragma parameter DOWNSCALE "Scanlines Downscale" 1.0 1.0 2.0 1.0 #pragma parameter INPUTGAMMA "Input Gamma" 2.4 0.0 4.0 0.05 #pragma parameter OUTPUTGAMMA "Output Gamma" 2.2 0.0 4.0 0.05 #pragma parameter MASK "Mask Brightness" 0.7 0.0 1.0 0.05 @@ -35,6 +37,7 @@ layout(push_constant) uniform Push #define OUTPUTGAMMA params.OUTPUTGAMMA #define MASK params.MASK #define SIZE params.SIZE +#define DOWNSCALE params.DOWNSCALE #define SourceSize params.SourceSize #define OriginalSize params.OriginalSize @@ -133,7 +136,7 @@ void main() // Of all the pixels that are mapped onto the texel we are // currently rendering, which pixel are we currently rendering? vec2 ratio_scale = xy * SourceSize.xy - 0.5; - vec2 uv_ratio = fract(ratio_scale); + vec2 uv_ratio = fract(ratio_scale/DOWNSCALE); // Snap to the center of the underlying texel. xy = (floor(ratio_scale) + 0.5) / SourceSize.xy; diff --git a/presets/crt-geom-simple.slangp b/presets/crt-geom-simple.slangp new file mode 100644 index 0000000..196df41 --- /dev/null +++ b/presets/crt-geom-simple.slangp @@ -0,0 +1,27 @@ +shaders = "3" +feedback_pass = "0" +shader0 = "../misc/shaders/simple_color_controls.slang" +filter_linear0 = "false" +scale_type_x0 = "source" +scale_x0 = "1.000000" +scale_type_y0 = "source" +scale_y0 = "1.000000" +shader1 = "../misc/shaders/chromaticity.slang" +filter_linear1 = "false" +shader2 = "../crt/shaders/crt-simple.slang" +filter_linear2 = "true" +scale_type_x2 = "viewport" +scale_x2 = "1.000000" +scale_type_y2 = "viewport" +scale_y2 = "1.000000" +TEMP = "7079.000000" +SAT = "1.080000" +BRIGHTNESS = "1.020000" +contrast = "1.020000" +BLACK = "0.010000" +postbr = "1.050000" +gamma_out_red = "2.300000" +gamma_out_green = "2.100000" +DISTORTION = "0.100000" +INPUTGAMMA = "2.000000" +OUTPUTGAMMA = "2.000000"