cemu_graphic_packs/Resolutions/BreathOfTheWild_Resolution/cb0e6e8cbec4502a_0000000000000079_ps.txt
2019-07-07 11:26:09 +02:00

29 lines
925 B
GLSL

#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_separate_shader_objects : enable
// shader cb0e6e8cbec4502a
// Used for: 1 pass Battle, Camera and Scope Depth of Field Blur
layout(binding = 0) uniform sampler2D textureUnitPS0;
layout(location = 0) in vec4 passParameterSem3;
layout(location = 0) out vec4 passPixelColor0;
uniform vec2 uf_fragCoordScale;
int radius = int( roundEven(2.0/uf_fragCoordScale.y) );
vec2 resolution = vec2( textureSize(textureUnitPS0,0) );
void main() {
vec2 center = ( passParameterSem3.xy + passParameterSem3.zw ) / 2.0 ;
vec3 result = vec3(0.0);
float count = 0.0;
for ( int x = 1-radius; x <= radius-1; x+=2 ) {
for ( int y = 1-radius; y <= radius-1; y+=2 ) {
if ( length(vec2(x, y)) <= radius ) {
result += texture( textureUnitPS0, center + vec2(x, y)/resolution ).xyz ;
count += 1.0;
}
}
}
passPixelColor0 = vec4( result / count, 0.0 );
}