From: uis Date: Thu, 4 Jan 2024 00:58:47 +0000 (+0300) Subject: Replace more of max(0, x) with saturation X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c5930497f0da9f8294cc9489f721a07ddff9888a;p=xonotic%2Fdarkplaces.git Replace more of max(0, x) with saturation Saturated sum of positive values is equal to saturated sum of saturated values --- diff --git a/shader_glsl.h b/shader_glsl.h index 8bd032ef..e56bcc1a 100644 --- a/shader_glsl.h +++ b/shader_glsl.h @@ -1698,18 +1698,18 @@ " float DepthBias1 = -DepthCenter * DepthScale1;\n", " float DepthBias2 = -DepthCenter * DepthScale2;\n", "// float DepthBias3 = -DepthCenter * DepthScale3;\n", -" float DepthShadow = max(0.0, dp_texture2D(Texture_ScreenNormalMap, ScreenTexCoord + PixelToScreenTexCoord * vec2(-1.0, 0.0)).b * DepthScale1 + DepthBias1)\n",//TODO: can saturate? -" + max(0.0, dp_texture2D(Texture_ScreenNormalMap, ScreenTexCoord + PixelToScreenTexCoord * vec2( 1.0, 0.0)).b * DepthScale1 + DepthBias1)\n", -" + max(0.0, dp_texture2D(Texture_ScreenNormalMap, ScreenTexCoord + PixelToScreenTexCoord * vec2( 0.0, -1.0)).b * DepthScale1 + DepthBias1)\n", -" + max(0.0, dp_texture2D(Texture_ScreenNormalMap, ScreenTexCoord + PixelToScreenTexCoord * vec2( 0.0, 1.0)).b * DepthScale1 + DepthBias1)\n", -" + max(0.0, dp_texture2D(Texture_ScreenNormalMap, ScreenTexCoord + PixelToScreenTexCoord * vec2(-2.0, 0.0)).b * DepthScale2 + DepthBias2)\n", -" + max(0.0, dp_texture2D(Texture_ScreenNormalMap, ScreenTexCoord + PixelToScreenTexCoord * vec2( 2.0, 0.0)).b * DepthScale2 + DepthBias2)\n", -" + max(0.0, dp_texture2D(Texture_ScreenNormalMap, ScreenTexCoord + PixelToScreenTexCoord * vec2( 0.0, -2.0)).b * DepthScale2 + DepthBias2)\n", -" + max(0.0, dp_texture2D(Texture_ScreenNormalMap, ScreenTexCoord + PixelToScreenTexCoord * vec2( 0.0, 2.0)).b * DepthScale2 + DepthBias2)\n", -"// + max(0.0, dp_texture2D(Texture_ScreenNormalMap, ScreenTexCoord + PixelToScreenTexCoord * vec2(-3.0, 0.0)).b * DepthScale3 + DepthBias3)\n", -"// + max(0.0, dp_texture2D(Texture_ScreenNormalMap, ScreenTexCoord + PixelToScreenTexCoord * vec2( 3.0, 0.0)).b * DepthScale3 + DepthBias3)\n", -"// + max(0.0, dp_texture2D(Texture_ScreenNormalMap, ScreenTexCoord + PixelToScreenTexCoord * vec2( 0.0, -3.0)).b * DepthScale3 + DepthBias3)\n", -"// + max(0.0, dp_texture2D(Texture_ScreenNormalMap, ScreenTexCoord + PixelToScreenTexCoord * vec2( 0.0, 3.0)).b * DepthScale3 + DepthBias3)\n", +" float DepthShadow = possat(dp_texture2D(Texture_ScreenNormalMap, ScreenTexCoord + PixelToScreenTexCoord * vec2(-1.0, 0.0)).b * DepthScale1 + DepthBias1)\n", +" + possat(dp_texture2D(Texture_ScreenNormalMap, ScreenTexCoord + PixelToScreenTexCoord * vec2( 1.0, 0.0)).b * DepthScale1 + DepthBias1)\n", +" + possat(dp_texture2D(Texture_ScreenNormalMap, ScreenTexCoord + PixelToScreenTexCoord * vec2( 0.0, -1.0)).b * DepthScale1 + DepthBias1)\n", +" + possat(dp_texture2D(Texture_ScreenNormalMap, ScreenTexCoord + PixelToScreenTexCoord * vec2( 0.0, 1.0)).b * DepthScale1 + DepthBias1)\n", +" + possat(dp_texture2D(Texture_ScreenNormalMap, ScreenTexCoord + PixelToScreenTexCoord * vec2(-2.0, 0.0)).b * DepthScale2 + DepthBias2)\n", +" + possat(dp_texture2D(Texture_ScreenNormalMap, ScreenTexCoord + PixelToScreenTexCoord * vec2( 2.0, 0.0)).b * DepthScale2 + DepthBias2)\n", +" + possat(dp_texture2D(Texture_ScreenNormalMap, ScreenTexCoord + PixelToScreenTexCoord * vec2( 0.0, -2.0)).b * DepthScale2 + DepthBias2)\n", +" + possat(dp_texture2D(Texture_ScreenNormalMap, ScreenTexCoord + PixelToScreenTexCoord * vec2( 0.0, 2.0)).b * DepthScale2 + DepthBias2)\n", +"// + possat(dp_texture2D(Texture_ScreenNormalMap, ScreenTexCoord + PixelToScreenTexCoord * vec2(-3.0, 0.0)).b * DepthScale3 + DepthBias3)\n", +"// + possat(dp_texture2D(Texture_ScreenNormalMap, ScreenTexCoord + PixelToScreenTexCoord * vec2( 3.0, 0.0)).b * DepthScale3 + DepthBias3)\n", +"// + possat(dp_texture2D(Texture_ScreenNormalMap, ScreenTexCoord + PixelToScreenTexCoord * vec2( 0.0, -3.0)).b * DepthScale3 + DepthBias3)\n", +"// + possat(dp_texture2D(Texture_ScreenNormalMap, ScreenTexCoord + PixelToScreenTexCoord * vec2( 0.0, 3.0)).b * DepthScale3 + DepthBias3)\n", " - 0.0;\n", " color.rgb *= sat(1.0 - DepthShadow);\n", "// color.r = DepthCenter / -1024.0;\n",