From 66ba600a367ff8f461e0a5842a975b7eb8dcb8f4 Mon Sep 17 00:00:00 2001 From: crashGG <80488411+crashGG@users.noreply.github.com> Date: Sun, 30 Jun 2024 09:45:31 +0300 Subject: [PATCH] A super-simple shader (#3236) A super-simple shader refined from the super-fast --- .../shaders/reshade/Shaders/XY-Pos-free.fx | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 data/resources/shaders/reshade/Shaders/XY-Pos-free.fx diff --git a/data/resources/shaders/reshade/Shaders/XY-Pos-free.fx b/data/resources/shaders/reshade/Shaders/XY-Pos-free.fx new file mode 100644 index 000000000..cbec69c96 --- /dev/null +++ b/data/resources/shaders/reshade/Shaders/XY-Pos-free.fx @@ -0,0 +1,84 @@ +#include "ReShade.fxh" + +// CrashGG presents + +// 'XY-Pos-free' + +// A super-simple shader refined from the super-fast crt-cyclon.fx, It only provides +// the functions of free pixel stretching and position translation on the XY axis. +// Suitable for users who only want to fine-tune the screen zoom and position and do not like the bundled CRT-like effects. +// Fixed some bugs in the original version, adjusted the step progress and the range. + +// This program is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 of the License, or (at your option) +// any later version. + + +uniform float zoomx < + ui_type = "drag"; + ui_min = -0.3000; + ui_max = 0.3000; + ui_step = 0.0005; + ui_label = "Zoom Image X"; +> = 0.0000; + +uniform float zoomy < + ui_type = "drag"; + ui_min = -0.3000; + ui_max = 0.3000; + ui_step = 0.0005; + ui_label = "Zoom Image Y"; +> = 0.0000; + +uniform float centerx < + ui_type = "drag"; + ui_min = -9.99; + ui_max = 9.99; + ui_step = 0.01; + ui_label = "Image Center X"; +> = 0.00; + +uniform float centery < + ui_type = "drag"; + ui_min = -9.99; + ui_max = 9.99; + ui_step = 0.01; + ui_label = "Image Center Y"; +> = 0.00; + + +float2 Warp(float2 pos) +{ + pos = pos*2.0-1.0; + pos *= float2(1.0+pos.y*pos.y*0, 1.0+pos.x*pos.x*0); + pos = pos*0.5+0.5; + + return pos; +} + + +float4 CRT_CYCLON_PS(float4 vpos: SV_Position, float2 vTexCoord : TEXCOORD0) : SV_Target +{ +// zoom in and center screen + float2 pos = Warp((vTexCoord*float2(1.0-zoomx,1.0-zoomy)-float2(centerx,centery)/100.0)); + +// Convergence + float3 res = tex2D(ReShade::BackBuffer,pos).rgb; + +// Vignette + float x = 0.0; + + return float4(res, 1.0); +} + + + +technique CRT_CYCLON +{ + pass PS_CRT_CYCLON + { + VertexShader = PostProcessVS; + PixelShader = CRT_CYCLON_PS; + } +}