cemu_graphic_packs/Enhancement/BreathOfTheWild_0FXAA/f14bb57cd5c9cb77_00000000000003c9_ps.txt
Milan 39757a4b2b Merged changes made in the Slashiee's master to my fork. (#1)
* Fixed inventory Link AA Removal's name as it didn't work before, added comments to those shaders. (#87)

* Fixed Inventory FXAA naming, added comments to those shaders

Pretty much a fix, should definitely work now. A comparision can be seen here: http://screenshotcomparison.com/comparison/118920 . Keep in mind that the one on the left side has BotW Anti-Aliasing and the one on the right has this shader enabled. I didn't use any FXAA from my Nvidia GPU.

* Whoops, it didn't fix the replacement FXAA, but rather the AA Removal

Fixed AA Removal file names (didn't work before) and added comments to those files.

* [BOTW] Add custom blur shaders (#86)

* Fix some pixelated blur in high res

* forgot to add rule

* double offset to get similar blur

more powah

* move into every res pack (excepth res<= 720)

credit to @JoelAlone for finding the what those values does.
ps: why github changes file hash...?

*  [BOTW] FXAA (#88)

* Added resolution independent FXAA for BotW

* Renamed to give FXAA priority over base graphics packs
2017-10-01 14:06:04 +02:00

66 lines
2.8 KiB
Plaintext

#version 420
#extension GL_ARB_texture_gather : enable
// shader f14bb57cd5c9cb77
//replaces broken aa everywhere with fxaa
//original shader dumped using cemu 1.9.1, BotW 1.3.1
//credit goes to https://gist.github.com/sakrist/7912905
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(location = 0) in vec4 passParameterSem2;
layout(location = 0) out vec4 passPixelColor0;
uniform vec2 uf_fragCoordScale;
const float FXAA_SPAN_MAX = 8.0;
const float FXAA_REDUCE_MUL = 1.0 / 8.0;
const float FXAA_REDUCE_MIN = 1.0 / 128.0;
const ivec2 res = textureSize(textureUnitPS0,0);
const vec2 frameBufSize = vec2( float(res.x), float(res.y) );
void main(void) {
vec2 texCoords = passParameterSem2.xy;
vec3 rgbNW = texture2D(textureUnitPS0, texCoords + (vec2(-1.0, -1.0) / frameBufSize)).xyz;
vec3 rgbNE = texture2D(textureUnitPS0, texCoords + (vec2(1.0, -1.0) / frameBufSize)).xyz;
vec3 rgbSW = texture2D(textureUnitPS0, texCoords + (vec2(-1.0, 1.0) / frameBufSize)).xyz;
vec3 rgbSE = texture2D(textureUnitPS0, texCoords + (vec2(1.0, 1.0) / frameBufSize)).xyz;
vec3 rgbM = texture2D(textureUnitPS0, texCoords).xyz;
vec3 luma = vec3(0.299, 0.587, 0.114);
float lumaNW = dot(rgbNW, luma);
float lumaNE = dot(rgbNE, luma);
float lumaSW = dot(rgbSW, luma);
float lumaSE = dot(rgbSE, luma);
float lumaM = dot(rgbM, luma);
float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));
float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));
vec2 dir;
dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));
dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));
float dirReduce = max(
(lumaNW + lumaNE + lumaSW + lumaSE) * (0.25 * FXAA_REDUCE_MUL),
FXAA_REDUCE_MIN);
float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);
dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),
max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),
dir * rcpDirMin)) / frameBufSize;
vec3 rgbA = (1.0 / 2.0) * (
texture2D(textureUnitPS0, texCoords.xy + dir * (1.0 / 3.0 - 0.5)).xyz +
texture2D(textureUnitPS0, texCoords.xy + dir * (2.0 / 3.0 - 0.5)).xyz);
vec3 rgbB = rgbA * (1.0 / 2.0) + (1.0 / 4.0) * (
texture2D(textureUnitPS0, texCoords.xy + dir * (0.0 / 3.0 - 0.5)).xyz +
texture2D(textureUnitPS0, texCoords.xy + dir * (3.0 / 3.0 - 0.5)).xyz);
float lumaB = dot(rgbB, luma);
if ((lumaB < lumaMin) || (lumaB > lumaMax)) {
passPixelColor0.xyz = rgbA;
}
else {
passPixelColor0.xyz = rgbB;
}
}