Skip to content

Commit

Permalink
Merge pull request #14 from papadanku/dev
Browse files Browse the repository at this point in the history
Cleanups
  • Loading branch information
papadanku authored Oct 26, 2024
2 parents 6afce50 + e129f2a commit 66acaae
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
18 changes: 9 additions & 9 deletions shaders/cRaySchism.fx
Original file line number Diff line number Diff line change
Expand Up @@ -101,18 +101,10 @@

uniform float _GradeLightness <
ui_category = "Color Grading | Color Adjustments";
ui_label = "Post Lightness Bias";
ui_label = "Lightness";
ui_type = "drag";
> = 0.0;

uniform float _GradeHueShift <
ui_category = "Color Grading | Color Adjustments";
ui_label = "Hue Shift";
ui_type = "slider";
ui_min = -180.0;
ui_max = 180.0;
> = 0.0;

uniform float _GradeSaturation <
ui_category = "Color Grading | Color Adjustments";
ui_label = "Saturation";
Expand All @@ -121,6 +113,14 @@ uniform float _GradeSaturation <
ui_max = 1.0;
> = 0.0;

uniform float _GradeHueShift <
ui_category = "Color Grading | Color Adjustments";
ui_label = "Hue";
ui_type = "slider";
ui_min = -180.0;
ui_max = 180.0;
> = 0.0;

uniform float _GradeContrast <
ui_category = "Color Grading | Color Adjustments";
ui_label = "Contrast";
Expand Down
15 changes: 8 additions & 7 deletions shaders/shared/cColor.fxh
Original file line number Diff line number Diff line change
Expand Up @@ -552,18 +552,16 @@

// Convert user-friendly uniform settings
float3x3 ChannelMixMat = float3x3(MixRed, MixGreen, MixBlue);
Contrast += 1.0;
HueShift = (HueShift / 360.0) * CMath_GetPi();
Lightness += 1.0;
Saturation += 1.0;
HueShift = (HueShift / 360.0) * CMath_GetPi();
Contrast += 1.0;
Temperature /= 10.0;
Tint /= 10.0;

// Convert RGB to OKLab
Color = CColor_GetOKLABfromRGB(Color);

// Apply lightness bias
Color.x += Lightness;

// Apply temperature shift
Color.z += Temperature;

Expand All @@ -573,12 +571,15 @@
// Convert OKLab to OKLch
Color = CColor_GetOKLCHfromOKLAB(Color, false);

// Apply hue shift
Color.z += HueShift;
// Apply lightness
Color.x *= Lightness;

// Apply saturation
Color.y *= Saturation;

// Apply hue shift
Color.z += HueShift;

// Convert OKLch to RGB
Color = CColor_GetRGBfromOKLCH(Color);

Expand Down

0 comments on commit 66acaae

Please sign in to comment.