From 9dc052953b184b843b7d26e16a37259e00f7fde7 Mon Sep 17 00:00:00 2001 From: Carlos Lopez Date: Thu, 7 Nov 2024 14:55:09 -0500 Subject: [PATCH 1/5] feat(shaders): add renodrt correction_method and tone_map_type to tm_config --- src/shaders/RenoDRT.hlsl | 29 +++++++++++++------- src/shaders/tonemap.hlsl | 58 +++++++++++++++++++++++++++------------- 2 files changed, 58 insertions(+), 29 deletions(-) diff --git a/src/shaders/RenoDRT.hlsl b/src/shaders/RenoDRT.hlsl index f0b2cc57..248e993d 100644 --- a/src/shaders/RenoDRT.hlsl +++ b/src/shaders/RenoDRT.hlsl @@ -23,8 +23,15 @@ struct Config { float3 hue_correction_source; uint hue_correction_method; uint tone_map_method; + uint hue_correction_type; }; namespace config { + +namespace hue_correction_type { +static const uint INPUT = 0u; +static const uint CUSTOM = 1u; +} + namespace hue_correction_method { static const uint OKLAB = 0u; static const uint ICTCP = 1u; @@ -49,7 +56,8 @@ Config Create( float hue_correction_strength = 1.f, float3 hue_correction_source = 0, uint hue_correction_method = config::hue_correction_method::OKLAB, - uint tone_map_method = config::tone_map_method::DANIELE) { + uint tone_map_method = config::tone_map_method::DANIELE, + uint hue_correction_type = config::hue_correction_type::INPUT) { const Config renodrt_config = { nits_peak, mid_gray_value, @@ -64,7 +72,8 @@ Config Create( hue_correction_strength, hue_correction_source, hue_correction_method, - tone_map_method + tone_map_method, + hue_correction_type }; return renodrt_config; } @@ -98,18 +107,17 @@ float3 BT709(float3 bt709, Config current_config) { n = current_config.nits_peak; t_1 = current_config.flare; - float3 signs = renodx::math::Sign(bt709); - - bt709 = abs(bt709); - - float y_original = renodx::color::y::from::BT709(bt709); + float y_original = renodx::color::y::from::BT709(abs(bt709)); float3 perceptual_old; if (current_config.hue_correction_strength != 0) { + float3 source = (current_config.hue_correction_type == config::hue_correction_type::INPUT) + ? bt709 + : current_config.hue_correction_source; if (current_config.hue_correction_method == config::hue_correction_method::OKLAB) { - perceptual_old = renodx::color::oklab::from::BT709(current_config.hue_correction_source); + perceptual_old = renodx::color::oklab::from::BT709(source); } else if (current_config.hue_correction_method == config::hue_correction_method::ICTCP) { - perceptual_old = renodx::color::ictcp::from::BT709(current_config.hue_correction_source); + perceptual_old = renodx::color::ictcp::from::BT709(source); } } @@ -162,7 +170,7 @@ float3 BT709(float3 bt709, Config current_config) { float y_new = clamp(flared, 0, m_0); - float3 color_output = signs * bt709 * (y_original > 0 ? (y_new / y_original) : 0); + float3 color_output = bt709 * (y_original > 0 ? (y_new / y_original) : 0); float3 color = color_output; if (current_config.dechroma != 0.f || current_config.saturation != 1.f || current_config.hue_correction_strength != 0.f) { @@ -232,6 +240,7 @@ float3 BT709( config.flare = flare; config.hue_correction_strength = hue_correction_strength; config.hue_correction_source = hue_correction_source; + config.hue_correction_type = renodrt::config::hue_correction_type::CUSTOM; return BT709(bt709, config); } float3 BT709( diff --git a/src/shaders/tonemap.hlsl b/src/shaders/tonemap.hlsl index 0d9f0cda..baa2a474 100644 --- a/src/shaders/tonemap.hlsl +++ b/src/shaders/tonemap.hlsl @@ -163,7 +163,8 @@ struct Config { float hue_correction_type; float hue_correction_strength; float3 hue_correction_color; - renodrt::Config reno_drt_config; + uint reno_drt_hue_correction_method; + uint reno_drt_tone_map_method; }; float3 UpgradeToneMap(float3 color_hdr, float3 color_sdr, float3 post_process_color, float post_process_strength) { @@ -225,7 +226,9 @@ Config Create( float reno_drt_flare = 0.f, float hue_correction_type = config::hue_correction_type::INPUT, float hue_correction_strength = 1.f, - float3 hue_correction_color = 0) { + float3 hue_correction_color = 0, + uint reno_drt_hue_correction_method = renodrt::config::hue_correction_method::OKLAB, + uint reno_drt_tone_map_method = renodrt::config::tone_map_method::DANIELE) { const Config tm_config = { type, peak_nits, @@ -247,7 +250,8 @@ Config Create( hue_correction_type, hue_correction_strength, hue_correction_color, - renodrt::config::Create(), + reno_drt_hue_correction_method, + reno_drt_tone_map_method }; return tm_config; } @@ -258,22 +262,30 @@ float3 ApplyRenoDRT(float3 color, Config tm_config, bool sdr = false) { reno_drt_max = renodx::color::correct::Gamma(reno_drt_max, tm_config.gamma_correction == 1.f); } - return renodx::tonemap::renodrt::BT709( - color, - reno_drt_max * 100.f, - 0.18f, - tm_config.mid_gray_nits, - tm_config.exposure, - tm_config.reno_drt_highlights, - tm_config.reno_drt_shadows, - tm_config.reno_drt_contrast, - tm_config.reno_drt_saturation, - tm_config.reno_drt_dechroma, - tm_config.reno_drt_flare, - tm_config.hue_correction_strength, - (tm_config.hue_correction_type == config::hue_correction_type::CUSTOM) ? tm_config.hue_correction_color - : (tm_config.hue_correction_type == config::hue_correction_type::CLAMPED) ? clamp(color, 0, 1) - : color); + renodrt::Config reno_drt_config = renodrt::config::Create(); + reno_drt_config.nits_peak = reno_drt_max * 100.f; + reno_drt_config.mid_gray_value = 0.18f; + reno_drt_config.mid_gray_nits = tm_config.mid_gray_nits; + reno_drt_config.exposure = tm_config.exposure; + reno_drt_config.highlights = tm_config.reno_drt_highlights; + reno_drt_config.shadows = tm_config.reno_drt_shadows; + reno_drt_config.contrast = tm_config.reno_drt_contrast; + reno_drt_config.saturation = tm_config.reno_drt_saturation; + reno_drt_config.dechroma = tm_config.reno_drt_dechroma; + reno_drt_config.flare = tm_config.reno_drt_flare; + reno_drt_config.hue_correction_strength = tm_config.hue_correction_strength; + reno_drt_config.hue_correction_type = renodrt::config::hue_correction_type::CUSTOM; + if (tm_config.hue_correction_type == config::hue_correction_type::CUSTOM) { + reno_drt_config.hue_correction_source = tm_config.hue_correction_color; + } else if (tm_config.hue_correction_type == config::hue_correction_type::CLAMPED) { + reno_drt_config.hue_correction_source = tm_config.hue_correction_color; + } else { + reno_drt_config.hue_correction_source = color; + } + reno_drt_config.hue_correction_method = tm_config.reno_drt_hue_correction_method; + reno_drt_config.tone_map_method = tm_config.reno_drt_tone_map_method; + + return renodrt::BT709(color, reno_drt_config); } float3 ApplyACES(float3 color, Config tm_config, bool sdr = false) { @@ -308,6 +320,10 @@ float3 Apply(float3 untonemapped, Config tm_config) { tm_config.reno_drt_saturation *= tm_config.saturation; // tm_config.reno_drt_dechroma *= tm_config.dechroma; color = ApplyRenoDRT(color, tm_config); + tm_config.reno_drt_highlights /= tm_config.highlights; + tm_config.reno_drt_shadows /= tm_config.shadows; + tm_config.reno_drt_contrast /= tm_config.contrast; + tm_config.reno_drt_saturation /= tm_config.saturation; } else { color = renodx::color::grade::UserColorGrading( color, @@ -346,6 +362,10 @@ DualToneMap ApplyToneMaps(float3 color_input, Config tm_config) { color_hdr = ApplyRenoDRT(color_input, tm_config); tm_config.hue_correction_type = previous_hue_correction_type; + tm_config.reno_drt_saturation /= tm_config.saturation; + tm_config.reno_drt_highlights /= tm_config.highlights; + tm_config.reno_drt_shadows /= tm_config.shadows; + tm_config.reno_drt_contrast /= tm_config.contrast; } else { color_input = renodx::color::grade::UserColorGrading( From cd253194c72feb111a509f06c3b6c182b21b4d80 Mon Sep 17 00:00:00 2001 From: Carlos Lopez Date: Thu, 7 Nov 2024 16:40:38 -0500 Subject: [PATCH 2/5] feat(shaders): add ictcp hue correction --- src/shaders/colorcorrect.hlsl | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/shaders/colorcorrect.hlsl b/src/shaders/colorcorrect.hlsl index 887ae6af..6ec80f45 100644 --- a/src/shaders/colorcorrect.hlsl +++ b/src/shaders/colorcorrect.hlsl @@ -49,7 +49,7 @@ float4 GammaSafe(float4 color, bool pow2srgb = false) { return float4(GammaSafe(color.rgb, pow2srgb), color.a); } -float3 Hue(float3 incorrect_color, float3 correct_color, float strength = 1.f) { +float3 HueOKLab(float3 incorrect_color, float3 correct_color, float strength = 1.f) { if (strength == 0.f) return incorrect_color; float3 correct_lab = renodx::color::oklab::from::BT709(correct_color); @@ -71,6 +71,35 @@ float3 Hue(float3 incorrect_color, float3 correct_color, float strength = 1.f) { return color; } +float3 HueICtCp(float3 incorrect_color, float3 correct_color, float strength = 1.f) { + if (strength == 0.f) return incorrect_color; + + float3 correct_perceptual = renodx::color::ictcp::from::BT709(correct_color); + + float3 incorrect_perceptual = renodx::color::ictcp::from::BT709(incorrect_color); + + float chrominance_pre_adjust = distance(incorrect_perceptual.yz, 0); + + incorrect_perceptual.yz = lerp(incorrect_perceptual.yz, correct_perceptual.yz, strength); + + float chrominance_post_adjust = distance(incorrect_perceptual.yz, 0); + + if (chrominance_post_adjust != 0.f) { + incorrect_perceptual.yz *= chrominance_pre_adjust / chrominance_post_adjust; + } + + float3 color = renodx::color::bt709::from::ICtCp(incorrect_perceptual); + color = renodx::color::bt709::clamp::AP1(color); + return color; +} + +float3 Hue(float3 incorrect_color, float3 correct_color, float strength = 1.f, uint method = 0u) { + if (method == 1u) { + return HueICtCp(incorrect_color, correct_color, strength); + } + return HueOKLab(incorrect_color, correct_color, strength); +} + } // namespace correct } // namespace color } // namespace renodx From cb9c520f07a1d2189ea6dc9f0d9032a8f385ad24 Mon Sep 17 00:00:00 2001 From: Carlos Lopez Date: Thu, 7 Nov 2024 16:41:39 -0500 Subject: [PATCH 3/5] fix(shaders): support negative BT709 in CorrectBlack and CorrectWhite --- src/shaders/lut.hlsl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/shaders/lut.hlsl b/src/shaders/lut.hlsl index 45ebf606..44a9e0f0 100644 --- a/src/shaders/lut.hlsl +++ b/src/shaders/lut.hlsl @@ -157,8 +157,8 @@ float3 SampleUnreal(Texture2D lut, SamplerState state, float3 color, float size } float3 CorrectBlack(float3 color_input, float3 lut_color, float lut_black_y, float strength) { - const float input_y = renodx::color::y::from::BT709(color_input); - const float color_y = renodx::color::y::from::BT709(lut_color); + const float input_y = renodx::color::y::from::BT709(abs(color_input)); + const float color_y = renodx::color::y::from::BT709(abs(lut_color)); const float a = lut_black_y; const float b = lerp(0, lut_black_y, strength); const float g = input_y; @@ -169,8 +169,8 @@ float3 CorrectBlack(float3 color_input, float3 lut_color, float lut_black_y, flo } float3 CorrectWhite(float3 color_input, float3 lut_color, float lut_white_y, float target_white_y, float strength) { - const float input_y = min(target_white_y, renodx::color::y::from::BT709(color_input)); - const float color_y = renodx::color::y::from::BT709(lut_color); + const float input_y = min(target_white_y, renodx::color::y::from::BT709(abs(color_input))); + const float color_y = renodx::color::y::from::BT709(abs(lut_color)); const float a = lut_white_y / target_white_y; const float b = lerp(1.f, 0.f, strength); const float g = input_y; From 1888d5e58eafd43335fb80a1ac258a134d23123d Mon Sep 17 00:00:00 2001 From: Carlos Lopez Date: Thu, 7 Nov 2024 16:42:29 -0500 Subject: [PATCH 4/5] feat(cp2077): add ictcp option, support negative LUT black point --- src/games/cp2077/addon.cpp | 11 ++++++ src/games/cp2077/cp2077.h | 3 +- src/games/cp2077/tonemapper.hlsl | 57 ++++++++++++++++++-------------- 3 files changed, 46 insertions(+), 25 deletions(-) diff --git a/src/games/cp2077/addon.cpp b/src/games/cp2077/addon.cpp index 3f2a2357..d3f2aecb 100644 --- a/src/games/cp2077/addon.cpp +++ b/src/games/cp2077/addon.cpp @@ -127,6 +127,17 @@ renodx::utils::settings::Settings settings = { .tooltip = "Applies hue shift emulation before tonemapping", .labels = {"None", "Reinhard", "ACES BT709", "ACES AP1", "Filmic"}, }, + new renodx::utils::settings::Setting{ + .key = "toneMapHueProcessor", + .binding = &shader_injection.toneMapHueProcessor, + .value_type = renodx::utils::settings::SettingValueType::INTEGER, + .default_value = 0.f, + .can_reset = false, + .label = "Hue Processor", + .section = "Tone Mapping", + .tooltip = "Selects hue processor", + .labels = {"OKLab", "ICtCp" }, + }, new renodx::utils::settings::Setting{ .key = "colorGradeExposure", .binding = &shader_injection.colorGradeExposure, diff --git a/src/games/cp2077/cp2077.h b/src/games/cp2077/cp2077.h index 94cea225..10e74db7 100644 --- a/src/games/cp2077/cp2077.h +++ b/src/games/cp2077/cp2077.h @@ -8,7 +8,7 @@ // Must be 32bit aligned // Should be 4x32 // 27 max for pixel/vertex -// 49 max for 49 +// 49 max for compute struct ShaderInjectData { float toneMapType; @@ -16,6 +16,7 @@ struct ShaderInjectData { float toneMapGameNits; float toneMapGammaCorrection; float toneMapHueCorrection; + float toneMapHueProcessor; float fxBloom; float fxVignette; diff --git a/src/games/cp2077/tonemapper.hlsl b/src/games/cp2077/tonemapper.hlsl index bf042aa5..92b4c221 100644 --- a/src/games/cp2077/tonemapper.hlsl +++ b/src/games/cp2077/tonemapper.hlsl @@ -5,15 +5,15 @@ #include "./injectedBuffer.hlsl" static const float HEATMAP_COLORS[27] = { - 0.0f, 0.0f, 0.0f, // Black - 0.0f, 0.0f, 1.0f, // Blue - 0.0f, 1.0f, 1.0f, // Cyan - 0.0f, 1.0f, 0.0f, // Green - 1.0f, 1.0f, 0.0f, // Yellow - 1.0f, 0.0f, 0.0f, // Red - 1.0f, 0.0f, 1.0f, // Magenta - 1.0f, 1.0f, 1.0f, // White - 1.0f, 1.0f, 1.0f, // White + 0.0f, 0.0f, 0.0f, // Black + 0.0f, 0.0f, 1.0f, // Blue + 0.0f, 1.0f, 1.0f, // Cyan + 0.0f, 1.0f, 0.0f, // Green + 1.0f, 1.0f, 0.0f, // Yellow + 1.0f, 0.0f, 0.0f, // Red + 1.0f, 0.0f, 1.0f, // Magenta + 1.0f, 1.0f, 1.0f, // White + 1.0f, 1.0f, 1.0f, // White }; static const float SQRT_HALF = sqrt(1.f / 2.f); // 0.7071067811865476 @@ -220,8 +220,8 @@ float3 SampleLUT(float4 lutSettings, const float3 inputColor, uint textureIndex) renodx::color::srgb::Decode(unclamped)); color = lerp(color, recolored, min(injectedData.processingLUTCorrection * 2.f, 1.f)); } else { - const float lutMinY = renodx::color::y::from::BT709(minBlack); - const float lutPeakY = renodx::color::y::from::BT709(peakWhite); + const float lutMinY = renodx::color::y::from::BT709(abs(minBlack)); + const float lutPeakY = renodx::color::y::from::BT709(abs(peakWhite)); const float targetPeakY = 100.f / max(lutSettings.z, 1.f); // Only applies on LUTs that are clamped (all?) @@ -325,7 +325,7 @@ float4 tonemap(bool isACESMode = false) { const float hueShift = cb6[7u].z; // Add branch to skip if not hue shifting - if (hueShift) { + if (hueShift != 0.f) { float _260 = sin(hueShift); // sin(0) float _261 = cos(hueShift); // cos(0) float _262 = (-0.0f) - _260; @@ -399,14 +399,22 @@ float4 tonemap(bool isACESMode = false) { outputRGB *= exposure; } + float3 correction_source; + bool skip_correction = false; if (injectedData.toneMapHueCorrection == 1.f) { - outputRGB = renodx::color::correct::Hue(outputRGB, renodx::tonemap::Reinhard(outputRGB)); + correction_source = renodx::tonemap::Reinhard(outputRGB); } else if (injectedData.toneMapHueCorrection == 2.f) { - outputRGB = renodx::color::correct::Hue(outputRGB, renodx::tonemap::ACESFittedBT709(outputRGB)); + correction_source = renodx::tonemap::ACESFittedBT709(outputRGB); } else if (injectedData.toneMapHueCorrection == 3.f) { - outputRGB = renodx::color::correct::Hue(outputRGB, renodx::tonemap::ACESFittedAP1(outputRGB)); + correction_source = renodx::tonemap::ACESFittedAP1(outputRGB); } else if (injectedData.toneMapHueCorrection == 4.f) { - outputRGB = renodx::color::correct::Hue(outputRGB, renodx::tonemap::uncharted2::BT709(outputRGB)); + correction_source = renodx::tonemap::uncharted2::BT709(outputRGB); + } else { + skip_correction = true; + } + + if (!skip_correction) { + outputRGB = renodx::color::correct::Hue(outputRGB, correction_source, 1.f, (uint)injectedData.toneMapHueProcessor); } if (toneMapperType == TONE_MAPPER_TYPE__VANILLA) { @@ -439,13 +447,13 @@ float4 tonemap(bool isACESMode = false) { // Scales with paperwhite, which can be reversed const SegmentedSplineParams_c9 ODT_CONFIG = { - {cb6[8u].x, cb6[9u].x, cb6[10u].x, cb6[11u].x, cb6[12u].x, cb6[13u].x, cb6[14u].x, cb6[15u].x, cb6[16u].x, cb6[17u].x}, // coefsLow[10] - {cb6[8u].y, cb6[9u].y, cb6[10u].y, cb6[11u].y, cb6[12u].y, cb6[13u].y, cb6[14u].y, cb6[15u].y, cb6[16u].y, cb6[17u].y}, // coefsHigh[10] - {cb6[18u].x, cb6[18u].y}, // minPoint - {cb6[18u].z, midGrayNits}, // midPoint - {cb6[19u].x, cb6[19u].y}, // maxPoint - doesn't always match peak nits? - cb6[19u].z, // slopeLow - cb6[19u].w // slopeHigh + { cb6[8u].x, cb6[9u].x, cb6[10u].x, cb6[11u].x, cb6[12u].x, cb6[13u].x, cb6[14u].x, cb6[15u].x, cb6[16u].x, cb6[17u].x }, // coefsLow[10] + { cb6[8u].y, cb6[9u].y, cb6[10u].y, cb6[11u].y, cb6[12u].y, cb6[13u].y, cb6[14u].y, cb6[15u].y, cb6[16u].y, cb6[17u].y }, // coefsHigh[10] + { cb6[18u].x, cb6[18u].y }, // minPoint + { cb6[18u].z, midGrayNits }, // midPoint + { cb6[19u].x, cb6[19u].y }, // maxPoint - doesn't always match peak nits? + cb6[19u].z, // slopeLow + cb6[19u].w // slopeHigh }; float yRange = peakNits - minNits; @@ -550,7 +558,7 @@ float4 tonemap(bool isACESMode = false) { config.type = injectedData.toneMapType; config.peak_nits = injectedData.toneMapPeakNits; config.game_nits = (injectedData.toneMapType == 2.f ? (100.f / 203.f) : 1.f) * injectedData.toneMapGameNits; - config.gamma_correction = injectedData.toneMapGammaCorrection == 2.f; + config.gamma_correction = (injectedData.toneMapGammaCorrection == 2.f) ? 1.f : 0.f; config.exposure = injectedData.colorGradeExposure; config.highlights = injectedData.colorGradeHighlights; config.shadows = injectedData.colorGradeShadows; @@ -564,6 +572,7 @@ float4 tonemap(bool isACESMode = false) { config.reno_drt_saturation = 1.20f; config.reno_drt_dechroma = injectedData.colorGradeBlowout; config.reno_drt_flare = 0.10f * pow(injectedData.colorGradeFlare, 10.f); + config.reno_drt_hue_correction_method = (uint)injectedData.toneMapHueProcessor; outputRGB = renodx::tonemap::config::Apply(outputRGB, config); bool useD60 = (injectedData.colorGradeWhitePoint == -1.0f || (injectedData.colorGradeWhitePoint == 0.f && cb6[28u].z == 0.f)); From 7b387b92790129fd0707125d27b13dc0d4bea2cd Mon Sep 17 00:00:00 2001 From: Carlos Lopez Date: Thu, 7 Nov 2024 19:57:23 -0500 Subject: [PATCH 5/5] feat(cp2077): set gamma correction on by default --- src/games/cp2077/addon.cpp | 6 +++--- src/games/cp2077/colormath.hlsl | 2 +- src/games/cp2077/tonemapper.hlsl | 20 ++++++-------------- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/src/games/cp2077/addon.cpp b/src/games/cp2077/addon.cpp index d3f2aecb..e97fa589 100644 --- a/src/games/cp2077/addon.cpp +++ b/src/games/cp2077/addon.cpp @@ -109,7 +109,7 @@ renodx::utils::settings::Settings settings = { .key = "toneMapGammaCorrection", .binding = &shader_injection.toneMapGammaCorrection, .value_type = renodx::utils::settings::SettingValueType::INTEGER, - .default_value = 0.f, + .default_value = 2.f, .can_reset = false, .label = "Gamma Correction", .section = "Tone Mapping", @@ -131,7 +131,7 @@ renodx::utils::settings::Settings settings = { .key = "toneMapHueProcessor", .binding = &shader_injection.toneMapHueProcessor, .value_type = renodx::utils::settings::SettingValueType::INTEGER, - .default_value = 0.f, + .default_value = 1.f, .can_reset = false, .label = "Hue Processor", .section = "Tone Mapping", @@ -200,7 +200,7 @@ renodx::utils::settings::Settings settings = { .default_value = 50.f, .label = "Flare", .section = "Color Grading", - .tooltip = "Flare/Glare", + .tooltip = "Flare/Glare Compensation", .max = 100.f, .is_enabled = []() { return shader_injection.toneMapType == 3; }, .parse = [](float value) { return value * 0.02f; }, diff --git a/src/games/cp2077/colormath.hlsl b/src/games/cp2077/colormath.hlsl index 1d9a324b..a2733546 100644 --- a/src/games/cp2077/colormath.hlsl +++ b/src/games/cp2077/colormath.hlsl @@ -84,7 +84,7 @@ float3 convertColor(float3 inputColor, ConvertColorParams params) { default: // Unknown default case outputColor *= params.paperWhiteScaling; - outputColor += params.blackFloorAdjust; + // outputColor += params.blackFloorAdjust; } return outputColor.rgb; } diff --git a/src/games/cp2077/tonemapper.hlsl b/src/games/cp2077/tonemapper.hlsl index 92b4c221..bfc7b584 100644 --- a/src/games/cp2077/tonemapper.hlsl +++ b/src/games/cp2077/tonemapper.hlsl @@ -399,22 +399,14 @@ float4 tonemap(bool isACESMode = false) { outputRGB *= exposure; } - float3 correction_source; - bool skip_correction = false; if (injectedData.toneMapHueCorrection == 1.f) { - correction_source = renodx::tonemap::Reinhard(outputRGB); + outputRGB = renodx::color::correct::Hue(outputRGB, renodx::tonemap::Reinhard(outputRGB), 1.f, (uint)injectedData.toneMapHueProcessor); } else if (injectedData.toneMapHueCorrection == 2.f) { - correction_source = renodx::tonemap::ACESFittedBT709(outputRGB); + outputRGB = renodx::color::correct::Hue(outputRGB, renodx::tonemap::ACESFittedBT709(outputRGB), 1.f, (uint)injectedData.toneMapHueProcessor); } else if (injectedData.toneMapHueCorrection == 3.f) { - correction_source = renodx::tonemap::ACESFittedAP1(outputRGB); + outputRGB = renodx::color::correct::Hue(outputRGB, renodx::tonemap::ACESFittedAP1(outputRGB), 1.f, (uint)injectedData.toneMapHueProcessor); } else if (injectedData.toneMapHueCorrection == 4.f) { - correction_source = renodx::tonemap::uncharted2::BT709(outputRGB); - } else { - skip_correction = true; - } - - if (!skip_correction) { - outputRGB = renodx::color::correct::Hue(outputRGB, correction_source, 1.f, (uint)injectedData.toneMapHueProcessor); + outputRGB = renodx::color::correct::Hue(outputRGB, renodx::tonemap::uncharted2::BT709(outputRGB), 1.f, (uint)injectedData.toneMapHueProcessor); } if (toneMapperType == TONE_MAPPER_TYPE__VANILLA) { @@ -568,10 +560,10 @@ float4 tonemap(bool isACESMode = false) { config.mid_gray_nits = midGrayNits; config.reno_drt_highlights = 1.20f; config.reno_drt_shadows = 1.20f; - config.reno_drt_contrast = 1.20f; + config.reno_drt_contrast = 1.3f; config.reno_drt_saturation = 1.20f; config.reno_drt_dechroma = injectedData.colorGradeBlowout; - config.reno_drt_flare = 0.10f * pow(injectedData.colorGradeFlare, 10.f); + config.reno_drt_flare = 0.005 * injectedData.colorGradeFlare; config.reno_drt_hue_correction_method = (uint)injectedData.toneMapHueProcessor; outputRGB = renodx::tonemap::config::Apply(outputRGB, config);