From 6901e930b52d4a2535fa0ffdabaae3b5510b5811 Mon Sep 17 00:00:00 2001 From: deathride58 Date: Wed, 3 Jan 2024 19:17:06 -0500 Subject: [PATCH] Blindness hotfix (content side) (#23465) * fixes major blindness issues like blindness not scaling with render res * HEY. get outta there --- Content.Client/Eye/Blinding/BlindOverlay.cs | 1 - Resources/Prototypes/Shaders/shaders.yml | 2 +- Resources/Textures/Shaders/cataracts.swsl | 7 ++++--- Resources/Textures/Shaders/circle_mask.swsl | 5 ++--- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Content.Client/Eye/Blinding/BlindOverlay.cs b/Content.Client/Eye/Blinding/BlindOverlay.cs index 0e380a515f..1949b170ab 100644 --- a/Content.Client/Eye/Blinding/BlindOverlay.cs +++ b/Content.Client/Eye/Blinding/BlindOverlay.cs @@ -85,7 +85,6 @@ namespace Content.Client.Eye.Blinding _circleMaskShader?.SetParameter("Zoom", content.Zoom.X); } - _circleMaskShader?.SetParameter("SCREEN_TEXTURE", ScreenTexture); _greyscaleShader?.SetParameter("SCREEN_TEXTURE", ScreenTexture); var worldHandle = args.WorldHandle; diff --git a/Resources/Prototypes/Shaders/shaders.yml b/Resources/Prototypes/Shaders/shaders.yml index 560f6b576d..e286dcb7a4 100644 --- a/Resources/Prototypes/Shaders/shaders.yml +++ b/Resources/Prototypes/Shaders/shaders.yml @@ -4,7 +4,7 @@ path: "/Textures/Shaders/circle_mask.swsl" params: CircleRadius: 15.0 - CircleMinDist: 0.25 + CircleMinDist: 0.0 CirclePow: 0.5 CircleMax: 4.0 CircleMult: 0.5 diff --git a/Resources/Textures/Shaders/cataracts.swsl b/Resources/Textures/Shaders/cataracts.swsl index 5ba33db9e5..86188fdce2 100644 --- a/Resources/Textures/Shaders/cataracts.swsl +++ b/Resources/Textures/Shaders/cataracts.swsl @@ -24,6 +24,7 @@ uniform highp float Zoom; // Base distortion uniform highp float DistortionScalar; // Scales the total distortion applied to the final image. +const highp float DistortionCoordScalar = 0.1125; //Scales the coordinates for the distortion texture const highp float DistortionCenterRadius = 200.0; // radius of the gradient used to tone down the distortion effect const highp float DistortionCenterMinDist = 0.25; // minimum distance from the center of the screen for the distortion to appear at all const highp float DistortionCenterPow = 1.1; // the exponent used for the distortion center @@ -58,14 +59,14 @@ void fragment() { highp float distortionZoom = pow(Zoom, DistortionZoomPow); - highp float centergradient = zCircleGradient(aspect * 0.5, FRAGCOORD.xy, DistortionGradientMax, DistortionCenterRadius / distortionZoom, DistortionCenterMinDist / distortionZoom, DistortionCenterPow); - highp vec2 coord = (FRAGCOORD.xy * SCREEN_PIXEL_SIZE.xy) * aspect * centergradient * 0.0001; // That magic number on the end there is due to how tiny the FBM noise is. It's incredibly noisy. + highp float centergradient = zCircleGradient(aspect, FRAGCOORD.xy, DistortionGradientMax, DistortionCenterRadius / distortionZoom, DistortionCenterMinDist / distortionZoom, DistortionCenterPow); + highp vec2 coord = (FRAGCOORD.xy * SCREEN_PIXEL_SIZE.xy) * centergradient * DistortionCoordScalar; highp vec2 offset = vec2((zFBM(coord * NoiseScalar + timesin) - 0.5) * centergradient, (zFBM(coord * NoiseScalar + timecos) - 0.5) * centergradient); COLOR = zTextureSpec(SCREEN_TEXTURE, Pos + (offset * DistortionScalar)); highp float cloudyZoom = pow(Zoom, CloudinessZoomPow); - highp float cloudygradient = zCircleGradient(aspect * 0.5, FRAGCOORD.xy, CloudinessGradientMax, CloudinessCenterRadius / cloudyZoom, CloudinessCenterMinDist / cloudyZoom, CloudinessCenterPow) * CloudinessScalar; + highp float cloudygradient = zCircleGradient(aspect, FRAGCOORD.xy, CloudinessGradientMax, CloudinessCenterRadius / cloudyZoom, CloudinessCenterMinDist / cloudyZoom, CloudinessCenterPow) * CloudinessScalar; COLOR.rgb = mix(COLOR.rgb, vec3(zGrayscale(COLOR.rgb)), min(cloudygradient * CloudinessGrayscaleMult, CloudinessGrayscaleMax)); COLOR.rgb = pow(COLOR.rgb, vec3((cloudygradient * CloudinessScalar + 1.0))); diff --git a/Resources/Textures/Shaders/circle_mask.swsl b/Resources/Textures/Shaders/circle_mask.swsl index 872e48989b..5b2773e9ba 100644 --- a/Resources/Textures/Shaders/circle_mask.swsl +++ b/Resources/Textures/Shaders/circle_mask.swsl @@ -1,8 +1,7 @@ -uniform sampler2D SCREEN_TEXTURE; uniform highp float Zoom; uniform highp float CircleRadius; //= 15.0; // radius of the circular gradient -uniform highp float CircleMinDist; //= 0.25; // minimum distance from the center of the screen for the gradient +uniform highp float CircleMinDist; //= 0.0; // minimum distance from the center of the screen for the gradient uniform highp float CirclePow; //= 0.5; // the exponent used for the gradient uniform highp float CircleMax; //= 4.0; // Maximum value for the gradient used for the gradient. Don't worry, the end result gets clamped. uniform highp float CircleMult; //= 0.5; // Multiplier for the total value of the circle gradient. @@ -12,6 +11,6 @@ void fragment(){ highp vec2 aspect = vec2(1.0/SCREEN_PIXEL_SIZE.x, 1.0/SCREEN_PIXEL_SIZE.y); highp float actualZoom = Zoom; - highp float circle = zCircleGradient(aspect * 0.5, FRAGCOORD.xy, CircleMax, CircleRadius / actualZoom, /*CircleMinDist / actualZoom*/ 0.0, CirclePow) * CircleMult; + highp float circle = zCircleGradient(aspect, FRAGCOORD.xy, CircleMax, CircleRadius / actualZoom, CircleMinDist / actualZoom, CirclePow) * CircleMult; COLOR = mix(vec4(0.0), vec4(vec3(0.0), 1.0), clamp(circle, 0.0, 1.0)); } -- 2.51.2