From 7cc36d257d3c24b6956bd918c8a9d0505aa0adb6 Mon Sep 17 00:00:00 2001 From: marat569 Date: Tue, 12 Nov 2024 17:02:50 -0500 Subject: [PATCH] [PATHFINDER2] Random fixs - Use sdrColor instead of saturate(color) - Fix date --- src/games/pathfinder2wotr/addon.cpp | 3 +- src/games/pathfinder2wotr/tonemapper.hlsl | 40 ++++++++++++++++------- 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/src/games/pathfinder2wotr/addon.cpp b/src/games/pathfinder2wotr/addon.cpp index 66b8e792..6e52d27c 100644 --- a/src/games/pathfinder2wotr/addon.cpp +++ b/src/games/pathfinder2wotr/addon.cpp @@ -35,6 +35,7 @@ #include "../../mods/shader.hpp" #include "../../mods/swapchain.hpp" +#include "../../utils/date.hpp" #include "../../utils/settings.hpp" #include "./shared.h" @@ -210,7 +211,7 @@ renodx::utils::settings::Settings settings = { new renodx::utils::settings::Setting{ .value_type = renodx::utils::settings::SettingValueType::TEXT, - .label = "Version: " + std::string(IsoDate), + .label = std::string("Build: ") + renodx::utils::date::ISO_DATE_TIME, .section = "About", .tooltip = std::string(__DATE__), }, diff --git a/src/games/pathfinder2wotr/tonemapper.hlsl b/src/games/pathfinder2wotr/tonemapper.hlsl index c04c4d12..b99cd132 100644 --- a/src/games/pathfinder2wotr/tonemapper.hlsl +++ b/src/games/pathfinder2wotr/tonemapper.hlsl @@ -9,7 +9,7 @@ float3 applyUserTonemap(float3 untonemapped, Texture2D lutTexture, SamplerState outputColor = untonemapped; - // Sample our lut + // Create LUT config renodx::lut::Config lut_config = renodx::lut::config::Create( lutSampler, injectedData.colorGradeLUTStrength, @@ -21,7 +21,7 @@ float3 applyUserTonemap(float3 untonemapped, Texture2D lutTexture, SamplerState // New way of handling vanilla // Lerp untonemapped with lutcolor, and saturate if (injectedData.toneMapType == 0.f) { - float3 lutColor = min(1.f, renodx::lut::Sample(lutTexture, lut_config, outputColor)); + float3 lutColor = min(1, renodx::lut::Sample(lutTexture, lut_config, outputColor)); outputColor = lerp(outputColor, lutColor, injectedData.colorGradeLUTStrength); outputColor = saturate(outputColor); } @@ -57,36 +57,54 @@ float3 applyUserTonemap(float3 untonemapped, Texture2D lutTexture, SamplerState float dicePaperWhite = injectedData.toneMapGameNits / 80.f; float dicePeakWhite = injectedData.toneMapPeakNits / 80.f; + float sdrColor = DICETonemap(outputColor * dicePaperWhite, dicePaperWhite, DICEconfig) / dicePaperWhite; outputColor = DICETonemap(outputColor * dicePaperWhite, dicePeakWhite, DICEconfig) / dicePaperWhite; - float3 lutColor = min(1.f, renodx::lut::Sample(lutTexture, lut_config, outputColor)); - outputColor = renodx::tonemap::UpgradeToneMap(outputColor, saturate(outputColor), lutColor, 1.f); + float3 lutColor = min(1, renodx::lut::Sample(lutTexture, lut_config, outputColor)); + outputColor = renodx::tonemap::UpgradeToneMap(outputColor, sdrColor, lutColor, 1.f); } else if (injectedData.toneMapType == 3.f) { // baby reinhard float ReinhardPeak = injectedData.toneMapPeakNits / injectedData.toneMapGameNits; + float3 sdrColor = renodx::tonemap::ReinhardScalable(outputColor, 1.f); outputColor = renodx::tonemap::ReinhardScalable(outputColor, ReinhardPeak); - float3 lutColor = min(1.f, renodx::lut::Sample(lutTexture, lut_config, outputColor)); - outputColor = renodx::tonemap::UpgradeToneMap(outputColor, saturate(outputColor), lutColor, 1.f); + float3 lutColor = min(1, renodx::lut::Sample(lutTexture, lut_config, outputColor)); + outputColor = renodx::tonemap::UpgradeToneMap(outputColor, sdrColor, lutColor, 1.f); } else if (injectedData.toneMapType == 4.f) { // Frostbite float frostbitePeak = injectedData.toneMapPeakNits / injectedData.toneMapGameNits; - if (any(outputColor != 0.f)) { // Avoid dividing by zero with frostbite + if (any(outputColor != 0.f)) { // Avoid dividing by zero with frostbite, still artifacts; frostbite is a WIP + float3 sdrColor = renodx::tonemap::frostbite::BT709(outputColor, 1.f); outputColor = renodx::tonemap::frostbite::BT709(outputColor, frostbitePeak); - float3 lutColor = min(1.f, renodx::lut::Sample(lutTexture, lut_config, outputColor)); // Sample our LUT - outputColor = renodx::tonemap::UpgradeToneMap(outputColor, saturate(outputColor), lutColor, 1.f); // Combine our untonemapped image with the LUT + + float3 lutColor = min(1, renodx::lut::Sample(lutTexture, lut_config, outputColor)); // Sample our LUT + outputColor = renodx::tonemap::UpgradeToneMap(outputColor, sdrColor, lutColor, 1.f); // Combine our untonemapped image with the LUT } } else if (injectedData.toneMapType == 5.f) { // RenoDRT float RenoDRTPeak = (injectedData.toneMapPeakNits / injectedData.toneMapGameNits) * 100.f; // Color, Peak, midgray, midgraynits, exposure, highlights, shadows, contrast, saturation, dechroma, flare, hueCorrectionStrength + float3 sdrColor = renodx::tonemap::renodrt::BT709(outputColor, 100.f, 0.18f, 18.f, 1.f, 1.f, 1.f, 1.f, 1.f, 0.5f, 0.f, 0.f); outputColor = renodx::tonemap::renodrt::BT709(outputColor, RenoDRTPeak, 0.18f, 18.f, 1.f, 1.f, 1.f, 1.f, 1.f, 0.5f, 0.f, 0.f); - float3 lutColor = min(1.f, renodx::lut::Sample(lutTexture, lut_config, outputColor)); - outputColor = renodx::tonemap::UpgradeToneMap(outputColor, saturate(outputColor), lutColor, 1.f); + float3 lutColor = min(1, renodx::lut::Sample(lutTexture, lut_config, outputColor)); + outputColor = renodx::tonemap::UpgradeToneMap(outputColor, sdrColor, lutColor, 1.f); } + // } else if (injectedData.toneMapType == 6.f) { // test + // float RenoDRTPeak = (injectedData.toneMapPeakNits / injectedData.toneMapGameNits) * 100.f; + + // // Color, Peak, midgray, midgraynits, exposure, highlights, shadows, contrast, saturation, dechroma, flare, hueCorrectionStrength + // float3 sdrColor = renodx::tonemap::renodrt::BT709(outputColor, 100.f, 0.18f, 18.f, 1.f, 1.f, 1.f, 1.f, 1.f, 0.5f, 0.f, 0.f); + // outputColor = renodx::tonemap::renodrt::BT709(outputColor, RenoDRTPeak, 0.18f, 18.f, 1.f, 1.f, 1.f, 1.f, 1.f, 0.5f, 0.f, 0.f); + + // // float3 lutColor = min(1.f, renodx::lut::Sample(lutTexture, lut_config, outputColor)); + // float3 lutColor = renodx::lut::Sample(lutTexture, lut_config, outputColor); + // outputColor = renodx::tonemap::UpgradeToneMap(outputColor, sdrColor, lutColor, 1.f); + // // outputColor = lutColor; + // } + if (injectedData.toneMapType != 0) { // UserColorGrading, post-tonemap outputColor = renodx::color::grade::UserColorGrading( outputColor,