diff --git a/shaders/cLens.fx b/shaders/cLens.fx index 3fe2c4c..9478966 100644 --- a/shaders/cLens.fx +++ b/shaders/cLens.fx @@ -39,7 +39,7 @@ uniform float _Time < source = "timer"; >; uniform bool _UseTimeSeed < - ui_label = "Enable Time-Based Seed"; + ui_label = "Enable Time Seed"; ui_type = "radio"; > = true; diff --git a/shaders/cRaySchism.fx b/shaders/cRaySchism.fx index 6cb23c1..d1dfcc1 100644 --- a/shaders/cRaySchism.fx +++ b/shaders/cRaySchism.fx @@ -99,28 +99,12 @@ > = false; #endif -uniform float _GradePostExposure < +uniform float _GradeLightness < ui_category = "Color Grading | Color Adjustments"; - ui_label = "Post Exposure"; + ui_label = "Post Lightness Bias"; ui_type = "drag"; > = 0.0; -uniform float _GradeContrast < - ui_category = "Color Grading | Color Adjustments"; - ui_label = "Contrast"; - ui_type = "slider"; - ui_min = -1.0; - ui_max = 1.0; -> = 0.0; - -uniform float3 _GradeColorFilter < - ui_category = "Color Grading | Color Adjustments"; - ui_label = "Color Filter"; - ui_type = "color"; - ui_min = 0.0; - ui_max = 1.0; -> = 1.0; - uniform float _GradeHueShift < ui_category = "Color Grading | Color Adjustments"; ui_label = "Hue Shift"; @@ -137,6 +121,22 @@ uniform float _GradeSaturation < ui_max = 1.0; > = 0.0; +uniform float _GradeContrast < + ui_category = "Color Grading | Color Adjustments"; + ui_label = "Contrast"; + ui_type = "slider"; + ui_min = -1.0; + ui_max = 1.0; +> = 0.0; + +uniform float3 _GradeColorFilter < + ui_category = "Color Grading | Color Adjustments"; + ui_label = "Color Filter"; + ui_type = "color"; + ui_min = 0.0; + ui_max = 1.0; +> = 1.0; + uniform float _GradeTemperature < ui_category = "Color Grading | White Balance"; ui_label = "Temperature"; @@ -198,7 +198,7 @@ uniform float3 _GradeMixBlue < > = float3(0.0, 0.0, 1.0); uniform float3 _GradeMidtoneShadowColor < - ui_category = "Color Grading | Shadows Midtones Hightlights"; + ui_category = "Color Grading | Shadows, Midtones, Hightlights"; ui_label = "Shadow Color"; ui_type = "color"; ui_min = 0.0; @@ -206,7 +206,7 @@ uniform float3 _GradeMidtoneShadowColor < > = float3(1.0, 1.0, 1.0); uniform float3 _GradeMidtoneColor < - ui_category = "Color Grading | Shadows Midtones Hightlights"; + ui_category = "Color Grading | Shadows, Midtones, Hightlights"; ui_label = "Midtone Color"; ui_type = "color"; ui_min = 0.0; @@ -214,7 +214,7 @@ uniform float3 _GradeMidtoneColor < > = float3(1.0, 1.0, 1.0); uniform float3 _GradeMidtoneHighlightColor < - ui_category = "Color Grading | Shadows Midtones Hightlights"; + ui_category = "Color Grading | Shadows, Midtones, Hightlights"; ui_label = "Highlight Color"; ui_type = "color"; ui_min = 0.0; @@ -222,7 +222,7 @@ uniform float3 _GradeMidtoneHighlightColor < > = float3(1.0, 1.0, 1.0); uniform float _GradeMidtoneShadowStart < - ui_category = "Color Grading | Shadows Midtones Hightlights"; + ui_category = "Color Grading | Shadows, Midtones, Hightlights"; ui_label = "Shadows Start"; ui_type = "slider"; ui_min = 0.0; @@ -230,7 +230,7 @@ uniform float _GradeMidtoneShadowStart < > = 0.0; uniform float _GradeMidtoneShadowEnd < - ui_category = "Color Grading | Shadows Midtones Hightlights"; + ui_category = "Color Grading | Shadows, Midtones, Hightlights"; ui_label = "Shadows End"; ui_type = "slider"; ui_min = 0.0; @@ -238,7 +238,7 @@ uniform float _GradeMidtoneShadowEnd < > = 0.3; uniform float _GradeMidtoneHighlightStart < - ui_category = "Color Grading | Shadows Midtones Hightlights"; + ui_category = "Color Grading | Shadows, Midtones, Hightlights"; ui_label = "Highlights Start"; ui_type = "slider"; ui_min = 0.0; @@ -246,7 +246,7 @@ uniform float _GradeMidtoneHighlightStart < > = 0.55; uniform float _GradeMidtoneHighlightEnd < - ui_category = "Color Grading | Shadows Midtones Hightlights"; + ui_category = "Color Grading | Shadows, Midtones, Hightlights"; ui_label = "Highlights End"; ui_type = "slider"; ui_min = 0.0; @@ -499,11 +499,11 @@ float4 PS_Composite(CShade_VS2PS_Quad Input) : SV_TARGET0 // Apply color-grading CColor_ApplyColorGrading( BaseColor, - _GradePostExposure, - _GradeContrast, - _GradeColorFilter, + _GradeLightness, _GradeHueShift, _GradeSaturation, + _GradeContrast, + _GradeColorFilter, _GradeTemperature, _GradeTint, _GradeShadows, diff --git a/shaders/shared/cColor.fxh b/shaders/shared/cColor.fxh index 80df49c..0cc7895 100644 --- a/shaders/shared/cColor.fxh +++ b/shaders/shared/cColor.fxh @@ -523,11 +523,11 @@ void CColor_ApplyColorGrading( inout float3 Color, - float PostExposure, // [0.0, N); default = 0.0 - float Contrast, // [-1.0, 1.0); default = 0.0 - float3 ColorFilter, // [0.0, 1.0); default = 1.0 + float Lightness, // [0.0, N); default = 0.0 float HueShift, // [-180.0, 180.0); default = 0.0 float Saturation, // [-1.0, 1.0); default = 0.0 + float Contrast, // [-1.0, 1.0); default = 0.0 + float3 ColorFilter, // [0.0, 1.0); default = 1.0 float Temperature, // [-1.0, 1.0); default = 0.0 float Tint, // [-1.0, 1.0); default = 0.0 float3 Shadows, // [0.0, 1.0); default = float3(0.5, 0.5, 0.5) @@ -550,28 +550,18 @@ // Convert user-friendly uniform settings float3x3 ChannelMixMat = float3x3(MixRed, MixGreen, MixBlue); - PostExposure = exp2(PostExposure); Contrast += 1.0; HueShift = (HueShift / 360.0) * CMath_GetPi(); Saturation += 1.0; Temperature /= 10.0; Tint /= 10.0; - // Apply post exposure - Color *= PostExposure; - - // Apply contrast - Color = CColor_EncodeLogC(Color); - Color = (Color - ACEScc_MIDGRAY) * Contrast + ACEScc_MIDGRAY; - Color = CColor_DecodeLogC(Color); - Color = max(Color, 0.0); - - // Apply color filter - Color *= ColorFilter; - // Convert RGB to OKLab Color = CColor_GetOKLABfromRGB(Color); + // Apply lightness bias + Color.x += Lightness; + // Apply temperature shift Color.z += Temperature; @@ -590,6 +580,13 @@ // Convert OKLch to RGB Color = CColor_GetRGBfromOKLCH(Color); + // Apply color filter + Color *= ColorFilter; + + // Apply contrast + Color = CColor_EncodeLogC(Color); + Color = (Color - ACEScc_MIDGRAY) * Contrast + ACEScc_MIDGRAY; + Color = CColor_DecodeLogC(Color); Color = max(Color, 0.0); // Apply gamma-space split-toning @@ -616,7 +613,9 @@ float3x3 MidtoneColorMatrix = float3x3 ( - MidtoneShadowColor, MidtoneColor, MidtoneHightlightColor + MidtoneShadowColor, + MidtoneColor, + MidtoneHightlightColor ); Color *= mul(MidtoneWeights, MidtoneColorMatrix);