Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[YS10] Clamp frostbite to AP1 #37

Merged
merged 1 commit into from
Oct 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/games/ys10/addon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,22 @@ BOOL APIENTRY DllMain(HMODULE h_module, DWORD fdw_reason, LPVOID lpv_reserved) {
// .new_format = reshade::api::format::r16g16b16a16_float,
// });

// 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},
// }});

break;
case DLL_PROCESS_DETACH:
reshade::unregister_addon(h_module);
Expand Down
3 changes: 2 additions & 1 deletion src/games/ys10/tonemapper.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include "./DICE.hlsl"
#include "./shared.h"


float3 applyUserTonemap(float3 untonemapped) {
float3 outputColor;

Expand Down Expand Up @@ -45,6 +44,8 @@ float3 applyUserTonemap(float3 untonemapped) {
} else if (injectedData.toneMapType == 4.f) { // Frostbite
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
}

if (injectedData.toneMapType != 0) { // UserColorGrading, post-tonemap
Expand Down
Loading