mirror of
https://github.com/cemu-project/cemu_graphic_packs.git
synced 2024-11-22 09:39:17 +01:00
[BotW] Make circular blur more optimized (used in battle, camera and scope)
PR made by NAVras-Z!
This commit is contained in:
parent
352d1d5af7
commit
a60932d040
@ -1,29 +1,29 @@
|
|||||||
#version 420
|
#version 420
|
||||||
#extension GL_ARB_texture_gather : enable
|
#extension GL_ARB_texture_gather : enable
|
||||||
#extension GL_ARB_arrays_of_arrays : enable
|
#extension GL_ARB_separate_shader_objects : enable
|
||||||
// shader cb0e6e8cbec4502a
|
|
||||||
// Used for: Horizontal+Vertical Battle, Camera and Scope Depth of Field Blur
|
|
||||||
|
|
||||||
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
|
// 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) in vec4 passParameterSem3;
|
||||||
layout(location = 0) out vec4 passPixelColor0;
|
layout(location = 0) out vec4 passPixelColor0;
|
||||||
uniform vec2 uf_fragCoordScale;
|
uniform vec2 uf_fragCoordScale;
|
||||||
|
|
||||||
const float resScale = $height/720;
|
int radius = int( roundEven(2.0/uf_fragCoordScale.y) );
|
||||||
const int radius = int(2*resScale);
|
vec2 resolution = vec2( textureSize(textureUnitPS0,0) );
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
vec2 center = (passParameterSem3.xy + passParameterSem3.zw) / 2;
|
vec2 center = ( passParameterSem3.xy + passParameterSem3.zw ) / 2.0 ;
|
||||||
vec2 step = passParameterSem3.xw - passParameterSem3.zy;
|
vec3 result = vec3(0.0);
|
||||||
vec4 result = vec4(0.0);
|
|
||||||
float count = 0.0;
|
float count = 0.0;
|
||||||
for (int x = -radius; x <= radius; x++) {
|
for ( int x = 1-radius; x <= radius-1; x+=2 ) {
|
||||||
for (int y = -radius; y <= radius; y++) {
|
for ( int y = 1-radius; y <= radius-1; y+=2 ) {
|
||||||
if ( length(vec2(x, y)) <= radius ) {
|
if ( length(vec2(x, y)) <= radius ) {
|
||||||
result += texture(textureUnitPS0, center + vec2(x, y)*step);
|
result += texture( textureUnitPS0, center + vec2(x, y)/resolution ).xyz ;
|
||||||
count += 1.0;
|
count += 1.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
passPixelColor0 = result / count;
|
passPixelColor0 = vec4( result / count, 0.0 );
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user