[BotW] revert "contrasty happens before tone mapping"

credit Hrebo on discord. https://www.reddit.com/r/cemu/comments/77jxd2/botw_contrasty_graphic_pack_colortone_showcase/dopsvmb/
After futher investigation(?lol), found that shader bd8bb also does color tweaking itself, some part looks very similar to contrasty's saturation (lihe@bestminr.com, also updated credit).
So it's not worthwhile to re-adjust the current contrasty settings, might just revert it before figuring out the game's own color tweaking.
This commit is contained in:
NAVras-Z 2017-10-23 01:16:40 +08:00
parent 5faeac1f3e
commit 8a17072910
2 changed files with 20 additions and 25 deletions

View File

@ -6,8 +6,8 @@
//----------------------------settings-------------------------------------
#define only_adjustbloom 0
//0 false, 1 true: all features except 'adjustable bloom' in contrasty will be disabled. -1 disable all of the contrasty.
const bool only_adjustbloom = false;
// if true, all features except 'adjustable bloom' in contrasty will be disabled.
const float bloomFactor = 0.7; // 1.0 is neutral
const float gamma = 0.81; // 1.0 is neutral Botw is already colour graded at this stage
@ -52,9 +52,7 @@ vec3 cubeMapSTM;
int cubeMapFaceId;
R0f = passParameterSem0;
R1f.xyz = (texture(textureUnitPS0, R0f.xy).xyz);
#if (only_adjustbloom == 0||only_adjustbloom == 1)
R1f.xyz *= bloomFactor;
#endif
R0f.xyz = (texture(textureUnitPS1, R0f.xy).xyz);
// 0
R126f.x = R1f.x + R0f.x;
@ -63,26 +61,6 @@ R126f.z = R1f.z + R0f.z;
PV0f.xyz = vec3(R126f.x,R127f.y,R126f.z);
R125f.w = 1.0;
#if (only_adjustbloom == 0)
//Color Tweak
vec3 fColour = vec3(R126f.x, R127f.y, R126f.z);
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 = fColour.r*intBitsToFloat(0x3e99096c) + fColour.g*intBitsToFloat(0x3f162b6b) + fColour.b*intBitsToFloat(0x3dea4a8c);
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);
R126f.x = fColour.x;
R127f.y = fColour.y;
R126f.z = fColour.z;
PV0f.xyz = fColour;
#endif
// 1
tempf.x = dot(vec4(PV0f.x,PV0f.y,PV0f.z,-0.0),vec4(intBitsToFloat(0x3e99096c),intBitsToFloat(0x3f162b6b),intBitsToFloat(0x3dea4a8c),0.0));
PV1f.x = tempf.x;
@ -167,6 +145,23 @@ 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);
#if !only_adjustbloom
//Color Tweak
vec3 fColour = R0f.xyz;
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 = fColour.r*intBitsToFloat(0x3e99096c) + fColour.g*intBitsToFloat(0x3f162b6b) + fColour.b*intBitsToFloat(0x3dea4a8c);
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);
R0f.xyz = fColour;
#endif
// export
passPixelColor0 = vec4(R0f.x, R0f.y, R0f.z, R0f.w);
}

View File

@ -5,7 +5,7 @@ version = 2
# Credit:
# getdls for contrasty
# bestminr for vibrance logic
# lihe@bestminr.com for vibrance logic
# kiri, navras for tone mapping
# navras seperate contrasty from AARemoval