Skip to content

Commit

Permalink
[KNK1] Add Reinhard Hue Correction
Browse files Browse the repository at this point in the history
  • Loading branch information
marat569 committed Nov 13, 2024
1 parent 58b7b75 commit 3fcb05b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
11 changes: 11 additions & 0 deletions src/games/trailsdaybreak1/addon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,17 @@ renodx::utils::settings::Settings settings = {
.max = 500.f,
},

new renodx::utils::settings::Setting{
.key = "toneMapHueCorrection",
.binding = &shader_injection.toneMapHueCorrection,
.default_value = 50.f,
.label = "Hue Correction",
.section = "Tone Mapping",
.tooltip = "Emulates hue shifting from the vanilla tonemapper",
.max = 100.f,
.parse = [](float value) { return value * 0.01f; },
},

new renodx::utils::settings::Setting{
.key = "gamma",
.binding = &shader_injection.gamma,
Expand Down
1 change: 1 addition & 0 deletions src/games/trailsdaybreak1/shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ struct ShaderInjectData {
float colorGradeContrast;
float colorGradeSaturation;
float gamma;
float toneMapHueCorrection;
};

#ifndef __cplusplus
Expand Down
7 changes: 4 additions & 3 deletions src/games/trailsdaybreak1/tonemapper.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ float3 applyUserTonemap(float3 untonemapped) {
injectedData.colorGradeShadows, // shadows
injectedData.colorGradeContrast, // contrast
1.f, // saturation, we'll do this post-tonemap
0.f, // dechroma, we don't need it
0.f); // hue correction, might not need it [yet]
0.f, // dechroma, post tonemapping
0.f); // hue correction, Post tonemapping
}

// Start tonemapper if/else
Expand Down Expand Up @@ -54,7 +54,8 @@ float3 applyUserTonemap(float3 untonemapped) {
1.f, // contrast
injectedData.colorGradeSaturation, // saturation
0.f, // dechroma, we don't need it
0.f); // hue correction, might not need it [yet]
injectedData.toneMapHueCorrection, // Hue Correction
renodx::tonemap::Reinhard(untonemapped));
}

outputColor = renodx::color::bt709::clamp::BT2020(outputColor); // Clamp to BT2020 to avoid negative colorsF
Expand Down

0 comments on commit 3fcb05b

Please sign in to comment.