Skip to content

Commit

Permalink
feat(cp2077): set gamma correction on by default
Browse files Browse the repository at this point in the history
  • Loading branch information
clshortfuse committed Nov 8, 2024
1 parent 1888d5e commit 7b387b9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 18 deletions.
6 changes: 3 additions & 3 deletions src/games/cp2077/addon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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; },
Expand Down
2 changes: 1 addition & 1 deletion src/games/cp2077/colormath.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
20 changes: 6 additions & 14 deletions src/games/cp2077/tonemapper.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 7b387b9

Please sign in to comment.