diff --git a/src/games/ys10/addon.cpp b/src/games/ys10/addon.cpp index ab578ada..6b1cc3e3 100644 --- a/src/games/ys10/addon.cpp +++ b/src/games/ys10/addon.cpp @@ -63,6 +63,18 @@ renodx::utils::settings::Settings settings = { .max = 500.f, }, + new renodx::utils::settings::Setting{ + .key = "gamma", + .binding = &shader_injection.gamma, + .value_type = renodx::utils::settings::SettingValueType::INTEGER, + .default_value = 1.f, + .can_reset = true, + .label = "Gamma", + .section = "Tone Mapping", + .tooltip = "The game defaults to 2.3 Gamma.", + .labels = {"2.2 Gamma", "2.3 Gamma"}, + }, + new renodx::utils::settings::Setting{ .key = "colorGradeExposure", .binding = &shader_injection.colorGradeExposure, @@ -177,20 +189,20 @@ BOOL APIENTRY DllMain(HMODULE h_module, DWORD fdw_reason, LPVOID lpv_reserved) { // }); // R11G11B10 - // renodx::mods::swapchain::swap_chain_upgrade_targets.push_back({.old_format = reshade::api::format::r11g11b10_float, - // .new_format = reshade::api::format::r16g16b16a16_float, - // .ignore_size = true, - // .view_upgrades = { - // {{reshade::api::resource_usage::shader_resource, - // reshade::api::format::r11g11b10_float}, - // reshade::api::format::r16g16b16a16_float}, - // {{reshade::api::resource_usage::unordered_access, - // reshade::api::format::r11g11b10_float}, - // reshade::api::format::r16g16b16a16_float}, - // {{reshade::api::resource_usage::render_target, - // reshade::api::format::r11g11b10_float}, - // reshade::api::format::r16g16b16a16_float}, - // }}); + // renodx::mods::swapchain::swap_chain_upgrade_targets.push_back({.old_format = reshade::api::format::r11g11b10_float, + // .new_format = reshade::api::format::r16g16b16a16_float, + // .ignore_size = true, + // .view_upgrades = { + // {{reshade::api::resource_usage::shader_resource, + // reshade::api::format::r11g11b10_float}, + // reshade::api::format::r16g16b16a16_float}, + // {{reshade::api::resource_usage::unordered_access, + // reshade::api::format::r11g11b10_float}, + // reshade::api::format::r16g16b16a16_float}, + // {{reshade::api::resource_usage::render_target, + // reshade::api::format::r11g11b10_float}, + // reshade::api::format::r16g16b16a16_float}, + // }}); break; case DLL_PROCESS_DETACH: diff --git a/src/games/ys10/final_0xAD51B4B0.ps_5_0.hlsl b/src/games/ys10/final_0xAD51B4B0.ps_5_0.hlsl index b6430d10..01f464df 100644 --- a/src/games/ys10/final_0xAD51B4B0.ps_5_0.hlsl +++ b/src/games/ys10/final_0xAD51B4B0.ps_5_0.hlsl @@ -27,11 +27,8 @@ void main( r0.xyz = tex.SampleLevel(smpl_s, v1.xy, 0).xyz; // Sample game, already in gamma space - // float3 colorAP1 = mul(renodx::color::BT709_TO_AP1_MAT, r0.rgb); // Clamp to AP1 - // colorAP1 = max(0, colorAP1); // Clamp to AP1 - // r0.rgb = mul(renodx::color::AP1_TO_BT709_MAT, colorAP1); // Clamp to AP1 + r0.rgb = injectedData.gamma ? renodx::math::PowSafe(r0.rgb, 2.3f) : renodx::math::PowSafe(r0.rgb, 2.2f); // The game does 2.3 gamma default - 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 diff --git a/src/games/ys10/shared.h b/src/games/ys10/shared.h index 7738cf59..43416c9b 100644 --- a/src/games/ys10/shared.h +++ b/src/games/ys10/shared.h @@ -17,6 +17,7 @@ struct ShaderInjectData { float colorGradeShadows; float colorGradeContrast; float colorGradeSaturation; + float gamma; }; #ifndef __cplusplus diff --git a/src/games/ys10/tonemapper.hlsl b/src/games/ys10/tonemapper.hlsl index 1bcbb42f..44e8748e 100644 --- a/src/games/ys10/tonemapper.hlsl +++ b/src/games/ys10/tonemapper.hlsl @@ -45,7 +45,7 @@ float3 applyUserTonemap(float3 untonemapped) { float frostbitePeak = injectedData.toneMapPeakNits / injectedData.toneMapGameNits; outputColor = renodx::tonemap::frostbite::BT709(outputColor, frostbitePeak); - outputColor = renodx::color::bt709::clamp::AP1(outputColor); // Clamp frostbite to AP1 to avoid invalid colors + outputColor = renodx::color::bt709::clamp::AP1(outputColor); // Clamp frostbite to AP1 to avoid invalid colors } if (injectedData.toneMapType != 0) { // UserColorGrading, post-tonemap