[BotW] update contrasty

clamp now also with exposure...
filmic refine the same way as botw
contrasty use reshade vibrance because they look almost identical
This commit is contained in:
NAVras-Z 2017-11-08 21:33:33 +08:00
parent d8e6907007
commit 82f206c67f
No known key found for this signature in database
GPG Key ID: AD82D45EF853EC40

View File

@ -5,37 +5,29 @@
/*=============================Settings=====================================*/
#define adjust_bloom 1 // 0: disable, 1: enable.
const float bloomFactor = 0.7; // 1.0 is neutral
const float bloomFactor = 0.7; // 1.0 is neutral [0,1+]
#define tone_mapping 0
// -1: disable, clamp bright detail but keep [0,1] intact, however clamping could lead to desaturation as well
#define tone_mapping 1
// -1: disable, loss of bright detail/color but keep [0,1] intact
// 0: (Wii U) BotW original
// 1: ACES Filmic
//--------------------"ACES Filmic" Parameters-----------------//
//---------------"ACES Filmic","disable" Parameters-------------//
const float Exposure = 0.6; // [0.0, 1.0+] Adjust exposure
//---------------------------------------------------------------//
#define post_process 2
#define post_process 0
// -1: disable
// 0: (Wii U) BotW original, only vibrance
// 1: Reshade Vibrance
// 2: Contrasty
// 3: Experimental, convert rgb to hsv then adjust saturation directly
// 1: Contrasty
//----------------"BotW original" vibrance adjust-------------//
const float satFactor = 0.29; // 0.18 is neutral. Experimental, adjust native saturation
//---------------------------------------------------------------//
//-----------------"Reshade Vibrance" Parameters--------------//
const float Vibrance = 0.40; // Saturates (or desaturates if you use negative values) the pixels depending on their original saturation.
const 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.
const float satFactor = 0.25; // 0.18 is neutral. Experimental, adjust native saturation
//---------------------------------------------------------------//
//---------------------"Contrasty" Parameters-----------------//
const float gamma = 0.81; // 1.0 is neutral. Botw is already colour graded at this stage
const float exposure = 1.17; // 1.0 is neutral
const float vibrance = 0.45; // 0.0 is neutral
const float crushContrast = 0.004; // 0.0 is neutral. Use small increments, loss of shadow detail
//---------------------------------------------------------------//
//------------------------"hsv experiment"---------------------//
const float satScale = 1.5; // 1.0 is neutral
const float vibrance = 0.40; // >0: saturate <0: desaturate
const vec3 vibrance_RGB_balance = 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.
const float crushContrast = 0.000; // 0.0 is neutral. Use small increments, loss of shadow detail
//---------------------------------------------------------------//
/*==========================================================================*/
@ -67,7 +59,12 @@ vec3 BotWToneMap(vec3 color) {
vec3 ACESFilm(vec3 color) {
color *= Exposure;
return (color*(2.51*color+0.03))/(color*(2.43*color+0.59)+0.14);
float Lumn = getL709(color);
vec4 tm = vec4(color,Lumn);
tm = (tm*(2.51*tm+0.03))/(tm*(2.43*tm+0.59)+0.14); // tonemap
vec3 cpre = tm.w / Lumn * color;
vec3 colorldr = mix(cpre,tm.rgb,vec3(pow(tm.w,2.0)));//refine
return colorldr;
}
vec3 BotWVibrance(vec3 color) {
@ -84,7 +81,7 @@ vec3 ReshadeVibrance(vec3 color) {
float min_color = min(color.r, min(color.g, color.b)); // Find the weakest color
float luma = getL709(color);
float color_saturation = max_color - min_color; // The difference between the two is the saturation
vec3 coeffVibrance = VibranceRGBBalance * Vibrance;
vec3 coeffVibrance = vibrance_RGB_balance * vibrance;
color = mix(vec3(luma), color, 1.0 + (coeffVibrance * (1.0 - (sign(coeffVibrance) * color_saturation))));
return color;
}
@ -93,37 +90,20 @@ vec3 Contrasty(vec3 fColour) {
fColour = max(vec3(0.0), fColour - vec3(crushContrast));
fColour = clamp(exposure * fColour, 0.0, 1.0);
fColour = pow(fColour, vec3(1.0 / gamma));
float luminance = getL601(fColour);
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);
// vibrance
fColour = mix(fColour, mix(fColour, lightness, -vibrance), sat);
fColour = ReshadeVibrance(fColour); // reshade's identical, only a little stronger when at same setting
return fColour;
}
vec3 rgb2hsv(vec3 c) {
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
float d = q.x - min(q.w, q.y);
float e = 1.0e-10;
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
}
vec3 hsv2rgb(vec3 c) {
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
}
vec3 HSV(vec3 color) {
vec3 hsv = rgb2hsv(color);
hsv.y = pow(hsv.y, 1.0/satScale);
color = hsv2rgb(hsv);
return color;
}
// bad curve, see reshade curves.fx
//vec3 Contrasty2(vec3 color) {
// color = clamp(color,0.0,1.0);
// vec3 dark = pow(color,vec3(1.0/dark_thr));
// vec3 bright = pow(color,vec3(1.0/bright_thr));
// float lumn = getL709(color);
// color = mix(dark,bright,lumn);
// color = ReshadeVibrance(color);
// return color;
//}
void main()
{
@ -137,7 +117,7 @@ bloom *= bloomFactor;
color += bloom;
#if (tone_mapping == -1)
color = clamp(color,0.0,1.0);
color = clamp(color*Exposure,0.0,1.0);
#elif (tone_mapping == 0)
color = BotWToneMap(color);
#elif (tone_mapping == 1)
@ -147,11 +127,7 @@ color = ACESFilm(color);
#if (post_process == 0)
color = BotWVibrance(color);
#elif (post_process == 1)
color = ReshadeVibrance(color);
#elif (post_process == 2)
color = Contrasty(color);
#elif (post_process == 3)
color = HSV(color);
#endif
// export