mirror of
https://github.com/cemu-project/cemu_graphic_packs.git
synced 2024-11-30 05:14:14 +01:00
a2630204fc
only scales original weight (saturation) so at least doesn't potentially mess things up like the last one. still no idea what's that two in uf_remappedPS, together they affect the threshold of saturate/desaturate and how much. perhaps just two calculated values based on some preset.
182 lines
5.3 KiB
Plaintext
182 lines
5.3 KiB
Plaintext
#version 420
|
|
#extension GL_ARB_texture_gather : enable
|
|
// shader bd8bba59e2149449
|
|
// Contrasty + Adjustable Bloom + Adjust Saturation
|
|
// original shader dumped using cemu 1.10.0f, BotW 1.3.1
|
|
|
|
//----------------------------settings-------------------------------------
|
|
|
|
#define adjust_bloom 1
|
|
#define adjust_saturation 1
|
|
#define contrasty 1
|
|
// 0: disable, 1: enable.
|
|
|
|
const float bloomFactor = 0.7; // 1.0 is neutral
|
|
|
|
const float satFactor = 1.3; // 1.0 is neutral. Experimental, adjust native saturation
|
|
|
|
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.008; // 0.0 is neutral
|
|
const float crushContrast = 0.004; // 0.0 is neutral. Use small increments, loss of shadow detail
|
|
|
|
//--------------------------------------------------------------------------
|
|
|
|
uniform ivec4 uf_remappedPS[1];
|
|
layout(binding = 0) uniform sampler2D textureUnitPS0;
|
|
layout(binding = 1) uniform sampler2D textureUnitPS1;
|
|
layout(location = 0) in vec4 passParameterSem0;
|
|
layout(location = 0) out vec4 passPixelColor0;
|
|
uniform vec2 uf_fragCoordScale;
|
|
int clampFI32(int v)
|
|
{
|
|
if( v == 0x7FFFFFFF )
|
|
return floatBitsToInt(1.0);
|
|
else if( v == 0xFFFFFFFF )
|
|
return floatBitsToInt(0.0);
|
|
return floatBitsToInt(clamp(intBitsToFloat(v), 0.0, 1.0));
|
|
}
|
|
float mul_nonIEEE(float a, float b){ if( a == 0.0 || b == 0.0 ) return 0.0; return a*b; }
|
|
void main()
|
|
{
|
|
vec4 R0f = vec4(0.0);
|
|
vec4 R1f = vec4(0.0);
|
|
vec4 R123f = vec4(0.0);
|
|
vec4 R125f = vec4(0.0);
|
|
vec4 R126f = vec4(0.0);
|
|
vec4 R127f = vec4(0.0);
|
|
float backupReg0f, backupReg1f, backupReg2f, backupReg3f, backupReg4f;
|
|
vec4 PV0f = vec4(0.0), PV1f = vec4(0.0);
|
|
float PS0f = 0.0, PS1f = 0.0;
|
|
vec4 tempf = vec4(0.0);
|
|
float tempResultf;
|
|
int tempResulti;
|
|
ivec4 ARi = ivec4(0);
|
|
bool predResult = true;
|
|
vec3 cubeMapSTM;
|
|
int cubeMapFaceId;
|
|
R0f = passParameterSem0;
|
|
R1f.xyz = (texture(textureUnitPS0, R0f.xy).xyz);
|
|
|
|
#if (adjust_bloom == 1)
|
|
R1f.xyz *= bloomFactor;
|
|
#endif
|
|
|
|
R0f.xyz = (texture(textureUnitPS1, R0f.xy).xyz);
|
|
// 0
|
|
R126f.x = R1f.x + R0f.x;
|
|
R127f.y = R1f.y + R0f.y;
|
|
R126f.z = R1f.z + R0f.z;
|
|
PV0f.xyz = vec3(R126f.x,R127f.y,R126f.z);
|
|
R125f.w = 1.0;
|
|
|
|
// 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;
|
|
PV1f.y = tempf.x;
|
|
PV1f.z = tempf.x;
|
|
PV1f.w = tempf.x;
|
|
// 2
|
|
R127f.x = -(R127f.y) * intBitsToFloat(0x3fb8aa3b);
|
|
PV0f.y = -(PV1f.x) * intBitsToFloat(0x3fb8aa3b);
|
|
R127f.z = -(R126f.x) * intBitsToFloat(0x3fb8aa3b);
|
|
R127f.w = -(R126f.z) * intBitsToFloat(0x3fb8aa3b);
|
|
R126f.w = 1.0 / PV1f.x;
|
|
PS0f = R126f.w;
|
|
// 3
|
|
PS1f = exp2(PV0f.y);
|
|
// 4
|
|
PV0f.x = -(PS1f) + 1.0;
|
|
PS0f = exp2(R127f.x);
|
|
// 5
|
|
R127f.x = -(PS0f) + 1.0;
|
|
R126f.y = mul_nonIEEE(PV0f.x, PV0f.x);
|
|
PV1f.z = PV0f.x * R126f.w;
|
|
PS1f = exp2(R127f.w);
|
|
// 6
|
|
backupReg0f = R126f.x;
|
|
backupReg1f = R127f.z;
|
|
R126f.x = mul_nonIEEE(backupReg0f, PV1f.z);
|
|
PV0f.y = -(PS1f) + 1.0;
|
|
R127f.z = mul_nonIEEE(R126f.z, PV1f.z);
|
|
PV0f.z = R127f.z;
|
|
R127f.w = mul_nonIEEE(R127f.y, PV1f.z);
|
|
PV0f.w = R127f.w;
|
|
PS0f = exp2(backupReg1f);
|
|
// 7
|
|
PV1f.x = R127f.x + -(PV0f.w);
|
|
PV1f.y = PV0f.y + -(PV0f.z);
|
|
PV1f.w = -(PS0f) + 1.0;
|
|
// 8
|
|
backupReg0f = R127f.z;
|
|
R127f.x = (mul_nonIEEE(PV1f.x,R126f.y) + R127f.w);
|
|
R127f.x = clamp(R127f.x, 0.0, 1.0);
|
|
PV0f.x = R127f.x;
|
|
PV0f.y = PV1f.w + -(R126f.x);
|
|
R127f.z = (mul_nonIEEE(PV1f.y,R126f.y) + backupReg0f);
|
|
R127f.z = clamp(R127f.z, 0.0, 1.0);
|
|
PV0f.z = R127f.z;
|
|
// 9
|
|
backupReg0f = R126f.x;
|
|
R126f.x = (mul_nonIEEE(PV0f.y,R126f.y) + backupReg0f);
|
|
R126f.x = clamp(R126f.x, 0.0, 1.0);
|
|
PV1f.x = R126f.x;
|
|
R126f.y = max(PV0f.x, PV0f.z);
|
|
PV1f.w = min(PV0f.x, PV0f.z);
|
|
// 10
|
|
tempf.x = dot(vec4(PV1f.x,R127f.x,R127f.z,R125f.w),vec4(intBitsToFloat(0x3f2aaaab),intBitsToFloat(0x3f2aaaab),intBitsToFloat(0x3f2aaaab),-(1.0)));
|
|
PV0f.x = tempf.x;
|
|
PV0f.y = tempf.x;
|
|
PV0f.z = tempf.x;
|
|
PV0f.w = tempf.x;
|
|
R126f.z = min(PV1f.x, PV1f.w);
|
|
PS0f = R126f.z;
|
|
// 11
|
|
backupReg0f = R127f.x;
|
|
backupReg1f = R127f.z;
|
|
R127f.x = max(R126f.x, R126f.y);
|
|
PV1f.x = R127f.x;
|
|
R123f.y = (mul_nonIEEE(-(PV0f.x),PV0f.x) + 1.0);
|
|
PV1f.y = R123f.y;
|
|
R127f.z = backupReg0f + -(PS0f);
|
|
R125f.w = R126f.x + -(PS0f);
|
|
R126f.y = backupReg1f + -(PS0f);
|
|
PS1f = R126f.y;
|
|
// 12
|
|
|
|
#if (adjust_saturation == 1)
|
|
R126f.x = satFactor * (mul_nonIEEE(PV1f.y,intBitsToFloat(uf_remappedPS[0].y)) + intBitsToFloat(uf_remappedPS[0].x));
|
|
#else
|
|
R126f.x = (mul_nonIEEE(PV1f.y,intBitsToFloat(uf_remappedPS[0].y)) + intBitsToFloat(uf_remappedPS[0].x));
|
|
#endif
|
|
|
|
PV0f.x = R126f.x;
|
|
PV0f.y = -(R126f.z) + PV1f.x;
|
|
// 13
|
|
R123f.w = (mul_nonIEEE(-(PV0f.x),PV0f.y) + R127f.x);
|
|
PV1f.w = R123f.w;
|
|
// 14
|
|
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 (contrasty == 1)
|
|
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);
|
|
}
|