From d5bd74d38d2da6a3d36303ff8ab82221c4036314 Mon Sep 17 00:00:00 2001 From: marat569 Date: Sat, 26 Oct 2024 14:33:49 -0400 Subject: [PATCH] [YS10] Cleanup - Cleanup tonemapper.hlsl - Change default ingame tonemapper to Frostbite --- src/games/ys10/addon.cpp | 4 ++-- src/games/ys10/final_0xAD51B4B0.ps_5_0.hlsl | 4 ++-- src/games/ys10/tonemapper.hlsl | 21 +-------------------- 3 files changed, 5 insertions(+), 24 deletions(-) diff --git a/src/games/ys10/addon.cpp b/src/games/ys10/addon.cpp index 56f7ae27..2c806b41 100644 --- a/src/games/ys10/addon.cpp +++ b/src/games/ys10/addon.cpp @@ -34,12 +34,12 @@ renodx::utils::settings::Settings settings = { .key = "toneMapType", .binding = &shader_injection.toneMapType, .value_type = renodx::utils::settings::SettingValueType::INTEGER, - .default_value = 2.f, + .default_value = 4.f, .can_reset = false, .label = "Tone Mapper", .section = "Tone Mapping", .tooltip = "Sets the tone mapper type", - .labels = {"Vanilla", "None", "DICE", "HDR Reinhard", "Frostbite"}, + .labels = {"Vanilla", "None", "DICE", "Reinhard+", "Frostbite"}, }, new renodx::utils::settings::Setting{ .key = "toneMapPeakNits", diff --git a/src/games/ys10/final_0xAD51B4B0.ps_5_0.hlsl b/src/games/ys10/final_0xAD51B4B0.ps_5_0.hlsl index 2893aba1..b6430d10 100644 --- a/src/games/ys10/final_0xAD51B4B0.ps_5_0.hlsl +++ b/src/games/ys10/final_0xAD51B4B0.ps_5_0.hlsl @@ -31,8 +31,8 @@ void main( // colorAP1 = max(0, colorAP1); // Clamp to AP1 // r0.rgb = mul(renodx::color::AP1_TO_BT709_MAT, colorAP1); // Clamp to AP1 - r0.rgb = renodx::math::PowSafe(r0.rgb, 2.3f); // The game does 2.3 gamma default - r0.rgb = applyUserTonemap(r0.rgb); // Send our color to tonemapper.hlsl to get processed! + r0.rgb = renodx::math::PowSafe(r0.rgb, 2.3f); // The game does 2.3 gamma default + r0.rgb = applyUserTonemap(r0.rgb); // Send our color to tonemapper.hlsl to get processed! r0.rgb *= injectedData.toneMapGameNits / 80.f; // paper white o0.rgb = r0.rgb; diff --git a/src/games/ys10/tonemapper.hlsl b/src/games/ys10/tonemapper.hlsl index 528813c9..38355ab1 100644 --- a/src/games/ys10/tonemapper.hlsl +++ b/src/games/ys10/tonemapper.hlsl @@ -4,16 +4,6 @@ #include "./DICE.hlsl" #include "./shared.h" -// HDR Baby Reinhard -- Color, peak nits/ game nits for input -float3 fast_reinhard(float3 color, float y_max = 1.f, float y_min = 0.f, float gray_in = 0.18f, float gray_out = 0.18f) { - float x = (y_max * (y_min * gray_out + y_min - gray_out)) - / (gray_in * (gray_out - y_max)); - float y = x / y_max; - float z = y_min; - float w = 1 - y_min; - - return mad(color, x, z) / mad(color, y, w); -} float3 applyUserTonemap(float3 untonemapped) { float3 outputColor; @@ -25,14 +15,6 @@ float3 applyUserTonemap(float3 untonemapped) { outputColor = untonemapped; } - float vanillaMidGray = 0.18f; - float renoDRTContrast = 1.f; - float renoDRTFlare = 0.f; - float renoDRTShadows = 1.f; - // float renoDRTDechroma = 0.8f; - float renoDRTSaturation = 1.f; // - float renoDRTHighlights = 1.f; - if (injectedData.toneMapType != 0) { // UserColorGrading, pre-tonemap outputColor.rgb = renodx::color::grade::UserColorGrading( outputColor.rgb, @@ -47,7 +29,6 @@ float3 applyUserTonemap(float3 untonemapped) { // Start tonemapper if/else if (injectedData.toneMapType == 2.f) { // DICE - DICESettings DICEconfig = DefaultDICESettings(); DICEconfig.Type = 3; DICEconfig.ShoulderStart = 0.33f; // Start shoulder @@ -59,7 +40,7 @@ float3 applyUserTonemap(float3 untonemapped) { } else if (injectedData.toneMapType == 3.f) { // baby reinhard float ReinhardPeak = injectedData.toneMapPeakNits / injectedData.toneMapGameNits; - outputColor.rgb = fast_reinhard(outputColor.rgb, ReinhardPeak); + outputColor.rgb = renodx::tonemap::ReinhardScalable(outputColor.rgb, ReinhardPeak); } else if (injectedData.toneMapType == 4.f) { // Frostbite float frostbitePeak = injectedData.toneMapPeakNits / injectedData.toneMapGameNits;