From 740edfbd1223a325b398c749dd28d317c2bed69e Mon Sep 17 00:00:00 2001 From: hunterk Date: Fri, 28 Apr 2017 16:08:52 -0500 Subject: [PATCH] some crtsim tweaks and new preset --- crt/shaders/crtsim/composite.slang | 8 ++-- crt/shaders/crtsim/frame.slang | 4 +- presets/crtsim-grungy.slangp | 66 ++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+), 6 deletions(-) create mode 100644 presets/crtsim-grungy.slangp diff --git a/crt/shaders/crtsim/composite.slang b/crt/shaders/crtsim/composite.slang index dbb3b41..7d338b0 100644 --- a/crt/shaders/crtsim/composite.slang +++ b/crt/shaders/crtsim/composite.slang @@ -100,11 +100,11 @@ void main() half2 scanuv = vec2(fract(vTexCoord * 1.0001 * params.SourceSize.xy / params.NTSCArtifactScale)); half4 NTSCArtifact1 = tex2D(NTSCArtifactSampler, scanuv); half4 NTSCArtifact2 = tex2D(NTSCArtifactSampler, scanuv + vec2(0.0, 1.0 / params.SourceSize.y)); - half4 NTSCArtifact = lerp(NTSCArtifact1, NTSCArtifact2, 1.0 - params.NTSCLerp); + float lerpfactor = (params.animate_artifacts > 0.5) ? mod(params.FrameCount, 2.0) : params.NTSCLerp; + half4 NTSCArtifact = lerp(NTSCArtifact1, NTSCArtifact2, 1.0 - lerpfactor); - float artifacting = (params.animate_artifacts > 0.5) ? mod(params.FrameCount, 2.0) : 1.0; - half2 LeftUV = vTexCoord - vec2(artifacting / params.SourceSize.x, 0.0);//RcpScrWidth; - half2 RightUV = vTexCoord + vec2(artifacting / params.SourceSize.x, 0.0);//RcpScrWidth; + half2 LeftUV = vTexCoord - vec2(1.0 / params.SourceSize.x, 0.0);//RcpScrWidth; + half2 RightUV = vTexCoord + vec2(1.0 / params.SourceSize.x, 0.0);//RcpScrWidth; half4 Cur_Left = tex2D(curFrameSampler, LeftUV); half4 Cur_Local = tex2D(curFrameSampler, vTexCoord); diff --git a/crt/shaders/crtsim/frame.slang b/crt/shaders/crtsim/frame.slang index 5a46d4c..3678a4b 100644 --- a/crt/shaders/crtsim/frame.slang +++ b/crt/shaders/crtsim/frame.slang @@ -101,10 +101,10 @@ void main() half4 emissive = SampleCRT(shadowMaskSampler, Source, vTexCoord); - colorspec += (emissive * blend * Tuning_ReflScalar); + colorspec += (emissive * blend * params.Tuning_ReflScalar); half fres = 1.0 - dot(camDir, norm); - fres = (fres*fres) * Tuning_Fres_Brightness; + fres = (fres*fres) * params.Tuning_Fres_Brightness; half4 colorfres = half4(0.15, 0.15, 0.15, 1.) * fres; half4 nearfinal = (colorfres + colordiff + colorspec); diff --git a/presets/crtsim-grungy.slangp b/presets/crtsim-grungy.slangp new file mode 100644 index 0000000..4fa77d6 --- /dev/null +++ b/presets/crtsim-grungy.slangp @@ -0,0 +1,66 @@ +shaders = "5" +shader0 = "../crt/shaders/crtsim/composite.slang" +filter_linear0 = "false" +wrap_mode0 = "clamp_to_border" +mipmap_input0 = "false" +alias0 = "" +float_framebuffer0 = "false" +srgb_framebuffer0 = "false" +shader1 = ../misc/image-adjustment.slang +wrap_mode1 = "clamp_to_border" +mipmap_input1 = "false" +alias1 = "CRTPASS" +float_framebuffer1 = "false" +srgb_framebuffer1 = "false" +shader2 = "../crt/shaders/crtsim/post-downsample.slang" +filter_linear2 = "true" +wrap_mode2 = "clamp_to_border" +mipmap_input2 = "false" +alias2 = "" +float_framebuffer2 = "false" +srgb_framebuffer2 = "false" +shader3 = "../crt/shaders/crtsim/post-upsample.slang" +filter_linear3 = "true" +wrap_mode3 = "clamp_to_border" +mipmap_input3 = "false" +alias3 = "" +float_framebuffer3 = "false" +srgb_framebuffer3 = "false" +shader4 = "../crt/shaders/crtsim/present.slang" +filter_linear4 = "true" +wrap_mode4 = "clamp_to_border" +mipmap_input4 = "false" +alias4 = "" +float_framebuffer4 = "false" +srgb_framebuffer4 = "false" +parameters = "GRAIN_STR;Tuning_Sharp;Tuning_Persistence_R;Tuning_Persistence_G;Tuning_Persistence_B;Tuning_Bleed;Tuning_Artifacts;NTSCLerp;NTSCArtifactScale;animate_artifacts;CRTMask_Scale;Tuning_Satur;Tuning_Mask_Brightness;Tuning_Mask_Opacity;bloom_scale_down;bloom_scale_up;BloomPower;BloomScalar;Tuning_Overscan;Tuning_Barrel;mask_toggle" +Tuning_Sharp = "0.200000" +Tuning_Persistence_R = "0.075000" +Tuning_Persistence_G = "0.060000" +Tuning_Persistence_B = "0.060000" +Tuning_Bleed = "1.00000" +Tuning_Artifacts = "0.700000" +NTSCLerp = "1.000000" +NTSCArtifactScale = "200.000000" +animate_artifacts = "1.000000" +CRTMask_Scale = "1.000000" +Tuning_Satur = "0.900000" +Tuning_Mask_Brightness = "0.600000" +Tuning_Mask_Opacity = "0.500000" +bloom_scale_down = "0.015000" +bloom_scale_up = "0.020000" +BloomPower = "1.000000" +BloomScalar = "0.100000" +Tuning_Overscan = "0.950000" +Tuning_Barrel = "0.250000" +mask_toggle = "1.000000" +GRAIN_STR = 3.0 +textures = "NTSCArtifactSampler;shadowMaskSampler" +NTSCArtifactSampler = "../crt/shaders/crtsim/artifacts.png" +NTSCArtifactSampler_linear = "true" +NTSCArtifactSampler_wrap_mode = "clamp_to_border" +NTSCArtifactSampler_mipmap = "false" +shadowMaskSampler = "../crt/shaders/crtsim/mask.png" +shadowMaskSampler_linear = "true" +shadowMaskSampler_wrap_mode = "clamp_to_border" +shadowMaskSampler_mipmap = "false"