diff --git a/shaders/cAutoExposure.fx b/shaders/cAutoExposure.fx index f6aa0ac..e38990a 100644 --- a/shaders/cAutoExposure.fx +++ b/shaders/cAutoExposure.fx @@ -1,5 +1,6 @@ #include "shared/cMacros.fxh" #include "shared/cGraphics.fxh" +#include "shared/cTonemap.fxh" /* Automatic exposure shader using hardware blending @@ -129,11 +130,11 @@ float3 PS_Exposure(VS2PS_Quad Input) : SV_TARGET0 float3 Color1 = ExposedColor.rgb; float3 Color2 = lerp(Dot * 2.0, Color.rgb, Mask * 0.5); - return lerp(Color1, Color2, Mask).rgb; + return lerp(ApplyTonemap(Color1), Color2, Mask).rgb; } else { - return ExposedColor; + return ApplyTonemap(ExposedColor); } } diff --git a/shaders/cBloom.fx b/shaders/cBloom.fx index 93fb84c..db45867 100644 --- a/shaders/cBloom.fx +++ b/shaders/cBloom.fx @@ -1,11 +1,13 @@ #include "shared/cBuffers.fxh" #include "shared/cGraphics.fxh" +#include "shared/cTonemap.fxh" /* [Shader Options] */ uniform float _Threshold < + ui_category = "Bloom"; ui_label = "Threshold"; ui_type = "slider"; ui_min = 0.0; @@ -13,6 +15,7 @@ uniform float _Threshold < > = 0.8; uniform float _Smooth < + ui_category = "Bloom"; ui_label = "Smoothing"; ui_type = "slider"; ui_min = 0.0; @@ -20,6 +23,7 @@ uniform float _Smooth < > = 0.5; uniform float _Saturation < + ui_category = "Bloom"; ui_label = "Saturation"; ui_type = "slider"; ui_min = 0.0; @@ -27,6 +31,7 @@ uniform float _Saturation < > = 1.0; uniform float3 _ColorShift < + ui_category = "Bloom"; ui_label = "Color Shift (RGB)"; ui_type = "color"; ui_min = 0.0; @@ -34,6 +39,7 @@ uniform float3 _ColorShift < > = 1.0; uniform float _Intensity < + ui_category = "Bloom"; ui_label = "Intensity"; ui_type = "slider"; ui_min = 0.0; @@ -275,7 +281,7 @@ float4 PS_Composite(VS2PS_Quad Input) : SV_TARGET0 float3 BloomColor = tex2D(SampleTempTex1, Input.Tex0).rgb; float4 Color = 1.0; - Color.rgb = ToneMapACESFilmic(BaseColor + (BloomColor * _Intensity)); + Color.rgb = ApplyTonemap(BaseColor + (BloomColor * _Intensity)); return Color; } diff --git a/shaders/shared/cTonemap.fxh b/shaders/shared/cTonemap.fxh index 574ab6f..6e3b6e7 100644 --- a/shaders/shared/cTonemap.fxh +++ b/shaders/shared/cTonemap.fxh @@ -80,4 +80,27 @@ return 0.5 * (D * SDR - sqrt(((D*D - 4.0*C*E) * SDR + 4.0*A*E-2.0*B*D) * SDR + B*B) - B) / (A - C * SDR); } + uniform int _OutputTonemapOperator < + ui_category = "OUTPUT"; + ui_label = "Tonemap Operator"; + ui_tooltip = "Select a tonemap operator for the output"; + ui_type = "combo"; + ui_items = "Reinhard\0DirectX Graphics Sample\0ACES Filmic Approximation\0"; + > = 0; + + float3 ApplyTonemap(float3 HDR) + { + switch (_OutputTonemapOperator) + { + case 0: + return ApplyReinhardTonemap(HDR, 1.0); + case 1: + return ApplyNewToneMap(HDR); + case 2: + return ApplyToneMapACES(HDR); + default: + return HDR; + } + } + #endif