diff --git a/Enhancements/BreathOfTheWild_!AntiAliasing/0f2b9ee517917425_00000000000003c9_ps.txt b/Enhancements/BreathOfTheWild_!AntiAliasing/0f2b9ee517917425_00000000000003c9_ps.txt index b393af7d..54c9d2f6 100644 --- a/Enhancements/BreathOfTheWild_!AntiAliasing/0f2b9ee517917425_00000000000003c9_ps.txt +++ b/Enhancements/BreathOfTheWild_!AntiAliasing/0f2b9ee517917425_00000000000003c9_ps.txt @@ -1,12 +1,15 @@ #version 420 #extension GL_ARB_texture_gather : enable #extension GL_EXT_gpu_shader4 : enable -// shader 0f2b9ee517917425 -// Used for: Removing/Restoring the native BotW Anti-Aliasing implementation in inventory screen + +// shader 0f2b9ee517917425 - dumped 1.15 +// Used for: Removing/Restoring the native BotW Anti-Aliasing implementation to link in inventory screen #define preset $preset +#define aaSharper $aaSharper +#define aaBlurrier $aaBlurrier -#if (preset == 0) +#if (preset == 0) // Disabled layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf49b1800 res 1280x720x1 dim 1 tm: 4 format 0019 compSel: 0 1 2 3 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler0 ClampX/Y/Z: 2 2 2 border: 1 layout(location = 0) in vec4 passParameterSem2; layout(location = 0) out vec4 passPixelColor0; @@ -17,16 +20,18 @@ passPixelColor0 = texture(textureUnitPS0, passParameterSem2.xy); } #endif -#if (preset == 1) +#if (preset == 1) // Enabled uniform ivec4 uf_remappedPS[2]; layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf49b1800 res 1280x720x1 dim 1 tm: 4 format 0019 compSel: 0 1 2 3 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler0 ClampX/Y/Z: 2 2 2 border: 1 -layout(binding = 1) uniform sampler2D textureUnitPS1;// Tex1 addr 0x387f8000 res 1280x720x1 dim 1 tm: 4 format 0001 compSel: 0 4 4 5 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler1 ClampX/Y/Z: 2 2 2 border: 1 +layout(binding = 1) uniform sampler2D textureUnitPS1;// Tex1 addr 0x37b40000 res 1280x720x1 dim 1 tm: 4 format 0001 compSel: 0 4 4 5 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler1 ClampX/Y/Z: 2 2 2 border: 1 layout(location = 0) in vec4 passParameterSem2; layout(location = 0) out vec4 passPixelColor0; uniform vec2 uf_fragCoordScale; -ivec2 resDim = textureSize2D(textureUnitPS0,0); -const int resXScale = int( float(resDim.x)/1280 + 0.5 ); //We need to round up -const int resYScale = int( float(resDim.y)/720 + 0.5 ); //We need to round up + +vec2 resDim = textureSize2D(textureUnitPS0,0); // Retrieve texture dimensions vector holds data-type-float +const float resX = ( (resDim.x/1280) + aaSharper ) - aaBlurrier; // 1st comes aaSharper needs to be added to the direct result of resolution ratio to make it more sharper +const float resY = ( (resDim.y/720) + aaSharper ) - aaBlurrier; // 2nd comes aablurier needs to be subtracted from final result to make it more blurrier + int clampFI32(int v) { if( v == 0x7FFFFFFF ) @@ -35,7 +40,7 @@ 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; } +float mul_nonIEEE(float a, float b){return mix(0.0, a*b, (a != 0.0) && (b != 0.0));} void main() { ivec4 R0i = ivec4(0); @@ -51,7 +56,7 @@ ivec4 R125i = ivec4(0); ivec4 R126i = ivec4(0); ivec4 R127i = ivec4(0); int backupReg0i, backupReg1i, backupReg2i, backupReg3i, backupReg4i; -ivec4 PV0i = ivec4(0), PV1i = ivec4(0); +ivec4 PV0i = ivec4(0), PV1i = ivec4(0); // These variables make the difference int PS0i = 0, PS1i = 0; ivec4 tempi = ivec4(0); float tempResultf; @@ -79,21 +84,21 @@ R1i.y = floatBitsToInt(textureOffset(textureUnitPS1, intBitsToFloat(R0i.xy),ivec if( activeMaskStackC[1] == true ) { activeMaskStack[1] = activeMaskStack[0]; activeMaskStackC[2] = activeMaskStackC[1]; -// 0 -PV0i.x = floatBitsToInt(min(intBitsToFloat(R1i.x), intBitsToFloat(R1i.z))); -PV0i.y = floatBitsToInt(max(intBitsToFloat(R2i.x), intBitsToFloat(R2i.z))); -PV0i.z = floatBitsToInt(max(intBitsToFloat(R1i.x), intBitsToFloat(R1i.z))); +// 0 --- Point of Interest 1 +PV0i.x = floatBitsToInt(min(intBitsToFloat(R1i.x), intBitsToFloat(R1i.z)) / resX ); // Divide looks better for minimum - Must place the varaibles in that location of the round brackets to use floats correctly +PV0i.y = floatBitsToInt(max(intBitsToFloat(R2i.x), intBitsToFloat(R2i.z)) * resY ); // Multiply looks beeter for max - Must place the varaibles in that location of the round brackets to use floats correctly +PV0i.z = floatBitsToInt(max(intBitsToFloat(R1i.x), intBitsToFloat(R1i.z)) * resX ); // Multiply looks better for max - Must place the varaibles in that location of the round brackets to use floats correctly PV0i.w = floatBitsToInt(min(intBitsToFloat(R2i.x), intBitsToFloat(R2i.z))); -// 1 +// 1 ---Point of Interest 2 PV1i.x = floatBitsToInt(max(intBitsToFloat(PV0i.z), intBitsToFloat(PV0i.y))); PV1i.y = floatBitsToInt(min(intBitsToFloat(PV0i.x), intBitsToFloat(PV0i.w))); // 2 PV0i.z = floatBitsToInt(min(intBitsToFloat(R2i.w), intBitsToFloat(PV1i.y))); PV0i.w = floatBitsToInt(max(intBitsToFloat(R2i.w), intBitsToFloat(PV1i.x))); -// 3 +// 3 PV1i.x = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV0i.w), intBitsToFloat(uf_remappedPS[0].x))); R1i.w = floatBitsToInt(intBitsToFloat(PV0i.w) + -(intBitsToFloat(PV0i.z))); -// 4 +// 4 R2i.y = floatBitsToInt(max(intBitsToFloat(PV1i.x), intBitsToFloat(uf_remappedPS[0].y))); // 5 predResult = (intBitsToFloat(R1i.w) >= intBitsToFloat(R2i.y)); @@ -153,7 +158,7 @@ PV1i.x = floatBitsToInt(intBitsToFloat(PV0i.x) + intBitsToFloat(PV0i.z)); PV1i.y = floatBitsToInt(intBitsToFloat(R127i.w) + intBitsToFloat(R126i.z)); PV1i.y = floatBitsToInt(intBitsToFloat(PV1i.y) * 2.0); R127i.z = floatBitsToInt(intBitsToFloat(backupReg0i) + intBitsToFloat(PV0i.w)); -R127i.y = floatBitsToInt(1.0 / intBitsToFloat(R1i.w)); +R127i.y = floatBitsToInt(1.0 / intBitsToFloat(R1i.w)); // Rli.w * 2 has the same affect as line 85------------------------------------------------------ PS1i = R127i.y; // 6 PV0i.x = floatBitsToInt(intBitsToFloat(R126i.w) + intBitsToFloat(PV1i.y)); @@ -167,17 +172,17 @@ R4i.z = ((PV1i.x == 0)?(0x3f800000):(0)); PV0i.z = R4i.z; R5i.w = ((PV1i.x == 0)?(0):(0x3f800000)); PV0i.w = R5i.w; -// 9 -R5i.x = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV0i.w), intBitsToFloat(uf_remappedPS[1].x)/resXScale)); -PV1i.y = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV0i.z), intBitsToFloat(uf_remappedPS[1].x)/resXScale)); +// 9 --- Point fo Interest +R5i.x = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV0i.w), intBitsToFloat(uf_remappedPS[1].x))); // Default implmentation division took place here +PV1i.y = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV0i.z), intBitsToFloat(uf_remappedPS[1].x))); // Default implmentation division took place here PV1i.z = floatBitsToInt(max(intBitsToFloat(PV0i.x), -(intBitsToFloat(PV0i.x)))); -R3i.w = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV0i.z), intBitsToFloat(uf_remappedPS[1].y)/resYScale)); +R3i.w = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV0i.z), intBitsToFloat(uf_remappedPS[1].y))); // Default implmentation division took place here PS1i = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R1i.x), intBitsToFloat(PV0i.z))); -// 10 -R127i.x = floatBitsToInt(intBitsToFloat(PV1i.z) * intBitsToFloat(R127i.y)); -R127i.x = clampFI32(R127i.x); -PV0i.x = R127i.x; -R127i.y = floatBitsToInt((mul_nonIEEE(intBitsToFloat(R5i.w),intBitsToFloat(uf_remappedPS[1].y)/resYScale) + intBitsToFloat(PV1i.y))); +// 10 --- Point of Interest +R127i.x = floatBitsToInt(intBitsToFloat(PV1i.z) * intBitsToFloat(R127i.y)); // Divide looks good same as below line ---------------------------------------------------------------------- +R127i.x = clampFI32(R127i.x); // Divide looks good same as above line---------------------------------------------------------------------------------------------------- +PV0i.x = R127i.x; +R127i.y = floatBitsToInt((mul_nonIEEE(intBitsToFloat(R5i.w),intBitsToFloat(uf_remappedPS[1].y)) + intBitsToFloat(PV1i.y))); // Default implmentation division took place here R127i.z = floatBitsToInt((mul_nonIEEE(intBitsToFloat(R1i.z),intBitsToFloat(R5i.w)) + intBitsToFloat(PS1i))); PV0i.z = R127i.z; PV0i.w = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R2i.z), intBitsToFloat(R4i.z))); @@ -206,9 +211,9 @@ PV1i.x = R6i.x; R123i.z = ((PV0i.w == 0)?(R126i.x):(R125i.x)); PV1i.z = R123i.z; PV1i.w = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R127i.x), intBitsToFloat(PV0i.x))); -// 16 +// 16 --- Point of Interest PV0i.x = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R4i.z), intBitsToFloat(PV1i.x))); -PV0i.x = floatBitsToInt(intBitsToFloat(PV0i.x) / 2.0); +PV0i.x = floatBitsToInt(intBitsToFloat(PV0i.x) / 2.0); // Important Doubling improves curves and clarity R123i.y = ((R126i.w == 0)?(R124i.x):(R127i.z)); PV0i.y = R123i.y; R3i.z = floatBitsToInt(intBitsToFloat(PV1i.w) * intBitsToFloat(0x3f400000)); @@ -667,23 +672,27 @@ activeMaskStackC[1] = activeMaskStack[0] == true && activeMaskStackC[0] == true; // export passPixelColor0 = vec4(intBitsToFloat(R3i.x), intBitsToFloat(R3i.y), intBitsToFloat(R3i.z), intBitsToFloat(R3i.w)); } + #endif -#if (preset == 2) +#if (preset == 2) / FXAA /*-----------------------------settings-------------------------------------*/ -#define Subpix 1.00 //[0.000 to 1.000] Choose the amount of sub-pixel aliasing removal. -#define EdgeThreshold 0.125 //[0.000 to 1.000] Edge detection threshold. The minimum amount of local contrast required to apply algorithm. -#define EdgeThresholdMin 0.0625 //[0.000 to 1.000] Darkness threshold. Trims the algorithm from processing darks. +#define Subpix $subPix //[0.000 to 1.000] Choose the amount of sub-pixel aliasing removal. +#define EdgeThreshold $edgeThreshold //[0.000 to 1.000] Edge detection threshold. The minimum amount of local contrast required to apply algorithm. +#define EdgeThresholdMin $edgeThresholdMin //[0.000 to 1.000] Darkness threshold. Trims the algorithm from processing darks. +#define FxaaAdjust $fxaaAdjust //[0.0 to 4.0] Adjusts how smooth or sharp you want AA to be. /*--------------------------------------------------------------------------*/ layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf49b1800 res 1280x720x1 dim 1 tm: 4 format 0019 compSel: 0 1 2 3 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler0 ClampX/Y/Z: 2 2 2 border: 1 -layout(binding = 1) uniform sampler2D textureUnitPS1;// Tex1 addr 0x387f8000 res 1280x720x1 dim 1 tm: 4 format 0001 compSel: 0 4 4 5 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler1 ClampX/Y/Z: 2 2 2 border: 1 +layout(binding = 1) uniform sampler2D textureUnitPS1;// Tex1 addr 0x37f40000 res 1280x720x1 dim 1 tm: 4 format 0001 compSel: 0 4 4 5 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler1 ClampX/Y/Z: 2 2 2 border: 1 layout(location = 0) in vec4 passParameterSem2; layout(location = 0) out vec4 passPixelColor0; uniform vec2 uf_fragCoordScale; +vec2 resolution = textureSize2D(textureUnitPS0,0); + #define FXAA_QUALITY__PS 12 #define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY__P1 1.0 @@ -1009,7 +1018,7 @@ FxaaFloat4 FxaaPixelShader( } -vec2 RcpFrame = vec2(1.0 / 1280.0, 1.0 / 720.0) * uf_fragCoordScale; +vec2 RcpFrame = vec2(1.0 / resolution.x, 1.0 / resolution.y) * uf_fragCoordScale * FxaaAdjust; void main() { passPixelColor0 = FxaaPixelShader(passParameterSem2.xy, textureUnitPS0, textureUnitPS1, RcpFrame, Subpix, EdgeThreshold, EdgeThresholdMin); diff --git a/Enhancements/BreathOfTheWild_!AntiAliasing/f14bb57cd5c9cb77_00000000000003c9_ps.txt b/Enhancements/BreathOfTheWild_!AntiAliasing/f14bb57cd5c9cb77_00000000000003c9_ps.txt index f97ee070..15b5d0c3 100644 --- a/Enhancements/BreathOfTheWild_!AntiAliasing/f14bb57cd5c9cb77_00000000000003c9_ps.txt +++ b/Enhancements/BreathOfTheWild_!AntiAliasing/f14bb57cd5c9cb77_00000000000003c9_ps.txt @@ -1,10 +1,14 @@ #version 420 #extension GL_ARB_texture_gather : enable +#extension GL_ARB_separate_shader_objects : enable #extension GL_EXT_gpu_shader4 : enable -// shader f14bb57cd5c9cb77 -// Used for: Removing/Restoring the native BotW Anti-Aliasing implementation in inventory screen + +// shader f14bb57cd5c9cb77 - dumped 1.15 +// Used for: Removing/Restoring the native BotW World Anti-Aliasing Implementation #define preset $preset +#define aaSharper $aaSharper +#define aaBlurrier $aaBlurrier #if (preset == 0) layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf49b1800 res 1280x720x1 dim 1 tm: 4 format 0019 compSel: 0 1 2 3 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler0 ClampX/Y/Z: 2 2 2 border: 1 @@ -18,14 +22,16 @@ passPixelColor0 = texture(textureUnitPS0, passParameterSem2.xy); #if (preset == 1) uniform ivec4 uf_remappedPS[4]; -layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf4713800 res 1280x720x1 dim 1 tm: 4 format 0019 compSel: 0 1 2 3 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler0 ClampX/Y/Z: 2 2 2 border: 1 -layout(binding = 1) uniform sampler2D textureUnitPS1;// Tex1 addr 0x387f8000 res 1280x720x1 dim 1 tm: 4 format 0001 compSel: 0 4 4 5 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler1 ClampX/Y/Z: 2 2 2 border: 1 +layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf462d000 res 1280x720x1 dim 1 tm: 4 format 0019 compSel: 0 1 2 3 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler0 ClampX/Y/Z: 2 2 2 border: 1 +layout(binding = 1) uniform sampler2D textureUnitPS1;// Tex1 addr 0x37f40000 res 1280x720x1 dim 1 tm: 4 format 0001 compSel: 0 4 4 5 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler1 ClampX/Y/Z: 2 2 2 border: 1 layout(location = 0) in vec4 passParameterSem2; layout(location = 0) out vec4 passPixelColor0; uniform vec2 uf_fragCoordScale; -ivec2 resDim = textureSize2D(textureUnitPS0,0); -const float resXScale = float(resDim.x)/1280; -const float resYScale = float(resDim.y)/720; + +vec2 resDim = textureSize2D(textureUnitPS0,0); // Retrieve texture dimensions vector holds data-type-float +const float resX = ( (resDim.x/1280) + aaSharper ) - aaBlurrier; // 1st comes aaSharper needs to be added to the direct result of resolution ratio to make it more sharper +const float resY = ( (resDim.y/720) + aaSharper ) - aaBlurrier; // 2nd comes aablurier needs to be subtracted from final result to make it more blurrier + int clampFI32(int v) { if( v == 0x7FFFFFFF ) @@ -34,13 +40,13 @@ 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; } +float mul_nonIEEE(float a, float b){return mix(0.0, a*b, (a != 0.0) && (b != 0.0));} void main() { vec4 R0f = vec4(0.0); -vec4 R1f = vec4(0.0); +vec4 R1f = vec4(0.0); // Important variable vec4 R2f = vec4(0.0); -vec4 R3f = vec4(0.0); +vec4 R3f = vec4(0.0); // Important variable vec4 R123f = vec4(0.0); vec4 R126f = vec4(0.0); vec4 R127f = vec4(0.0); @@ -98,19 +104,19 @@ PV1f.x = mul_nonIEEE(PS0f, intBitsToFloat(uf_remappedPS[1].x)); PV1f.y = max(PV0f.z, PS0f); PV1f.z = min(PV0f.z, PV0f.w); PV1f.w = min(PV0f.y, PV0f.x); -// 4 +// 4 ---Point of Interest R1f.x = -(PV1f.z) + PV1f.y; -R0f.z = max(PV1f.x, intBitsToFloat(uf_remappedPS[1].y)); -PS0f = 1.0 / PV1f.w; +R0f.z = max(PV1f.x, intBitsToFloat(uf_remappedPS[1].y)); // Important - Divide looks blurrier/fuzzy and multiply looks sharper good +PS0f = 1.0 / PV1f.w; // Important line affects aliasing strongly, increasing it is blurier and decreasing sharpens // 5 PV1f.x = mul_nonIEEE(R127f.z, PS0f); PV1f.y = mul_nonIEEE(R126f.w, PS0f); // 6 PV0f.z = max(PV1f.x, -(intBitsToFloat(uf_remappedPS[2].y))); PV0f.w = max(PV1f.y, -(intBitsToFloat(uf_remappedPS[2].y))); -// 7 -R3f.x = min(PV0f.w, intBitsToFloat(uf_remappedPS[2].y)); -R1f.y = min(PV0f.z, intBitsToFloat(uf_remappedPS[2].y)); +// 7 --- Point of Interest +R3f.x = min(PV0f.w, intBitsToFloat(uf_remappedPS[2].y)); // Important - Divide looks sharper and better and multiply looks blurier fuzzy +R1f.y = min(PV0f.z, intBitsToFloat(uf_remappedPS[2].y)); // Important - Divide looks sharper and better and multiply looks blurier fuzzy // 8 predResult = (R1f.x > R0f.z); activeMaskStack[1] = predResult; @@ -124,13 +130,13 @@ if( activeMaskStackC[2] == true ) { // 0 backupReg0f = R3f.x; backupReg0f = R3f.x; -R3f.x = (mul_nonIEEE(backupReg0f,intBitsToFloat(uf_remappedPS[3].x)/resXScale) + R0f.x); -R3f.y = (mul_nonIEEE(R1f.y,intBitsToFloat(uf_remappedPS[3].y)/resYScale) + R0f.y); -R1f.x = (mul_nonIEEE(backupReg0f,-(intBitsToFloat(uf_remappedPS[3].x)/resXScale)) + R0f.x); +R3f.x = (mul_nonIEEE(backupReg0f,intBitsToFloat(uf_remappedPS[3].x)/resX) + R0f.x); // Original Implementation divided x +R3f.y = (mul_nonIEEE(R1f.y,intBitsToFloat(uf_remappedPS[3].y)/resY) + R0f.y); // Original Implementation divided y +R1f.x = (mul_nonIEEE(backupReg0f,-(intBitsToFloat(uf_remappedPS[3].x)/resX)) + R0f.x); // Original Implementation divided x PS0f = R1f.x; // 1 backupReg0f = R1f.y; -R1f.y = (mul_nonIEEE(backupReg0f,-(intBitsToFloat(uf_remappedPS[3].y)/resYScale)) + R0f.y); +R1f.y = (mul_nonIEEE(backupReg0f,-(intBitsToFloat(uf_remappedPS[3].y)/resY)) + R0f.y); // Original Implementation divided y } if( activeMaskStackC[2] == true ) { R0f.xyzw = (texture(textureUnitPS0, R3f.xy).xyzw); @@ -170,18 +176,21 @@ passPixelColor0 = vec4(R2f.x, R2f.y, R2f.z, R2f.w); #if (preset == 2) /*-----------------------------settings-------------------------------------*/ -#define Subpix 0.70 //[0.000 to 1.000] Choose the amount of sub-pixel aliasing removal. -#define EdgeThreshold 0.125 //[0.000 to 1.000] Edge detection threshold. The minimum amount of local contrast required to apply algorithm. -#define EdgeThresholdMin 0.0625 //[0.000 to 1.000] Darkness threshold. Trims the algorithm from processing darks. +#define Subpix $subPix //[0.000 to 1.000] Choose the amount of sub-pixel aliasing removal. +#define EdgeThreshold $edgeThreshold //[0.000 to 1.000] Edge detection threshold. The minimum amount of local contrast required to apply algorithm. +#define EdgeThresholdMin $edgeThresholdMin //[0.000 to 1.000] Darkness threshold. Trims the algorithm from processing darks. +#define FxaaAdjust $fxaaAdjust //[0.0 to 4.0] Adjusts how smooth or sharp you want AA to be. /*--------------------------------------------------------------------------*/ layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf49b1800 res 1280x720x1 dim 1 tm: 4 format 0019 compSel: 0 1 2 3 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler0 ClampX/Y/Z: 2 2 2 border: 1 -layout(binding = 1) uniform sampler2D textureUnitPS1;// Tex1 addr 0x387f8000 res 1280x720x1 dim 1 tm: 4 format 0001 compSel: 0 4 4 5 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler1 ClampX/Y/Z: 2 2 2 border: 1 +layout(binding = 1) uniform sampler2D textureUnitPS1;// Tex1 addr 0x37f40000 res 1280x720x1 dim 1 tm: 4 format 0001 compSel: 0 4 4 5 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler1 ClampX/Y/Z: 2 2 2 border: 1 layout(location = 0) in vec4 passParameterSem2; layout(location = 0) out vec4 passPixelColor0; uniform vec2 uf_fragCoordScale; +vec2 resolution = textureSize2D(textureUnitPS0,0); // Retrieve Texture Dimensions in float data type so we dont need to convert + #define FXAA_QUALITY__PS 12 #define FXAA_QUALITY__P0 1.0 #define FXAA_QUALITY__P1 1.0 @@ -507,9 +516,9 @@ FxaaFloat4 FxaaPixelShader( } -vec2 RcpFrame = vec2(1.0 / 1280.0, 1.0 / 720.0) * uf_fragCoordScale; +vec2 RcpFrame = vec2(1.0 / resolution.x, 1.0 / resolution.y) * uf_fragCoordScale * FxaaAdjust; // This is where the dimensions are used, Fxaaadjust can make it sharp to blurry void main() { passPixelColor0 = FxaaPixelShader(passParameterSem2.xy, textureUnitPS0, textureUnitPS1, RcpFrame, Subpix, EdgeThreshold, EdgeThresholdMin); } -#endif \ No newline at end of file +#endif diff --git a/Enhancements/BreathOfTheWild_!AntiAliasing/rules.txt b/Enhancements/BreathOfTheWild_!AntiAliasing/rules.txt index 98d590c6..dc38125c 100644 --- a/Enhancements/BreathOfTheWild_!AntiAliasing/rules.txt +++ b/Enhancements/BreathOfTheWild_!AntiAliasing/rules.txt @@ -2,20 +2,48 @@ titleIds = 00050000101C9300,00050000101C9400,00050000101C9500 name = Anti-Aliasing path = "The Legend of Zelda: Breath of the Wild/Graphics/Anti-Aliasing" -description = Enables and Disables Anti-Aliasing processing. FXAA is better alternative and customizable. Check the "!GameTitleHere_Anti-Aliasing/rules.txt" file in your graphicPack folder for info about the individual settings. +description = Enables and Disables Native Botw Anti-Aliasing. Also includes an alternative FXAA implementation. Check the "Anti-Aliasing/rules.txt" file in your Botw AA graphicPack folder for info about the individual settings. version = 3 [Preset] -name = Disabled +name = Disable Native AA $preset:int = 0 +# +$aaSharper = 0.5 # Ignore +$aaBlurrier = 0.0 # Ignore +# +$subPix = 0.75 # Ignore +$edgeThreshold = 0.0166 # Ignore +$edgeThresholdMin = 0.0833 # Ignore +$fxaaAdjust = 1.0 # Ignore [Preset] -name = Enabled +name = Enable Native AA $preset:int = 1 +# +$aaSharper = 0.5 +$aaBlurrier = 0.0 +# +$subPix = 0.75 # Ignore +$edgeThreshold = 0.0166 # Ignore +$edgeThresholdMin = 0.0833 # Ignore +$fxaaAdjust = 1.0 # Ignore [Preset] name = FXAA $preset:int = 2 +# +$aaSharper = 0.5 # Ignore +$aaBlurrier = 0.0 # Ignore +# +$subPix = 1.0 +$edgeThreshold = 0.0125 +$edgeThresholdMin = 0.0625 +$fxaaAdjust = 2.0 + +# aaSharper / aaBlurrier - Only applies to enabled preset +# Adjusts native AA implmentation +# Values - [0.0 - 1.0] - keep one of the varaibles at 0 while adjusting the other one # Subpix: # Choose the amount of sub-pixel aliasing removal. @@ -40,5 +68,9 @@ $preset:int = 2 # 0.0625 - high quality (faster) # 0.0312 - visible limit (slower) +# FxaaAdjust +# Makes FXAA more clearer or blurrier +# [0.0 - 1.0] values are used to divide by Var x 0.2 +# [1.0 - 4.0] are used to multiply by Var x 2.0 # Credit: Kiri, NAVras # Credit: SkalFate for proper V3 Import. diff --git a/Resolutions/BreathOfTheWild_Resolution/0f2b9ee517917425_00000000000003c9_ps.txt b/Resolutions/BreathOfTheWild_Resolution/0f2b9ee517917425_00000000000003c9_ps.txt index f1cf6880..5264c1d9 100644 --- a/Resolutions/BreathOfTheWild_Resolution/0f2b9ee517917425_00000000000003c9_ps.txt +++ b/Resolutions/BreathOfTheWild_Resolution/0f2b9ee517917425_00000000000003c9_ps.txt @@ -1,16 +1,18 @@ #version 420 #extension GL_ARB_texture_gather : enable -// shader 0f2b9ee517917425 +// shader 0f2b9ee517917425 - dumped cemu 1.15 // Used for: Restoring the native BotW Anti-Aliasing implementation in inventory screen -const float resXScale = $width/1280; -const float resYScale = $height/720; + +const float resX = $width/1280; +const float resY = $height/720; uniform ivec4 uf_remappedPS[2]; layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf49b1800 res 1280x720x1 dim 1 tm: 4 format 0019 compSel: 0 1 2 3 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler0 ClampX/Y/Z: 2 2 2 border: 1 -layout(binding = 1) uniform sampler2D textureUnitPS1;// Tex1 addr 0x387f8000 res 1280x720x1 dim 1 tm: 4 format 0001 compSel: 0 4 4 5 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler1 ClampX/Y/Z: 2 2 2 border: 1 +layout(binding = 1) uniform sampler2D textureUnitPS1;// Tex1 addr 0x37b40000 res 1280x720x1 dim 1 tm: 4 format 0001 compSel: 0 4 4 5 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler1 ClampX/Y/Z: 2 2 2 border: 1 layout(location = 0) in vec4 passParameterSem2; layout(location = 0) out vec4 passPixelColor0; uniform vec2 uf_fragCoordScale; + int clampFI32(int v) { if( v == 0x7FFFFFFF ) @@ -19,7 +21,7 @@ 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; } +float mul_nonIEEE(float a, float b){return mix(0.0, a*b, (a != 0.0) && (b != 0.0));} void main() { ivec4 R0i = ivec4(0); @@ -35,7 +37,7 @@ ivec4 R125i = ivec4(0); ivec4 R126i = ivec4(0); ivec4 R127i = ivec4(0); int backupReg0i, backupReg1i, backupReg2i, backupReg3i, backupReg4i; -ivec4 PV0i = ivec4(0), PV1i = ivec4(0); +ivec4 PV0i = ivec4(0), PV1i = ivec4(0); // These variables make the difference int PS0i = 0, PS1i = 0; ivec4 tempi = ivec4(0); float tempResultf; @@ -63,21 +65,21 @@ R1i.y = floatBitsToInt(textureOffset(textureUnitPS1, intBitsToFloat(R0i.xy),ivec if( activeMaskStackC[1] == true ) { activeMaskStack[1] = activeMaskStack[0]; activeMaskStackC[2] = activeMaskStackC[1]; -// 0 -PV0i.x = floatBitsToInt(min(intBitsToFloat(R1i.x), intBitsToFloat(R1i.z))); -PV0i.y = floatBitsToInt(max(intBitsToFloat(R2i.x), intBitsToFloat(R2i.z))); -PV0i.z = floatBitsToInt(max(intBitsToFloat(R1i.x), intBitsToFloat(R1i.z))); +// 0 --- Point of Interest 1 +PV0i.x = floatBitsToInt(min(intBitsToFloat(R1i.x), intBitsToFloat(R1i.z)) / resX ); // Divide looks better for minimum - Must place the varaibles in that location of the round brackets to use floats correctly +PV0i.y = floatBitsToInt(max(intBitsToFloat(R2i.x), intBitsToFloat(R2i.z)) * resY ); // Multiply looks beeter for max - Must place the varaibles in that location of the round brackets to use floats correctly +PV0i.z = floatBitsToInt(max(intBitsToFloat(R1i.x), intBitsToFloat(R1i.z)) * resX ); // Multiply looks better for max - Must place the varaibles in that location of the round brackets to use floats correctly PV0i.w = floatBitsToInt(min(intBitsToFloat(R2i.x), intBitsToFloat(R2i.z))); -// 1 +// 1 ---Point of Interest 2 PV1i.x = floatBitsToInt(max(intBitsToFloat(PV0i.z), intBitsToFloat(PV0i.y))); PV1i.y = floatBitsToInt(min(intBitsToFloat(PV0i.x), intBitsToFloat(PV0i.w))); // 2 PV0i.z = floatBitsToInt(min(intBitsToFloat(R2i.w), intBitsToFloat(PV1i.y))); PV0i.w = floatBitsToInt(max(intBitsToFloat(R2i.w), intBitsToFloat(PV1i.x))); -// 3 +// 3 PV1i.x = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV0i.w), intBitsToFloat(uf_remappedPS[0].x))); R1i.w = floatBitsToInt(intBitsToFloat(PV0i.w) + -(intBitsToFloat(PV0i.z))); -// 4 +// 4 R2i.y = floatBitsToInt(max(intBitsToFloat(PV1i.x), intBitsToFloat(uf_remappedPS[0].y))); // 5 predResult = (intBitsToFloat(R1i.w) >= intBitsToFloat(R2i.y)); @@ -137,7 +139,7 @@ PV1i.x = floatBitsToInt(intBitsToFloat(PV0i.x) + intBitsToFloat(PV0i.z)); PV1i.y = floatBitsToInt(intBitsToFloat(R127i.w) + intBitsToFloat(R126i.z)); PV1i.y = floatBitsToInt(intBitsToFloat(PV1i.y) * 2.0); R127i.z = floatBitsToInt(intBitsToFloat(backupReg0i) + intBitsToFloat(PV0i.w)); -R127i.y = floatBitsToInt(1.0 / intBitsToFloat(R1i.w)); +R127i.y = floatBitsToInt(1.0 / intBitsToFloat(R1i.w)); // Rli.w * 2 has the same affect as line 85------------------------------------------------------ PS1i = R127i.y; // 6 PV0i.x = floatBitsToInt(intBitsToFloat(R126i.w) + intBitsToFloat(PV1i.y)); @@ -151,17 +153,17 @@ R4i.z = ((PV1i.x == 0)?(0x3f800000):(0)); PV0i.z = R4i.z; R5i.w = ((PV1i.x == 0)?(0):(0x3f800000)); PV0i.w = R5i.w; -// 9 -R5i.x = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV0i.w), intBitsToFloat(uf_remappedPS[1].x)/resXScale)); -PV1i.y = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV0i.z), intBitsToFloat(uf_remappedPS[1].x)/resXScale)); +// 9 --- Point fo Interest +R5i.x = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV0i.w), intBitsToFloat(uf_remappedPS[1].x))); // Default implmentation division took place here +PV1i.y = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV0i.z), intBitsToFloat(uf_remappedPS[1].x))); // Default implmentation division took place here PV1i.z = floatBitsToInt(max(intBitsToFloat(PV0i.x), -(intBitsToFloat(PV0i.x)))); -R3i.w = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV0i.z), intBitsToFloat(uf_remappedPS[1].y)/resYScale)); +R3i.w = floatBitsToInt(mul_nonIEEE(intBitsToFloat(PV0i.z), intBitsToFloat(uf_remappedPS[1].y))); // Default implmentation division took place here PS1i = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R1i.x), intBitsToFloat(PV0i.z))); -// 10 -R127i.x = floatBitsToInt(intBitsToFloat(PV1i.z) * intBitsToFloat(R127i.y)); -R127i.x = clampFI32(R127i.x); -PV0i.x = R127i.x; -R127i.y = floatBitsToInt((mul_nonIEEE(intBitsToFloat(R5i.w),intBitsToFloat(uf_remappedPS[1].y)/resYScale) + intBitsToFloat(PV1i.y))); +// 10 --- Point of Interest +R127i.x = floatBitsToInt(intBitsToFloat(PV1i.z) * intBitsToFloat(R127i.y)); // Divide looks good same as below line ---------------------------------------------------------------------- +R127i.x = clampFI32(R127i.x); // Divide looks good same as above line---------------------------------------------------------------------------------------------------- +PV0i.x = R127i.x; +R127i.y = floatBitsToInt((mul_nonIEEE(intBitsToFloat(R5i.w),intBitsToFloat(uf_remappedPS[1].y)) + intBitsToFloat(PV1i.y))); // Default implmentation division took place here R127i.z = floatBitsToInt((mul_nonIEEE(intBitsToFloat(R1i.z),intBitsToFloat(R5i.w)) + intBitsToFloat(PS1i))); PV0i.z = R127i.z; PV0i.w = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R2i.z), intBitsToFloat(R4i.z))); @@ -190,9 +192,9 @@ PV1i.x = R6i.x; R123i.z = ((PV0i.w == 0)?(R126i.x):(R125i.x)); PV1i.z = R123i.z; PV1i.w = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R127i.x), intBitsToFloat(PV0i.x))); -// 16 +// 16 --- Point of Interest PV0i.x = floatBitsToInt(mul_nonIEEE(intBitsToFloat(R4i.z), intBitsToFloat(PV1i.x))); -PV0i.x = floatBitsToInt(intBitsToFloat(PV0i.x) / 2.0); +PV0i.x = floatBitsToInt(intBitsToFloat(PV0i.x) / 2.0); // Important Doubling improves curves and clarity R123i.y = ((R126i.w == 0)?(R124i.x):(R127i.z)); PV0i.y = R123i.y; R3i.z = floatBitsToInt(intBitsToFloat(PV1i.w) * intBitsToFloat(0x3f400000)); diff --git a/Resolutions/BreathOfTheWild_Resolution/f14bb57cd5c9cb77_00000000000003c9_ps.txt b/Resolutions/BreathOfTheWild_Resolution/f14bb57cd5c9cb77_00000000000003c9_ps.txt index c80d7113..cfee374b 100644 --- a/Resolutions/BreathOfTheWild_Resolution/f14bb57cd5c9cb77_00000000000003c9_ps.txt +++ b/Resolutions/BreathOfTheWild_Resolution/f14bb57cd5c9cb77_00000000000003c9_ps.txt @@ -1,16 +1,20 @@ #version 420 #extension GL_ARB_texture_gather : enable -// shader f14bb57cd5c9cb77 -// Used for: Restoring the native BotW Anti-Aliasing implementation -const float resXScale = $width/1280; -const float resYScale = $height/720; +#extension GL_ARB_separate_shader_objects : enable + +// shader f14bb57cd5c9cb77 - dumped 1.15 +// Used for: Removing/Restoring the native BotW World Anti-Aliasing implementation + +const float resX = $width/1280; +const float resY = $height/720; uniform ivec4 uf_remappedPS[4]; -layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf4713800 res 1280x720x1 dim 1 tm: 4 format 0019 compSel: 0 1 2 3 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler0 ClampX/Y/Z: 2 2 2 border: 1 -layout(binding = 1) uniform sampler2D textureUnitPS1;// Tex1 addr 0x387f8000 res 1280x720x1 dim 1 tm: 4 format 0001 compSel: 0 4 4 5 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler1 ClampX/Y/Z: 2 2 2 border: 1 +layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf462d000 res 1280x720x1 dim 1 tm: 4 format 0019 compSel: 0 1 2 3 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler0 ClampX/Y/Z: 2 2 2 border: 1 +layout(binding = 1) uniform sampler2D textureUnitPS1;// Tex1 addr 0x37f40000 res 1280x720x1 dim 1 tm: 4 format 0001 compSel: 0 4 4 5 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler1 ClampX/Y/Z: 2 2 2 border: 1 layout(location = 0) in vec4 passParameterSem2; layout(location = 0) out vec4 passPixelColor0; uniform vec2 uf_fragCoordScale; + int clampFI32(int v) { if( v == 0x7FFFFFFF ) @@ -19,13 +23,13 @@ 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; } +float mul_nonIEEE(float a, float b){return mix(0.0, a*b, (a != 0.0) && (b != 0.0));} void main() { vec4 R0f = vec4(0.0); -vec4 R1f = vec4(0.0); +vec4 R1f = vec4(0.0); // Important variable vec4 R2f = vec4(0.0); -vec4 R3f = vec4(0.0); +vec4 R3f = vec4(0.0); // Important variable vec4 R123f = vec4(0.0); vec4 R126f = vec4(0.0); vec4 R127f = vec4(0.0); @@ -56,7 +60,7 @@ if( activeMaskStackC[1] == true ) { activeMaskStack[1] = activeMaskStack[0]; activeMaskStackC[2] = activeMaskStackC[1]; // 0 -PV0f.x = R1f.w + -(R1f.x); +PV0f.x = R1f.w + -(R1f.x); PV0f.y = R1f.z + -(R1f.y); PV0f.z = mul_nonIEEE(R2f.x, intBitsToFloat(uf_remappedPS[0].x)); R127f.w = min(R1f.z, R1f.x); @@ -85,17 +89,17 @@ PV1f.z = min(PV0f.z, PV0f.w); PV1f.w = min(PV0f.y, PV0f.x); // 4 R1f.x = -(PV1f.z) + PV1f.y; -R0f.z = max(PV1f.x, intBitsToFloat(uf_remappedPS[1].y)); -PS0f = 1.0 / PV1f.w; +R0f.z = max(PV1f.x, intBitsToFloat(uf_remappedPS[1].y)); // Important - Divide looks blurrier/fuzzy and multiply looks sharper good +PS0f = 1.0 / PV1f.w; // Important line affects aliasing strongly, increasing it is blurier and decreasing sharpens // 5 PV1f.x = mul_nonIEEE(R127f.z, PS0f); PV1f.y = mul_nonIEEE(R126f.w, PS0f); // 6 PV0f.z = max(PV1f.x, -(intBitsToFloat(uf_remappedPS[2].y))); PV0f.w = max(PV1f.y, -(intBitsToFloat(uf_remappedPS[2].y))); -// 7 -R3f.x = min(PV0f.w, intBitsToFloat(uf_remappedPS[2].y)); -R1f.y = min(PV0f.z, intBitsToFloat(uf_remappedPS[2].y)); +// 7 - another way to do it other than the original implmentation +R3f.x = min(PV0f.w, intBitsToFloat(uf_remappedPS[2].y)); // Important - Divide looks sharper and better and multiply looks blurier fuzzy +R1f.y = min(PV0f.z, intBitsToFloat(uf_remappedPS[2].y)); // Important - Divide looks sharper and better and multiply looks blurier fuzzy // 8 predResult = (R1f.x > R0f.z); activeMaskStack[1] = predResult; @@ -109,13 +113,13 @@ if( activeMaskStackC[2] == true ) { // 0 backupReg0f = R3f.x; backupReg0f = R3f.x; -R3f.x = (mul_nonIEEE(backupReg0f,intBitsToFloat(uf_remappedPS[3].x)/resXScale) + R0f.x); -R3f.y = (mul_nonIEEE(R1f.y,intBitsToFloat(uf_remappedPS[3].y)/resYScale) + R0f.y); -R1f.x = (mul_nonIEEE(backupReg0f,-(intBitsToFloat(uf_remappedPS[3].x)/resXScale)) + R0f.x); +R3f.x = (mul_nonIEEE(backupReg0f,intBitsToFloat(uf_remappedPS[3].x)/resX) + R0f.x); // Original Implementation +R3f.y = (mul_nonIEEE(R1f.y,intBitsToFloat(uf_remappedPS[3].y)/resY) + R0f.y); // Original Implementation +R1f.x = (mul_nonIEEE(backupReg0f,-(intBitsToFloat(uf_remappedPS[3].x)/resX)) + R0f.x); // Original Implementation PS0f = R1f.x; // 1 backupReg0f = R1f.y; -R1f.y = (mul_nonIEEE(backupReg0f,-(intBitsToFloat(uf_remappedPS[3].y)/resYScale)) + R0f.y); +R1f.y = (mul_nonIEEE(backupReg0f,-(intBitsToFloat(uf_remappedPS[3].y)/resY)) + R0f.y); // Original Implementation } if( activeMaskStackC[2] == true ) { R0f.xyzw = (texture(textureUnitPS0, R3f.xy).xyzw);