From e61b7d105c398a925bb4d53fb39df886e7448e98 Mon Sep 17 00:00:00 2001 From: deathride58 Date: Sat, 23 Dec 2023 00:35:46 -0500 Subject: [PATCH] Drug overlay shader rework - a little more motion-sickness friendly, a little less shonky (#22872) * reworks the drug overlay effect to be less motion-sickness inducing and a bit less shonky * UNAUTHORIZED fucking THING. DESTROY it immediately * further tweaks - adds another gradient to control the color effect too --- Resources/Textures/Shaders/rainbow.swsl | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Resources/Textures/Shaders/rainbow.swsl b/Resources/Textures/Shaders/rainbow.swsl index 67b2b78686..a96d2fdb31 100644 --- a/Resources/Textures/Shaders/rainbow.swsl +++ b/Resources/Textures/Shaders/rainbow.swsl @@ -5,6 +5,14 @@ const highp float TimeScale = 0.15; const highp float DistortionScale = 0.02; // how strongly to warp the screen const highp float NoiseScale = 4.0; // scale of the random noise const highp float MaxColorMix = 0.05; // rainbow effect strength. at 1.0, you wont be able to see the screen anymore +const highp float BaseColorMult = 8; // multiplier of the underlying screen texture for the rainbow effect +const highp float BaseColorPow = 0.8; // exponent for the rainbow effect's +const highp float CenterRadius = 200; // radius of the gradient used to tone down the distortion effect +const highp float CenterMinDist = 0.4; // minimum distance from the center of the screen for the distortion to appear at all +const highp float CenterPow = 3; // the exponent used for the distortion center +const highp float CenterColorRadius = 250; // radius of the gradient used to tone down the color effect +const highp float CenterColorMinDist = 0.2; // minimum distance from the center of the screen for the color to appear at all +const highp float CenterColorPow = 1.25; // the exponent used for the color's center // hash(), noise(), and hsv2rgb_smooth() were converted from shadertoy examples, which were released under the MIT License: // The MIT License @@ -48,15 +56,20 @@ highp float mixNoise(highp vec2 point, highp float phase) { void fragment() { highp vec2 coord = FRAGCOORD.xy * SCREEN_PIXEL_SIZE.xy; + highp vec2 aspect = vec2(1.0/SCREEN_PIXEL_SIZE.x, 1.0/SCREEN_PIXEL_SIZE.y); + highp vec2 center = aspect * 0.5; // warp the screen. highp vec2 offset = vec2(mixNoise(coord, 0.), mixNoise(coord, 5.)); - COLOR = zTextureSpec(SCREEN_TEXTURE, coord + effectScale * DistortionScale * offset); + highp float centergradient = pow(clamp((length(center - FRAGCOORD.xy) / CenterRadius) - CenterMinDist, 0.0, 1.0), CenterPow); + COLOR = zTextureSpec(SCREEN_TEXTURE, coord + effectScale * (DistortionScale * centergradient) * offset); // apply rainbow effect. highp float hue = 1. + mixNoise(coord, 10.); highp vec3 color = hsv2rgb_smooth(vec3(hue,1.0,1.0)); - COLOR.xyz = mix(COLOR.xyz, color, MaxColorMix * effectScale * effectScale); + highp float centercolor = pow(clamp((length(center - FRAGCOORD.xy) / CenterColorRadius) - CenterColorMinDist, 0.0, 1.0), CenterColorPow); + highp float coloration = pow((COLOR.x + COLOR.y + COLOR.z) * BaseColorMult, BaseColorPow) * centercolor; + COLOR.xyz = mix(COLOR.xyz, color, MaxColorMix * effectScale * effectScale * coloration); } -- 2.51.2