cemu_graphic_packs/Enthusiast/BreathOfTheWild_2880p/cb0e6e8cbec4502a_0000000000000079_ps.txt
NAVras-Z 2c3d552cbf [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...?
2017-09-30 00:01:54 +02:00

39 lines
1.6 KiB
Plaintext

#version 420
#extension GL_ARB_texture_gather : enable
// shader cb0e6e8cbec4502a
layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf5c7b800 res 1280x720x1 dim 1 tm: 4 format 0816 compSel: 0 1 2 5 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler0 ClampX/Y/Z: 2 2 2 border: 1
layout(location = 0) in vec4 passParameterSem3;
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()
{
vec2 R0f = vec2((passParameterSem3.x + passParameterSem3.z)/2, (passParameterSem3.y+passParameterSem3.w)/2); //center point
ivec2 ires = textureSize(textureUnitPS0,0);
vec2 res = vec2( float(ires.x), float(ires.y) );
int r = int(floor(2.0 / uf_fragCoordScale.y + 0.5));
vec4 R1f = vec4(0.0);
for (int i=0; i<r; i++) {
float m = (1-r)/2 + float(i);
for (int k=0; k<r; k++){
float n = (1-r)/2 + float(k);
R1f += texture( textureUnitPS0, R0f+ vec2(m,n) * 2.0 /res )/(pow(r,2)-4); //assume 2px offset as well
}
}
R1f -= texture( textureUnitPS0, R0f+ vec2((1-r)/2,(1-r)/2) * 2.0 /res )/(pow(r,2)-4);
R1f -= texture( textureUnitPS0, R0f+ vec2((1-r)/2,(r-1)/2) * 2.0 /res )/(pow(r,2)-4);
R1f -= texture( textureUnitPS0, R0f+ vec2((r-1)/2,(1-r)/2) * 2.0 /res )/(pow(r,2)-4);
R1f -= texture( textureUnitPS0, R0f+ vec2((r-1)/2,(r-1)/2) * 2.0 /res )/(pow(r,2)-4); //workaround, less like a square, needs proper bokeh
passPixelColor0 = R1f;
}