/* Description : PD80 04 Saturation Limit for Reshade https://reshade.me/ Author : prod80 (Bas Veth) License : MIT, Copyright (c) 2020 prod80 MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "ReShade.fxh" #include "ReShadeUI.fxh" #include "PD80_00_Color_Spaces.fxh" namespace pd80_satlimit { //// PREPROCESSOR DEFINITIONS /////////////////////////////////////////////////// //// UI ELEMENTS //////////////////////////////////////////////////////////////// uniform float saturation_limit < ui_type = "slider"; ui_label = "Saturation Limit"; ui_tooltip = "Saturation Limit"; ui_min = 0.0; ui_max = 1.0; > = 1.0; //// TEXTURES /////////////////////////////////////////////////////////////////// //// SAMPLERS /////////////////////////////////////////////////////////////////// //// DEFINES //////////////////////////////////////////////////////////////////// //// FUNCTIONS ////////////////////////////////////////////////////////////////// //// PIXEL SHADERS ////////////////////////////////////////////////////////////// float4 PS_Satlimit(float4 pos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target { float3 color = tex2D( ReShade::BackBuffer, texcoord ).xyz; color.xyz = RGBToHSL( color.xyz ); color.y = min( color.y, saturation_limit ); color.xyz = HSLToRGB( color.xyz ); return float4( color.xyz, 1.0f ); } //// TECHNIQUES ///////////////////////////////////////////////////////////////// technique prod80_04_Saturation_Limiter { pass prod80_pass0 { VertexShader = PostProcessVS; PixelShader = PS_Satlimit; } } }