Skip to content

Commit 89c7951

Browse files
committed
fix(endfield): Move color grading functions before tonemapping
1 parent 5c22871 commit 89c7951

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/games/endfield/common.hlsl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,14 @@ LUTSampleResult LUTSAMPLE(
461461
float3 lut_size,
462462
Texture2D<float4> lut_texture,
463463
float3 sample_input) {
464+
[branch]
465+
if (shader_injection.tone_map_type != 0.f) {
466+
UserGradingConfig cg_config = CreateColorGradeConfig();
467+
float sample_input_y = renodx::color::y::from::BT709(sample_input);
468+
sample_input = ApplyExposureContrastFlareHighlightsShadowsByLuminance(
469+
sample_input, sample_input_y, cg_config);
470+
}
471+
464472
renodx::lut::Config lut_config = renodx::lut::config::Create(
465473
lut_sampler,
466474
shader_injection.color_grade_strength,
@@ -508,10 +516,9 @@ float3 HDRGRADE(LUTSampleResult lut_sample) {
508516
renodx::color::bt709::from::AP1(renodx::tonemap::ReinhardPiecewise(graded_ap1, 2.f, 0.5f));
509517

510518
UserGradingConfig cg_config = CreateColorGradeConfig();
511-
float3 graded_bt709 = ApplyExposureContrastFlareHighlightsShadowsByLuminance(graded, y, cg_config);
512519

513520
float3 output = ApplySaturationBlowoutHueCorrectionHighlightSaturation(
514-
graded_bt709, hue_chrominance_reference_color, y, cg_config);
521+
graded, hue_chrominance_reference_color, y, cg_config);
515522
output = renodx::color::bt2020::from::BT709(output);
516523
output = renodx::tonemap::neutwo::MaxChannel(
517524
output, shader_injection.peak_white_nits / shader_injection.diffuse_white_nits, 65.f);

0 commit comments

Comments
 (0)