ClarityGFX
Updated Values redid entire Shader . Added Toggles, and new values.
This commit is contained in:
parent
3ed1d375b4
commit
b82a4bae67
@ -15,65 +15,93 @@
|
|||||||
// Add 1.4.0 support
|
// Add 1.4.0 support
|
||||||
|
|
||||||
//##########################################################
|
//##########################################################
|
||||||
|
#define adjust_bloom 1 // 0: disable, 1: enable.
|
||||||
//BloomFactor
|
//BloomFactor
|
||||||
float bloomFactor = 0.17; //Default is 0.20 (rough estimate based on Switch)
|
float bloomFactor = 0.010; //Default is 0.020 (rough estimate based on Switch)
|
||||||
|
|
||||||
|
#define HDRpassing 0 // 0: disable, 1: enable.
|
||||||
//Fake High Dynamic Range.
|
//Fake High Dynamic Range.
|
||||||
float HDRPower = 1.085; // 0.0 to 8.0 "Raising this seems to make the effect stronger and also darker , Default 1.30."
|
float HDRPower = 1.085; // 0.0 to 8.0 Default 1.30.
|
||||||
float radius1 = 0.793; // 0.0 to 8.0 "Default 0.793 , will affect FX."
|
float radius1 = 0.793; // 0.0 to 8.0 Default 0.793
|
||||||
float radius2 = 0.87; // 0.0 to 8.0 "Default 0.87 , will affect FX."
|
float radius2 = 0.87; // 0.0 to 8.0 Default 0.87 "Raising this seems to make the effect stronger and also brighter."
|
||||||
|
|
||||||
|
#define lumapassing 0 // 0: disable, 1: enable.
|
||||||
//LumaShapening
|
//LumaShapening
|
||||||
float sharp_strength = 0.25; //[0.10 to 3.00] Strength of the sharpening Default is 0.65
|
float sharp_strength = 0.25; //[0.10 to 3.00] Strength of the sharpening Default is 0.65
|
||||||
float sharp_clamp = 0.085; //[0.000 to 1.000] Limits maximum amount of sharpening a pixel recieves - Default is 0.035
|
float sharp_clamp = 0.085; //[0.000 to 1.000] Limits maximum amount of sharpening a pixel recieves - Default is 0.035
|
||||||
|
|
||||||
//Advanced sharpening settings
|
//Advanced sharpening settings
|
||||||
float offset_bias = 1.0; //[0.0 to 6.0] Offset bias adjusts the radius of the sampling pattern.
|
float offset_bias = 1.0; //[0.0 to 6.0] Offset bias adjusts the radius of the sampling pattern.
|
||||||
|
|
||||||
//ToneMapping
|
#define Tone_map 2 // 0: disable, 1-8: enable.
|
||||||
float Bleach = 0.5; //Default is 0.0
|
// Reshade ToneMap Option 1
|
||||||
float defog = 0.004; //Default is 0.0 //How much of the overall color you want removed form the values of FogColor.
|
// linearToneMapping Option 2
|
||||||
vec3 FogColor = vec3(1.0, 1.5, 1.7); //Color you want to Add or Remove 0.25 would add .25 percent of that color 1.25 would remove .25 percent of the color."
|
// simpleReinhardToneMapping Option 3
|
||||||
|
// lumaBasedReinhardToneMapping Option 4
|
||||||
|
// whitePreservingLumaBasedReinhardToneMapping Option 5
|
||||||
|
// RomBinDaHouseToneMapping Option 6
|
||||||
|
// filmicToneMapping Option 7
|
||||||
|
// Uncharted2ToneMapping Option 8
|
||||||
|
//Reshade ToneMap Controls
|
||||||
|
float Bleach = 0.3; // "More bleach means more contrasted and less colorful image" min -0.5 max 1.0 Default 0.0
|
||||||
|
float defog = 0.004; // Default is 0.0 //How much of the overall color you want removed form the values of FogColor.
|
||||||
|
vec3 FogColor = vec3(1.0, 1.5, 1.7); // Color you want to Add or Remove 0.25 would add .25 percent of that color 1.25 would remove .25 percent of the color."
|
||||||
|
float sat = 0.050; // "Adjust saturation" min -1.0 max 1.0 Default 0.0
|
||||||
|
|
||||||
|
#define blacknwhitepass 1 // 0: disable, 1: enable.
|
||||||
//Levels Control
|
//Levels Control
|
||||||
const int BlackPoint = 6; //[0, 255] The black point is the new black - literally. Everything darker than this will become completely black
|
const int BlackPoint = 6; //[0, 255] The black point is the new black - literally. Everything darker than this will become completely black
|
||||||
const int WhitePoint = 255; //[0, 255] The new white point. Everything brighter than this becomes completely white
|
const int WhitePoint = 255; //[0, 255] The new white point. Everything brighter than this becomes completely white
|
||||||
|
|
||||||
|
#define lggpass 0 // 0: disable, 1: enable.
|
||||||
//Lift Gamma Gain
|
//Lift Gamma Gain
|
||||||
vec3 RGB_Lift = vec3(1.01, 1.01, 1.01); //[0.000 to 2.000] Adjust shadows for Red, Green and Blue.
|
vec3 RGB_Lift = vec3(0.98, 0.98, 0.93); // [0.000 to 2.000] Adjust shadows for Red, Green and Blue.
|
||||||
vec3 RGB_Gamma = vec3(1.02, 1.02, 1.02); //[0.000 to 2.000] Adjust midtones for Red, Green and Blue
|
vec3 RGB_Gamma = vec3(0.95, 0.95, 0.90); // [0.000 to 2.000] Adjust midtones for Red, Green and Blue
|
||||||
vec3 RGB_Gain = vec3(1.03, 1.03, 1.03); //[0.000 to 2.000] Adjust highlights for Red, Green and Blue
|
vec3 RGB_Gain = vec3(0.99, 0.99, 0.94); //[0.000 to 2.000] Adjust highlights for Red, Green and Blue
|
||||||
//Note that a value of 1.0 is a neutral setting that leave the color unchanged.
|
//Note that a value of 1.0 is a neutral setting that leave the color unchanged.
|
||||||
|
|
||||||
|
#define vibpass 1 // 0: disable, 1: enable.
|
||||||
//VibrancePass
|
//VibrancePass
|
||||||
float Vibrance = 0.013; //"Intelligently saturates (or desaturates if you use negative values) the pixels depending on their original saturation.";
|
float Vibrance = 0.013; // "Intelligently saturates (or desaturates if you use negative values) the pixels depending on their original saturation.";
|
||||||
vec3 VibranceRGBBalance = vec3(1.0, 1.0, 1.0); //"A per channel multiplier to the Vibrance strength so you can give more boost to certain colors over others.";
|
vec3 VibranceRGBBalance = vec3(1.0, 1.0, 1.0); // "A per channel multiplier to the Vibrance strength so you can give more boost to certain colors over others.";
|
||||||
|
|
||||||
|
#define Tech 1
|
||||||
|
//Technicolor
|
||||||
|
float Power = 4.0; // Min 0.0 Max 8.0 Default 4.0
|
||||||
|
vec3 RGBNegativeAmount = vec3(0.88, 0.88, 0.88);
|
||||||
|
//To Edit Strength scroll down to Techicolor and edit it there, to not conflict with Filmic
|
||||||
|
|
||||||
|
#define Techine 0 // 0: disable, 1: enable.
|
||||||
//Technicolor2
|
//Technicolor2
|
||||||
float Technicolor2_Red_Strength = 0.51; //Default is 0.0
|
float Technicolor2_Red_Strength = 0.51; // "Higher means darker and more intense colors." Default 0.2
|
||||||
float Technicolor2_Green_Strength = 0.51; //Default is 0.0
|
float Technicolor2_Green_Strength = 0.51; // "Higher means darker and more intense colors." Default 0.2
|
||||||
float Technicolor2_Blue_Strength = 0.51; //Default is 0.0
|
float Technicolor2_Blue_Strength = 0.51; // "Higher means darker and more intense colors." Default 0.2
|
||||||
float Technicolor2_Brightness = 1.75; //Default is 1.0
|
float Technicolor2_Brightness = 1.75; // "Higher means brighter image." min 0.5 max 1.5 Default 1.0
|
||||||
float Technicolor2_Strength = 0.80; //Default is 1.0
|
float Technicolor2_Strength = 0.80; // Default is 1.0
|
||||||
float Technicolor2_Saturation = 0.20; //Default is 1.0
|
float Technicolor2_Saturation = 0.20; // Default is 1.0
|
||||||
|
|
||||||
//Filmic Pass
|
//Curves / Filmic Pass Contrast
|
||||||
float Strength = 0.85;
|
#define CurvesPss 0 // 0: disable, 1: enable.
|
||||||
float Fade = 0.4;
|
|
||||||
float Contrast = 0.750;
|
float Contrast = 0.750;
|
||||||
float Linearization = 0.7;
|
// 1 To use curves Contrast, 0 off or to use with Filmic Pass.
|
||||||
float Saturation = -0.15;
|
|
||||||
|
|
||||||
float RedCurve = 1.0;
|
#define Filmicpass 0 // 0: disable, 1: enable.
|
||||||
float GreenCurve = 1.0;
|
//Filmic Pass
|
||||||
float BlueCurve = 1.0;
|
float Strength = 0.85; // "Strength of the color curve altering"; min 0.0 max 1.5 Default 0.85
|
||||||
float BaseCurve = 1.1;
|
float Fade = 0.4; // "Decreases contrast to imitate faded image" min 0.0 max 0.6 Default 0.4
|
||||||
|
float Linearization = 0.7; // min 0.5 max 2.0 Default 0.5
|
||||||
|
float Saturation = -0.15; // min -1.0 max 1.0 Default -0.15
|
||||||
|
|
||||||
float BaseGamma = 0.98;
|
float RedCurve = 1.0; // min 0.0 max 2.0 Default 1.0
|
||||||
float EffectGamma = 0.97;
|
float GreenCurve = 1.0; // min 0.0 max 2.0 Default 1.0
|
||||||
float EffectGammaR = 1.0;
|
float BlueCurve = 1.0; // min 0.0 max 2.0 Default 1.0
|
||||||
float EffectGammaG = 1.0;
|
float BaseCurve = 1.1; // min 0.0 max 2.0 Default 1.5
|
||||||
float EffectGammaB = 1.0;
|
|
||||||
|
float BaseGamma = 0.98; // min 0.7 max 2.0 Default 1.0
|
||||||
|
float EffectGamma = 0.97; // min 0.0 max 2.0 Default 0.68
|
||||||
|
float EffectGammaR = 1.0; // min 0.0 max 2.0 Default 1.0
|
||||||
|
float EffectGammaG = 1.0; // min 0.0 max 2.0 Default 1.0
|
||||||
|
float EffectGammaB = 1.0; // min 0.0 max 2.0 Default 1.0
|
||||||
|
|
||||||
//###########################################################
|
//###########################################################
|
||||||
|
|
||||||
@ -97,11 +125,71 @@ float mul_nonIEEE(float a, float b) { if (a == 0.0 || b == 0.0) return 0.0; retu
|
|||||||
|
|
||||||
//ToneMapping
|
//ToneMapping
|
||||||
|
|
||||||
vec3 TonemapPass(vec3 inputColor) {
|
vec3 linearToneMapping(vec3 color)
|
||||||
|
{
|
||||||
|
float exposure = 1.;
|
||||||
|
color = clamp(exposure * color, 0., 1.);
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 simpleReinhardToneMapping(vec3 color)
|
||||||
|
{
|
||||||
|
float exposure = 1.5;
|
||||||
|
color *= exposure / (1. + color / exposure);
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 lumaBasedReinhardToneMapping(vec3 color)
|
||||||
|
{
|
||||||
|
float luma = dot(color, vec3(0.2126, 0.7152, 0.0722));
|
||||||
|
float toneMappedLuma = luma / (1. + luma);
|
||||||
|
color *= toneMappedLuma / luma;
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 whitePreservingLumaBasedReinhardToneMapping(vec3 color)
|
||||||
|
{
|
||||||
|
float white = 2.;
|
||||||
|
float luma = dot(color, vec3(0.2126, 0.7152, 0.0722));
|
||||||
|
float toneMappedLuma = luma * (1. + luma / (white*white)) / (1. + luma);
|
||||||
|
color *= toneMappedLuma / luma;
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 RomBinDaHouseToneMapping(vec3 color)
|
||||||
|
{
|
||||||
|
color = exp(-1.0 / (2.72*color + 0.15));
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 filmicToneMapping(vec3 color)
|
||||||
|
{
|
||||||
|
color = max(vec3(0.), color - vec3(0.004));
|
||||||
|
color = (color * (6.2 * color + .5)) / (color * (6.2 * color + 1.7) + 0.06);
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 Uncharted2ToneMapping(vec3 color)
|
||||||
|
{
|
||||||
|
float A = 0.15;
|
||||||
|
float B = 0.50;
|
||||||
|
float C = 0.10;
|
||||||
|
float D = 0.20;
|
||||||
|
float E = 0.02;
|
||||||
|
float F = 0.30;
|
||||||
|
float W = 11.2;
|
||||||
|
float exposure = 2.;
|
||||||
|
color *= exposure;
|
||||||
|
color = ((color * (A * color + C * B) + D * E) / (color * (A * color + B) + D * F)) - E / F;
|
||||||
|
float white = ((W * (A * W + C * B) + D * E) / (W * (A * W + B) + D * F)) - E / F;
|
||||||
|
color /= white;
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 ReshadeToneMap(vec3 inputColor) {
|
||||||
vec3 color = inputColor;
|
vec3 color = inputColor;
|
||||||
color = clamp(color - defog * FogColor * 2.55, 0.0, 1.0); // defog
|
color = clamp(color - defog * FogColor * 2.55, 0.0, 1.0); // defog
|
||||||
|
|
||||||
|
|
||||||
const vec3 coefLuma = vec3(0.2126, 0.7152, 0.0722);
|
const vec3 coefLuma = vec3(0.2126, 0.7152, 0.0722);
|
||||||
float lum = dot(coefLuma, color);
|
float lum = dot(coefLuma, color);
|
||||||
|
|
||||||
@ -118,7 +206,6 @@ vec3 TonemapPass(vec3 inputColor) {
|
|||||||
vec3 middlegray = vec3(dot(color, vec3(1.0 / 3.0)));
|
vec3 middlegray = vec3(dot(color, vec3(1.0 / 3.0)));
|
||||||
vec3 diffcolor = color - middlegray;
|
vec3 diffcolor = color - middlegray;
|
||||||
|
|
||||||
float sat = 0.050;
|
|
||||||
color = (color + diffcolor * sat) / (1 + (diffcolor * sat)); // saturation
|
color = (color + diffcolor * sat) / (1 + (diffcolor * sat)); // saturation
|
||||||
|
|
||||||
return color;
|
return color;
|
||||||
@ -165,6 +252,29 @@ vec3 Technicolor2(vec3 inputColor) {
|
|||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Technicolor
|
||||||
|
vec3 TechnicolorPass(vec3 color)
|
||||||
|
{
|
||||||
|
float Strength = 0.20; // Min 0.0 Max 1.0 Default 0.4
|
||||||
|
const vec3 cyanfilter = vec3(0.0, 1.30, 1.0);
|
||||||
|
const vec3 magentafilter = vec3(1.0, 0.0, 1.05);
|
||||||
|
const vec3 yellowfilter = vec3(1.6, 1.6, 0.05);
|
||||||
|
const vec2 redorangefilter = vec2(1.05, 0.620); // RG_
|
||||||
|
const vec2 greenfilter = vec2(0.30, 1.0); // RG_
|
||||||
|
const vec2 magentafilter2 = magentafilter.rb; // R_B
|
||||||
|
|
||||||
|
vec3 tcol = color.rgb;
|
||||||
|
|
||||||
|
vec2 negative_mul_r = tcol.rg * (1.0 / (RGBNegativeAmount.r * Power));
|
||||||
|
vec2 negative_mul_g = tcol.rg * (1.0 / (RGBNegativeAmount.g * Power));
|
||||||
|
vec2 negative_mul_b = tcol.rb * (1.0 / (RGBNegativeAmount.b * Power));
|
||||||
|
vec3 output_r = dot(redorangefilter, negative_mul_r).xxx + cyanfilter;
|
||||||
|
vec3 output_g = dot(greenfilter, negative_mul_g).xxx + magentafilter;
|
||||||
|
vec3 output_b = dot(magentafilter2, negative_mul_b).xxx + yellowfilter;
|
||||||
|
|
||||||
|
return mix(tcol, output_r * output_g * output_b, Strength);
|
||||||
|
}
|
||||||
|
|
||||||
// Levels
|
// Levels
|
||||||
|
|
||||||
vec3 LevelsPass(vec3 inputColor) {
|
vec3 LevelsPass(vec3 inputColor) {
|
||||||
@ -184,7 +294,7 @@ vec3 FilmPass(vec3 inputColor) {
|
|||||||
vec3 G = B;
|
vec3 G = B;
|
||||||
vec3 H = vec3(0.01);
|
vec3 H = vec3(0.01);
|
||||||
|
|
||||||
B = clamp(B, 0.0, 1. );
|
B = clamp(B, 0.0, 1.);
|
||||||
B = pow(vec3(B), vec3(Linearization));
|
B = pow(vec3(B), vec3(Linearization));
|
||||||
B = mix(H, B, Contrast);
|
B = mix(H, B, Contrast);
|
||||||
|
|
||||||
@ -283,13 +393,13 @@ vec3 LiftGammaGainPass(vec3 colorInput)
|
|||||||
color = color * (1.5 - 0.5 * RGB_Lift) + 0.5 * RGB_Lift - 0.5;
|
color = color * (1.5 - 0.5 * RGB_Lift) + 0.5 * RGB_Lift - 0.5;
|
||||||
color = clamp(color, 0.0, 1.0); //isn't strictly necessary, but doesn't cost performance.
|
color = clamp(color, 0.0, 1.0); //isn't strictly necessary, but doesn't cost performance.
|
||||||
|
|
||||||
// -- Gain --
|
// -- Gain --
|
||||||
color *= RGB_Gain;
|
color *= RGB_Gain;
|
||||||
|
|
||||||
// -- Gamma --
|
// -- Gamma --
|
||||||
color = pow(color, 1.0 / RGB_Gamma); //Gamma
|
color = pow(color, 1.0 / RGB_Gamma); //Gamma
|
||||||
|
|
||||||
// -- Return output --
|
// -- Return output --
|
||||||
return clamp(color, 0.0, 1.0);
|
return clamp(color, 0.0, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -304,7 +414,7 @@ vec3 VibrancePass(vec3 color) {
|
|||||||
|
|
||||||
float color_saturation = max_color - min_color; // The difference between the two is the saturation
|
float color_saturation = max_color - min_color; // The difference between the two is the saturation
|
||||||
|
|
||||||
// Extrapolate between luma and original by 1 + (1-saturation) - current
|
// Extrapolate between luma and original by 1 + (1-saturation) - current
|
||||||
vec3 coeffVibrance = VibranceRGBBalance * Vibrance;
|
vec3 coeffVibrance = VibranceRGBBalance * Vibrance;
|
||||||
|
|
||||||
color = mix(vec3(luma), color, 1.0 + (coeffVibrance * (1.0 - (sign(coeffVibrance) * color_saturation))));
|
color = mix(vec3(luma), color, 1.0 + (coeffVibrance * (1.0 - (sign(coeffVibrance) * color_saturation))));
|
||||||
@ -406,10 +516,19 @@ void main()
|
|||||||
int cubeMapFaceId;
|
int cubeMapFaceId;
|
||||||
R0f = passParameterSem0;
|
R0f = passParameterSem0;
|
||||||
vec3 bloom = texture(textureUnitPS0, passParameterSem0.xy).xyz;
|
vec3 bloom = texture(textureUnitPS0, passParameterSem0.xy).xyz;
|
||||||
|
#if (adjust_bloom == 1)
|
||||||
bloom *= bloomFactor;
|
bloom *= bloomFactor;
|
||||||
|
#endif
|
||||||
|
#if (HDRpassing == 1)
|
||||||
R0f.xyz = HDRPass(textureUnitPS1, passParameterSem0.xy);
|
R0f.xyz = HDRPass(textureUnitPS1, passParameterSem0.xy);
|
||||||
|
#endif
|
||||||
|
#if (HDRpassing == 0)
|
||||||
|
R0f.xyz = texture(textureUnitPS1, passParameterSem0.xy).xyz;
|
||||||
|
#endif
|
||||||
|
#if (lumapassing == 1)
|
||||||
float smask = lumasharping(textureUnitPS1, passParameterSem0.xy);
|
float smask = lumasharping(textureUnitPS1, passParameterSem0.xy);
|
||||||
R0f.xyz += vec3(smask);
|
R0f.xyz += vec3(smask);
|
||||||
|
#endif
|
||||||
// -- Original shader code
|
// -- Original shader code
|
||||||
// 0
|
// 0
|
||||||
R126f.x = R1f.x + R0f.x;
|
R126f.x = R1f.x + R0f.x;
|
||||||
@ -501,12 +620,50 @@ void main()
|
|||||||
|
|
||||||
vec3 color = (passPixelColor0.xyz);
|
vec3 color = (passPixelColor0.xyz);
|
||||||
color += bloom;
|
color += bloom;
|
||||||
color = TonemapPass(color);
|
#if (Tone_map == 1)
|
||||||
|
color = ReshadeToneMap(color);
|
||||||
|
#endif
|
||||||
|
#if (Tone_map == 2)
|
||||||
|
color = linearToneMapping(color);
|
||||||
|
#endif
|
||||||
|
#if (Tone_map == 3)
|
||||||
|
color = simpleReinhardToneMapping(color);
|
||||||
|
#endif
|
||||||
|
#if (Tone_map == 4)
|
||||||
|
color = lumaBasedReinhardToneMapping(color);
|
||||||
|
#endif
|
||||||
|
#if (Tone_map == 5)
|
||||||
|
color = whitePreservingLumaBasedReinhardToneMapping(color);
|
||||||
|
#endif
|
||||||
|
#if (Tone_map == 6)
|
||||||
|
color = RomBinDaHouseToneMapping(color);
|
||||||
|
#endif
|
||||||
|
#if (Tone_map == 7)
|
||||||
|
color = filmicToneMapping(color);
|
||||||
|
#endif
|
||||||
|
#if (Tone_map == 8)
|
||||||
|
color = Uncharted2ToneMapping(color);
|
||||||
|
#endif
|
||||||
|
#if (blacknwhitepass == 1)
|
||||||
color = LevelsPass(color);
|
color = LevelsPass(color);
|
||||||
|
#endif
|
||||||
|
#if (Techine == 1)
|
||||||
color = Technicolor2(color);
|
color = Technicolor2(color);
|
||||||
|
#endif
|
||||||
|
#if (Tech == 1)
|
||||||
|
color = TechnicolorPass(color);
|
||||||
|
#endif
|
||||||
|
#if (Filmicpass == 1)
|
||||||
color = FilmPass(color);
|
color = FilmPass(color);
|
||||||
|
#endif
|
||||||
|
#if (CurvesPss == 1)
|
||||||
color = CurvesPass(color);
|
color = CurvesPass(color);
|
||||||
|
#endif
|
||||||
|
#if (lggpass == 1)
|
||||||
color = LiftGammaGainPass(color);
|
color = LiftGammaGainPass(color);
|
||||||
|
#endif
|
||||||
|
#if (vibpass == 1)
|
||||||
color = VibrancePass(color);
|
color = VibrancePass(color);
|
||||||
|
#endif
|
||||||
passPixelColor0 = vec4(color, R0f.w);
|
passPixelColor0 = vec4(color, R0f.w);
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user