Skip to content

Commit

Permalink
fix(huecorrection): fix chroma restore
Browse files Browse the repository at this point in the history
  • Loading branch information
clshortfuse committed Aug 11, 2024
1 parent 2da9e5f commit 3417f35
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/shaders/RenoDRT.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ float3 BT709(
if (hue_correction_strength == 1.f) {
lch_new[2] = restore_lch[2]; // Full hue override
} else {
lab_new = float3(lab_new[0], lerp(lab_new.yz, restore_lab.yz, hue_correction_strength));
float3 lch_temp = lab_new = renodx::color::oklch::from::OkLab(lab_new);
lch_temp[1] = lch_new[1]; // custom chroma restore
lch_new = lch_temp;
float old_chroma = lch_new[1]; // Store old chroma
lab_new.yz = lerp(lab_new.yz, restore_lab.yz, hue_correction_strength);
lch_new = renodx::color::oklch::from::OkLab(lab_new);
lch_new[1] = old_chroma; // chroma restore
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/shaders/colorgrade.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ float3 UserColorGrading(
if (hue_correction_strength == 1.f) {
lch_new[2] = restore_lch[2]; // Full hue override
} else {
lab_new = float3(lab_new[0], lerp(lab_new.yz, restore_lab.yz, hue_correction_strength));
float3 lch_temp = lab_new = renodx::color::oklch::from::OkLab(lab_new);
lch_temp[1] = lch_new[1]; // custom chroma restore
lch_new = lch_temp;
float old_chroma = lch_new[1]; // Store old chroma
lab_new.yz = lerp(lab_new.yz, restore_lab.yz, hue_correction_strength);
lch_new = renodx::color::oklch::from::OkLab(lab_new);
lch_new[1] = old_chroma; // chroma restore
}
}

Expand Down

0 comments on commit 3417f35

Please sign in to comment.