From b893ecce7954985a0a5c24c866e98af8804dac37 Mon Sep 17 00:00:00 2001 From: Valerie Date: Sun, 14 Apr 2024 18:52:46 -0400 Subject: [PATCH] initial implementation of horizontal blur --- shaders/final.fsh | 47 ++++++++++++++++++++++++++++++++++++++ shaders/final.vsh | 3 +++ shaders/lang/en_US.lang | 9 +++----- shaders/shaders.properties | 13 ++++++----- 4 files changed, 60 insertions(+), 12 deletions(-) create mode 100644 shaders/final.fsh create mode 100644 shaders/final.vsh diff --git a/shaders/final.fsh b/shaders/final.fsh new file mode 100644 index 0000000..bd1ba82 --- /dev/null +++ b/shaders/final.fsh @@ -0,0 +1,47 @@ +#version 120 + +#define pixelSize // [1 2 4 8 16] +//#define hBlur + +varying vec2 texcoord; + +uniform sampler2D gcolor; +uniform float viewWidth; + +#ifdef hBlur + +vec2 neighbor = vec2(1 / viewWidth, 0); + +float avg(float l, float c, float r) { + return (l + c + r) / 3; +} + +void main() { + vec3 color = texture2D(gcolor, texcoord).rgb; + + vec2 left = texcoord - neighbor; + vec2 right = texcoord + neighbor; + vec3 lColor; + if(left.x >= 0) + lColor = texture2D(gcolor, left).rgb; + else + lColor = color; + + vec3 rColor; + if(right.x <= viewWidth) + rColor = texture2D(gcolor, right).rgb; + else + rColor = color; + + vec3 blurred = vec3(avg(lColor.r, color.r, rColor.r), avg(lColor.g, color.g, rColor.g), avg(lColor.b, color.b, rColor.b)); + gl_FragData[0] = vec4(blurred, 1); +} + +#else + +void main() { + gl_FragData[0] = texture2D(gcolor, texcoord); +} + +#endif + diff --git a/shaders/final.vsh b/shaders/final.vsh new file mode 100644 index 0000000..5f61fc7 --- /dev/null +++ b/shaders/final.vsh @@ -0,0 +1,3 @@ +#version 120 + +#include "/module/empty.vert" diff --git a/shaders/lang/en_US.lang b/shaders/lang/en_US.lang index c008789..2217a97 100644 --- a/shaders/lang/en_US.lang +++ b/shaders/lang/en_US.lang @@ -3,6 +3,7 @@ profile.DEFAULT=Default profile.AEON=Aeon Upstream profile.DOS=DOS profile.PSX=PSX +profile.REALITY=Project Reality profile.VR32=VR32 option.pixelSize=Downscaling @@ -42,10 +43,6 @@ option.dofRes=DoF Dither option.dofRes.comment=Whether DoF focus affects dither resolution. value.dofRes.0=Static value.dofRes.1=Dynamic -option.worldCurvature=World Curvature -value.worldCurvature.0=Off -value.worldCurvature.1=Chunk -value.worldCurvature.2=Cylinder -value.worldCurvature.3=Polyhedron -value.worldCurvature.4=Sphere +option.hblur=Horizontal Blur +option.hblur.comment=Emulates the blur responsible for reducing LCD clarity on the N64 diff --git a/shaders/shaders.properties b/shaders/shaders.properties index 291e85f..0baddda 100644 --- a/shaders/shaders.properties +++ b/shaders/shaders.properties @@ -1,11 +1,12 @@ sliders=pixelSize hueSteps satSteps valSteps rgbSteps vWarp # -- PROFILES -- -profile.DEFAULT=pixelSize=2 colorMode=0 dithering hueSteps=4 satSteps=4 valSteps=4 vWarp=0 !tWarp -profile.AEON=pixelSize=1 colorMode=0 dithering hueSteps=8 satSteps=4 valSteps=4 vWarp=0 !tWarp -profile.DOS=pixelSize=4 colorMode=1 dithering rgbSteps=2 vWarp=1 !tWarp -profile.PSX=pixelSize=2 colorMode=1 !dithering rgbSteps=16 vWarp=2 tWarp -profile.VR32=pixelSize=8 colorMode=0 !dithering hueSteps=2 satSteps=2 valSteps=2 vWarp=1 !tWarp +profile.DEFAULT=pixelSize=2 colorMode=0 dithering hueSteps=4 satSteps=4 valSteps=4 vWarp=0 !tWarp !hBlur +profile.AEON=pixelSize=1 colorMode=0 dithering hueSteps=8 satSteps=4 valSteps=4 vWarp=0 !tWarp !hBlur +profile.DOS=pixelSize=4 colorMode=1 dithering rgbSteps=2 vWarp=1 !tWarp !hBlur +profile.PSX=pixelSize=2 colorMode=1 !dithering rgbSteps=16 vWarp=2 tWarp !hBlur +profile.REALITY=profile.PSX !tWarp hBlur +profile.VR32=pixelSize=8 colorMode=0 !dithering hueSteps=2 satSteps=2 valSteps=2 vWarp=1 !tWarp !hBlur # -- SCREENS -- # default @@ -19,7 +20,7 @@ screen.COLOR=colorMode dithering rgbSteps hueSteps satSt screen.PSX=vWarp tWarp # fx -screen.FX=dof dofRes +screen.FX=dof dofRes hBlur # -- CONDITIONALS -- gbuffers_hand.enabled=tWarp