This commit is contained in:
Michael 2017-10-20 22:58:51 -07:00
commit 57c9e815d7

View File

@ -19,26 +19,48 @@
// Original shader dumped using cemu 1.10.0f, BotW 1.3.1
// Being below 1.3.0 will give you double-vision with recent graphic packs. Update to 1.3.0 or above.
// If you're experiencing any issues (due to having the previous Clarity shaders installed), please remove and redownload all of the BotW packs.
// Changelog V0.2
//-----------------------------------------------------------
highp const float floor = 0.0 / 255;
highp const float scale = 255.0/(255.0-0.0);
//---DO NOT Touch
precision highp float;
lowp uniform float brightness = 1.15;
lowp uniform float contrast;
lowp uniform float saturation;
lowp uniform float alpha = 1.0;
//-----------------------------------------------------------
// Adjustable values:
const float Brightness = 1.35; // [1.0 Default] Lighten or Darken Shadows
const float Gamma = 2.00; // [1.0 Default] [2.0 Clarity]
const float Saturation = 0.00; // [-1.0 ~ 1.0] Saturates Colors
lowp const float gamma = 1.50; // [1.0 Default] [2.0 Clarity]
const float Exposure = 0.00; // [-1.0 ~ 1.0] Exposure Adjustment
const float Defog = 0.12; // [0.0 ~ 1.0] How much of the far distance fog to "remove."
//-----------------------------------------------------------
// Contrast, saturation, brightness
// For all settings: 1.0 = 100% 0.5=50% 1.5 = 150%
#define GammaCorrection(color, gamma) pow(color, 1.0 / gamma)
vec3 ContrastSaturationBrightness(vec3 color, float brt, float sat, float con)
{
// Increase or decrease theese values to adjust r, g and b color channels seperately
const float AvgLumR = 0.5;
const float AvgLumG = 0.5;
const float AvgLumB = 0.5;
const vec3 LumCoeff = vec3(0.2125, 0.7154, 0.0721);
vec3 AvgLumin = vec3(AvgLumR, AvgLumG, AvgLumB);
vec3 brtColor = color * brt;
float intensityf = dot(brtColor, LumCoeff);
vec3 intensity = vec3(intensityf, intensityf, intensityf);
vec3 satColor = mix(intensity, brtColor, sat);
vec3 conColor = mix(AvgLumin, satColor, con);
color.rgb = conColor;
return color;
}
//End of adjustable values
const float floor = 0.0 / 255;
const float scale = 255.0/(255.0-0.0);
uniform float contrast;
const float Bleach = 0.0;
const vec3 FogColor = vec3(0.0, 0.0, 0.0); //Defog Color";
@ -66,7 +88,7 @@ vec3 TonemapPass(vec3 inputColor) {
vec3 color = inputColor;
color = clamp(color - Defog * FogColor * 2.55, 0.0, 1.0); // Defog
color *= pow(2.0f, Exposure); // Exposure
color = pow(color, vec3(Gamma)); // Gamma
color = pow(color, vec3(gamma)); // Gamma
const vec3 coefLuma = vec3(0.2126, 0.7152, 0.0722);
float lum = dot(coefLuma, color);
@ -83,7 +105,7 @@ vec3 TonemapPass(vec3 inputColor) {
vec3 middlegray = vec3(dot(color, vec3(1.0 / 3.0)));
vec3 diffcolor = color - middlegray;
color = (color + diffcolor * Saturation) / (1 + (diffcolor * Saturation)); // Saturation
color = (color + diffcolor * saturation) / (1 + (diffcolor * saturation)); // saturation
return color;
}
@ -200,25 +222,9 @@ PV1f.w = R123f.w;
R0f.x = (mul_nonIEEE(R126f.x,R125f.w) + PV1f.w);
R0f.y = (mul_nonIEEE(R126f.x,R127f.z) + PV1f.w);
R0f.z = (mul_nonIEEE(R126f.x,R126f.y) + PV1f.w);
// export
passPixelColor0 = vec4(R0f.x, R0f.y, R0f.z, R0f.w);
//Color Tweak
vec3 fColour = (passPixelColor0.xyz);
fColour = TonemapPass(fColour);
fColour = pow(fColour, vec3(2.0 / Brightness));
vec3 gamma = vec3(1.0/2.2f, 1.0/2.2f, 1.0/2.2f);
fColour = pow(fColour, gamma);
float luminance = fColour.r*0.299 + fColour.g*0.587 + fColour.b*0.114; //default g*0.587
vec3 colorContrasted = (fColour) * contrast;
vec3 bright = colorContrasted + vec3(Brightness,Brightness,Brightness);
float mn = min(min(fColour.r, fColour.g), fColour.b);
float mx = max(max(fColour.r, fColour.g), fColour.b);
float sat = (1.0-(mx - mn)) * (1.0-mx) * luminance * 5.0;
vec3 lightness = vec3((mn + mx)/2.0);
const vec3 lightPos = vec3(0.5, 0.5, 5.0);
const vec3 diffColour = vec3(1.0, 1.0, 1.0);
const vec3 ambColour = vec3(0.2, 0.2, 0.2);
fColour = (fColour.xyz - floor) * scale;
passPixelColor0 = vec4(fColour.x, fColour.y, fColour.z, R0f.w);
vec3 color = (passPixelColor0.xyz);
color = TonemapPass(color);
color = (color.xyz - floor) * scale;
passPixelColor0 = vec4(color.x, color.y, color.z, R0f.w);
}