[XCX} Probe view, Blur fix

Fix - Scale map view so probe doesn't break
Fix - Inital commit of blur fix
This commit is contained in:
getdls 2017-11-20 01:53:39 +01:00
parent b277e8669c
commit 61bf0415c7
4 changed files with 310 additions and 143 deletions

View File

@ -8,9 +8,10 @@ $scaleFactorY = always_decimal_format($fullHeight / 720.0);
#version 420
#extension GL_ARB_texture_gather : enable
// shader 840947e29015aa9a
// shader 840947e29015aa9a // fix circle
// cutscene DOF, reveal talk BG
// To-do Review multi pass performance and bokeh depth
// To-do. Tweak blur scaling to resolution. Weights are funky, too bright
const float resScale = <?=$scaleFactorX?>;
//const float resScale = 3;
uniform ivec4 uf_remappedPS[3];
@ -21,78 +22,127 @@ layout(location = 1) in vec4 passParameterSem1;
layout(location = 0) out vec4 passPixelColor0;
uniform vec2 uf_fragCoordScale;
vec4 blur9(sampler2D image, vec2 uv, vec2 resolution, vec2 direction) {
vec4 color = vec4(0.0);
vec2 off1 = vec2(1.3846153846) * direction;
vec2 off2 = vec2(3.2307692308) * direction;
color += texture2D(image, uv) * 0.2270270270;
color += texture2D(image, uv + (off1 / resolution)) * 0.3162162162;
color += texture2D(image, uv - (off1 / resolution)) * 0.3162162162;
color += texture2D(image, uv + (off2 / resolution)) * 0.0702702703;
color += texture2D(image, uv - (off2 / resolution)) * 0.0702702703;
return color;
vec2 Circle(float Start, float Points, float Point)
{
float Rad = (3.141592 * 2.0 * (1.0 / Points)) * (Point + Start);
return vec2(sin(Rad), cos(Rad));
}
highp float lineRand(vec2 co)
{
highp float a = 12.9898;
highp float b = 78.233;
highp float c = 43758.5453;
highp float dt = dot(co.xy, vec2(a, b));
highp float sn = mod(dt, 3.14);
return fract(sin(sn) * c);
}
vec4 circleBlur(sampler2D image, vec2 vuv, vec2 res) {
vec2 uv = vuv;
vec2 PixelOffset = 1.25 / res.xy; //1.0
float Start = 2.0 / 14.0;
vec2 Scale = 0.66 * 4.0 * 2.0 * PixelOffset.xy;
vec3 N0 = texture(image, uv + Circle(Start, 14.0, 0.0) * Scale).rgb;
vec3 N1 = texture(image, uv + Circle(Start, 14.0, 1.0) * Scale).rgb;
vec3 N2 = texture(image, uv + Circle(Start, 14.0, 2.0) * Scale).rgb;
vec3 N3 = texture(image, uv + Circle(Start, 14.0, 3.0) * Scale).rgb;
vec3 N4 = texture(image, uv + Circle(Start, 14.0, 4.0) * Scale).rgb;
vec3 N5 = texture(image, uv + Circle(Start, 14.0, 5.0) * Scale).rgb;
vec3 N6 = texture(image, uv + Circle(Start, 14.0, 6.0) * Scale).rgb;
vec3 N7 = texture(image, uv + Circle(Start, 14.0, 7.0) * Scale).rgb;
vec3 N8 = texture(image, uv + Circle(Start, 14.0, 8.0) * Scale).rgb;
vec3 N9 = texture(image, uv + Circle(Start, 14.0, 9.0) * Scale).rgb;
vec3 N10 = texture(image, uv + Circle(Start, 14.0, 10.0) * Scale).rgb;
vec3 N11 = texture(image, uv + Circle(Start, 14.0, 11.0) * Scale).rgb;
vec3 N12 = texture(image, uv + Circle(Start, 14.0, 12.0) * Scale).rgb;
vec3 N13 = texture(image, uv + Circle(Start, 14.0, 13.0) * Scale).rgb;
vec3 N14 = texture(image, uv).rgb;
vec3 color = vec3(0, 0, 0);
color.rgb =
(N0 * 0.01478636) +
(N1 * 0.03696590) +
(N2 * 0.07393179) +
(N3 * 0.07393179) +
(N4 * 0.12013917) +
(N5 * 0.16018555) +
(N6 * 0.17620411) +
(N7 * 0.17620411) +
(N8 * 0.16018555) +
(N9 * 0.12013917) +
(N10 * 0.07393179) +
(N11 * 0.07393179) +
(N12 * 0.03696590) +
(N13 * 0.03696590) +
(N14 * 0.01478636);
return vec4(color.rgb, 1.0);
}
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));
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){ return min(a*b,min(abs(a)*3.40282347E+38F,abs(b)*3.40282347E+38F)); }
float mul_nonIEEE(float a, float b) { return min(a*b, min(abs(a)*3.40282347E+38F, abs(b)*3.40282347E+38F)); }
void main()
{
vec4 R0f = vec4(0.0);
vec4 R1f = vec4(0.0);
vec4 R2f = vec4(0.0);
vec4 R3f = vec4(0.0);
vec4 R4f = vec4(0.0);
vec4 R5f = vec4(0.0);
vec4 R6f = vec4(0.0);
vec4 R7f = vec4(0.0);
vec4 R8f = vec4(0.0);
vec4 R123f = vec4(0.0);
vec4 R127f = vec4(0.0);
float backupReg0f, backupReg1f, backupReg2f, backupReg3f, backupReg4f;
vec4 PV0f = vec4(0.0), PV1f = vec4(0.0);
float PS0f = 0.0, PS1f = 0.0;
vec4 tempf = vec4(0.0);
float tempResultf;
int tempResulti;
ivec4 ARi = ivec4(0);
bool predResult = true;
vec3 cubeMapSTM;
int cubeMapFaceId;
R0f = passParameterSem0;
R1f = passParameterSem1;
// 0
R2f.x = R1f.x + (intBitsToFloat(uf_remappedPS[0].x)/ resScale);
R2f.y = R1f.y + (intBitsToFloat(uf_remappedPS[0].y)/ resScale);
R0f.z = R1f.x + (intBitsToFloat(uf_remappedPS[0].z)/ resScale);
R0f.w = R1f.y + (intBitsToFloat(uf_remappedPS[0].w)/ resScale);
// 1
vec4 R0f = vec4(0.0);
vec4 R1f = vec4(0.0);
vec4 R2f = vec4(0.0);
vec4 R3f = vec4(0.0);
vec4 R4f = vec4(0.0);
vec4 R5f = vec4(0.0);
vec4 R6f = vec4(0.0);
vec4 R7f = vec4(0.0);
vec4 R8f = vec4(0.0);
vec4 R123f = vec4(0.0);
vec4 R127f = vec4(0.0);
float backupReg0f, backupReg1f, backupReg2f, backupReg3f, backupReg4f;
vec4 PV0f = vec4(0.0), PV1f = vec4(0.0);
float PS0f = 0.0, PS1f = 0.0;
vec4 tempf = vec4(0.0);
float tempResultf;
int tempResulti;
ivec4 ARi = ivec4(0);
bool predResult = true;
vec3 cubeMapSTM;
int cubeMapFaceId;
R0f = passParameterSem0;
R1f = passParameterSem1;
// 0er
R2f.x = R1f.x + (intBitsToFloat(uf_remappedPS[0].x) / resScale);
R2f.y = R1f.y + (intBitsToFloat(uf_remappedPS[0].y) / resScale);
R0f.z = R1f.x + (intBitsToFloat(uf_remappedPS[0].z) );
R0f.w = R1f.y + (intBitsToFloat(uf_remappedPS[0].w) );
// 1
backupReg0f = R1f.x;
backupReg1f = R1f.y;
backupReg0f = R1f.x;
backupReg1f = R1f.y;
R1f.xyz = vec3(backupReg0f,backupReg1f,backupReg0f) + vec3(intBitsToFloat(uf_remappedPS[1].x)/ resScale,intBitsToFloat(uf_remappedPS[1].y)/ resScale,intBitsToFloat(uf_remappedPS[1].z)/ resScale);
R1f.w = backupReg1f + intBitsToFloat(uf_remappedPS[1].w)/ resScale;
R1f.xyz = vec3(backupReg0f,backupReg1f,backupReg0f) + vec3(intBitsToFloat(uf_remappedPS[1].x) / resScale,intBitsToFloat(uf_remappedPS[1].y) / resScale,intBitsToFloat(uf_remappedPS[1].z));
R1f.w = backupReg1f + intBitsToFloat(uf_remappedPS[1].w) ;
R3f.xyz = (texture(textureUnitPS1, R2f.xy).xyz);
R4f.xyz = (texture(textureUnitPS1, R0f.zw).xyz);
R5f.xyz = (texture(textureUnitPS1, R1f.xy).xyz);
R6f.xyz = (texture(textureUnitPS1, R1f.zw).xyz);
vec2 texsizetest = vec2(1280.0, 720.0);
//R4f = blur9(textureUnitPS0, R1f.xy, texsizetest, vec2(1.0, 1.0));
//R3f = blur9(textureUnitPS0, R0f.zw, texsizetest, vec2(1.0, 1.0));
//R3f.xyz = (texture(textureUnitPS1, R2f.xy).xyz);
R3f = (blur9(textureUnitPS1, R2f.xy, texsizetest, vec2(1.0, 1.0))); // remove, redundant, blur on next step
R4f = (blur9(textureUnitPS1, R0f.zw, texsizetest, vec2(1.0, 1.0)));
R5f = (blur9(textureUnitPS1, R1f.xy, texsizetest, vec2(1.0, 1.0)));
R6f = (blur9(textureUnitPS1, R1f.zw, texsizetest, vec2(1.0, 1.0)));
R2f.xyz = (texture(textureUnitPS0, R2f.xy).xyz);
R7f.xyz = (texture(textureUnitPS0, R0f.zw).xyz);
R8f.xyz = (texture(textureUnitPS0, R1f.xy).xyz);
R1f.xyz = (texture(textureUnitPS0, R1f.zw).xyz);
//R6f = circleBlur(textureUnitPS0, R1f.xy, textureSize(textureUnitPS0, 0));
R2f.xyz = (circleBlur(textureUnitPS0, R2f.xy, textureSize(textureUnitPS0, 0)).xyz);
R7f.xyz = (circleBlur(textureUnitPS0, R0f.zw, textureSize(textureUnitPS0, 0)).xyz);
R8f.xyz = (circleBlur(textureUnitPS0, R1f.xy, textureSize(textureUnitPS0, 0)).xyz);
R1f.xyz = (circleBlur(textureUnitPS0, R1f.zw, textureSize(textureUnitPS0, 0)).xyz);
// 0
tempf.x = dot(vec4(R3f.x,R3f.y,R3f.z,-0.0),vec4(intBitsToFloat(0x3e000000),intBitsToFloat(0x41ff0000),intBitsToFloat(0x45fe0100),0.0));
PV0f.x = tempf.x;

View File

@ -11,39 +11,27 @@ $scaleFactorY = always_decimal_format($fullHeight / 720.0);
// shader 8c1e55fd967b0496
// ver/horz alignment tweak, just a magic value
// To-do. Go back and re-center all passes instead.
const float resScale = <?=$scaleFactorX?>;
//const float resScale = 3.0; //
//const float resScale = 4.0;
const float repositionBloom = 1.00125;
uniform ivec4 uf_remappedPS[5];
layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf4e76000 res 320x180x1 dim 1 tm: 4 format 0816 compSel: 0 1 2 5 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler0 ClampX/Y/Z: 6 6 6 border: 0
layout(location = 0) in vec4 passParameterSem0;
layout(location = 0) out vec4 passPixelColor0;
uniform vec2 uf_fragCoordScale;
const float repositionBloom = 1.00125;
//mattdesl MIT - https://github.com/Jam3/glsl-fast-gaussian-blur
vec4 blur9(sampler2D image, vec2 uv, vec2 resolution, vec2 direction) {
vec4 color = vec4(0.0);
vec2 off1 = vec2(1.3846153846) * direction;
vec2 off2 = vec2(3.2307692308) * direction;
color += texture2D(image, uv) * 0.2270270270;
color += texture2D(image, uv + (off1 / resolution)) * 0.3162162162;
color += texture2D(image, uv - (off1 / resolution)) * 0.3162162162;
color += texture2D(image, uv + (off2 / resolution)) * 0.0702702703;
color += texture2D(image, uv - (off2 / resolution)) * 0.0702702703;
return color;
}
int clampFI32(int v)
{
if( v == 0x7FFFFFFF )
return floatBitsToInt(1.0);
else if( v == 0xFFFFFFFF )
return floatBitsToInt(0.0);
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){ return min(a*b,min(abs(a)*3.40282347E+38F,abs(b)*3.40282347E+38F)); }
float mul_nonIEEE(float a, float b) { return min(a*b, min(abs(a)*3.40282347E+38F, abs(b)*3.40282347E+38F)); }
void main()
{
vec4 R0f = vec4(0.0);
@ -68,13 +56,13 @@ void main()
R0f = passParameterSem0;
vec2 scaleFactor = vec2(repositionBloom, repositionBloom); //Added
R0f.xy = R0f.xy * scaleFactor;// re-align bloom.. hack until issue source is found.
// 0
// 0
R1f.x = R0f.x + (intBitsToFloat(uf_remappedPS[0].x) / resScale);
R1f.y = R0f.y + (intBitsToFloat(uf_remappedPS[0].y) / resScale);
R0f.z = R0f.x + (intBitsToFloat(uf_remappedPS[1].x) / resScale);
R0f.w = R0f.y + (intBitsToFloat(uf_remappedPS[1].y) / resScale);
R5f.w = 1.0 ;
R5f.w = 1.0;
PS0f = R5f.w;
// 1
R2f.x = R0f.x + (intBitsToFloat(uf_remappedPS[2].x) / resScale);
@ -87,21 +75,13 @@ void main()
R0f.x = backupReg0f + (intBitsToFloat(uf_remappedPS[4].x) / resScale);
R0f.y = backupReg1f + (intBitsToFloat(uf_remappedPS[4].y) / resScale);
//hack aproximate 720 blur
//vec2 texsizetest = vec2(2560.0,1440.0 );
R4f = blur9(textureUnitPS0, R1f.xy, textureSize(textureUnitPS0, 0), vec2(1.0, 1.0));
R3f = blur9(textureUnitPS0, R0f.zw, textureSize(textureUnitPS0, 0), vec2(1.0, 1.0));
R2f = blur9(textureUnitPS0, R2f.xy, textureSize(textureUnitPS0, 0), vec2(1.0, 1.0));
R1f = blur9(textureUnitPS0, R1f.zw, textureSize(textureUnitPS0, 0), vec2(1.0, 1.0));
R0f = blur9(textureUnitPS0, R0f.xy, textureSize(textureUnitPS0, 0), vec2(1.0, 1.0));
/*
R4f.xyz = (texture(textureUnitPS0, R1f.xy).xyz);
R3f.xyz = (texture(textureUnitPS0, R0f.zw).xyz);
R2f.xyz = (texture(textureUnitPS0, R2f.xy).xyz);
R1f.xyz = (texture(textureUnitPS0, R1f.zw).xyz);
R0f.xyz = (texture(textureUnitPS0, R0f.xy).xyz);
*/
// 0
PV0f.x = R4f.y * intBitsToFloat(uf_remappedPS[0].z);
PV0f.y = R4f.x * intBitsToFloat(uf_remappedPS[0].z);
@ -110,7 +90,7 @@ R0f = blur9(textureUnitPS0, R0f.xy, textureSize(textureUnitPS0, 0), vec2(1.0, 1.
R127f.z = max(R3f.y, R4f.y);
PS0f = R127f.z;
// 1
R123f.x = (R3f.z * intBitsToFloat(uf_remappedPS[1].z) + PV0f.z);
R123f.x = (R3f.z * intBitsToFloat(uf_remappedPS[1].z) + PV0f.z);
PV1f.x = R123f.x;
PV1f.y = max(R3f.z, R4f.z);
R123f.z = (R3f.y * intBitsToFloat(uf_remappedPS[1].z) + PV0f.x);
@ -157,11 +137,11 @@ R0f = blur9(textureUnitPS0, R0f.xy, textureSize(textureUnitPS0, 0), vec2(1.0, 1.
PV1f.w = R127f.w;
// 6
PV0f.x = PV1f.z + -(PV1f.w);
R5f.y = (PV1f.y * 0.25 + R127f.x);//degree of bloom
R5f.x = (PV1f.x * 0.25 + R127f.z);
R5f.y = (PV1f.y * 0.30 + R127f.x);//degree of bloom
R5f.x = (PV1f.x * 0.30 + R127f.z);
PS0f = R5f.x;
// 7
R5f.z = (PV0f.x * 0.25 + R127f.w);
R5f.z = (PV0f.x * 0.30 + R127f.w);
// export
passPixelColor0 = vec4(R5f.x, R5f.y, R5f.z, R5f.w);
}

View File

@ -5,33 +5,167 @@ $fullHeight = $argv[2];
$scaleFactorX = always_decimal_format($fullWidth / 1280.0);
$scaleFactorY = always_decimal_format($fullHeight / 720.0);
?>
#version 420
#extension GL_ARB_texture_gather : enable
// shader d8e69e8df8c227f5
// Inital blur step pixelation fix, naive blur9 hack to aproximate 720 blur.
// To-do review performance hit of multi pass and depth for bokeh blur
const float resScale = <?=$scaleFactorX?>;
//const float resScale = 3.0; //
// Bloom/blur 1st step, 1280->640->1280
// To do, go back and remove all test blurs..
uniform ivec4 uf_remappedPS[3];
layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf470a000 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: 0
layout(binding = 1) uniform sampler2D textureUnitPS1;// Tex1 addr 0xf4386000 res 1280x720x1 dim 1 tm: 4 format 001a compSel: 0 1 2 3 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler1 ClampX/Y/Z: 2 2 2 border: 0
layout(location = 0) in vec4 passParameterSem0;
layout(location = 0) out vec4 passPixelColor0;
uniform vec2 uf_fragCoordScale;
const float repositionBlur = 1.00425;
//mattdesl MIT - https://github.com/Jam3/glsl-fast-gaussian-blur
vec4 blur9(sampler2D image, vec2 uv, vec2 resolution, vec2 direction) {
const float resScale = <?=$scaleFactorX?>;
//const float resScale = 3.5; //3.5 looks nicer
highp float lineRand(vec2 co)
{
highp float a = 12.9898;
highp float b = 78.233;
highp float c = 43758.5453;
highp float dt = dot(co.xy, vec2(a, b));
highp float sn = mod(dt, 3.14);
return fract(sin(sn) * c);
}
vec4 blur21Vert(sampler2D image, vec2 vuv, vec2 res) {
// Note, must use gl_FragCord not emulated coordinates to sample between textels
// Two pass implementation
//iq CC , http://rastergrid.com/blog/2010/09/efficient-gaussian-blur-with-linear-sampling/
vec3 blr = vec3(0.0);
blr += 0.026109*texture(image, (vuv + vec2(0.0, -15.5)) / res.xy).xyz;
blr += 0.034202*texture(image, (vuv + vec2(0.0, -13.5)) / res.xy).xyz;
blr += 0.043219*texture(image, (vuv + vec2(0.0, -11.5)) / res.xy).xyz;
blr += 0.052683*texture(image, (vuv + vec2(0.0, -9.5)) / res.xy).xyz;
blr += 0.061948*texture(image, (vuv + vec2(0.0, -7.5)) / res.xy).xyz;
blr += 0.070266*texture(image, (vuv + vec2(0.0, -5.5)) / res.xy).xyz;
blr += 0.076883*texture(image, (vuv + vec2(0.0, -3.5)) / res.xy).xyz;
blr += 0.081149*texture(image, (vuv + vec2(0.0, -1.5)) / res.xy).xyz;
blr += 0.041312*texture(image, (vuv + vec2(0.0, 0.0)) / res.xy).xyz;
blr += 0.081149*texture(image, (vuv + vec2(0.0, 1.5)) / res.xy).xyz;
blr += 0.076883*texture(image, (vuv + vec2(0.0, 3.5)) / res.xy).xyz;
blr += 0.070266*texture(image, (vuv + vec2(0.0, 5.5)) / res.xy).xyz;
blr += 0.061948*texture(image, (vuv + vec2(0.0, 7.5)) / res.xy).xyz;
blr += 0.052683*texture(image, (vuv + vec2(0.0, 9.5)) / res.xy).xyz;
blr += 0.043219*texture(image, (vuv + vec2(0.0, 11.5)) / res.xy).xyz;
blr += 0.034202*texture(image, (vuv + vec2(0.0, 13.5)) / res.xy).xyz;
blr += 0.026109*texture(image, (vuv + vec2(0.0, 15.5)) / res.xy).xyz;
blr /= 0.93423; // renormalize to compensate for the 4 taps I skipped
return vec4(blr, 1.0);
}
vec4 blur21Horiz(sampler2D image, vec2 vuv, vec2 res) {
//iq CC
vec3 blr = vec3(0.0);
blr += 0.026109*texture(image, (vuv + vec2(-15.5, 0.0)) / res.xy).xyz;
blr += 0.034202*texture(image, (vuv + vec2(-13.5, 0.0)) / res.xy).xyz;
blr += 0.043219*texture(image, (vuv + vec2(-11.5, 0.0)) / res.xy).xyz;
blr += 0.052683*texture(image, (vuv + vec2(-9.5, 0.0)) / res.xy).xyz;
blr += 0.061948*texture(image, (vuv + vec2(-7.5, 0.0)) / res.xy).xyz;
blr += 0.070266*texture(image, (vuv + vec2(-5.5, 0.0)) / res.xy).xyz;
blr += 0.076883*texture(image, (vuv + vec2(-3.5, 0.0)) / res.xy).xyz;
blr += 0.081149*texture(image, (vuv + vec2(-1.5, 0.0)) / res.xy).xyz;
blr += 0.041312*texture(image, (vuv + vec2(0.0, 0.0)) / res.xy).xyz;
blr += 0.081149*texture(image, (vuv + vec2(1.5, 0.0)) / res.xy).xyz;
blr += 0.076883*texture(image, (vuv + vec2(3.5, 0.0)) / res.xy).xyz;
blr += 0.070266*texture(image, (vuv + vec2(5.5, 0.0)) / res.xy).xyz;
blr += 0.061948*texture(image, (vuv + vec2(7.5, 0.0)) / res.xy).xyz;
blr += 0.052683*texture(image, (vuv + vec2(9.5, 0.0)) / res.xy).xyz;
blr += 0.043219*texture(image, (vuv + vec2(11.5, 0.0)) / res.xy).xyz;
blr += 0.034202*texture(image, (vuv + vec2(13.5, 0.0)) / res.xy).xyz;
blr += 0.026109*texture(image, (vuv + vec2(15.5, 0.0)) / res.xy).xyz;
blr /= 0.93423; // renormalize to compensate for the 4 taps I skipped
return vec4(blr, 1.0);
}
vec2 Circle(float Start, float Points, float Point)
{
float Rad = (3.141592 * 2.0 * (1.0 / Points)) * (Point + Start);
return vec2(sin(Rad), cos(Rad));
}
vec4 circleBlur(sampler2D image, vec2 vuv, vec2 res){
//original by jcant0n ?
//vec2 uv = gl_FragCoord.xy / res.xy;
vec2 uv = vuv;
vec2 PixelOffset = 1.9 / res.xy; //1.0
float Start = 2.0 / 14.0;
vec2 Scale = 0.66 * 4.0 * 2.0 * PixelOffset.xy;
vec3 N0 = texture(image, uv + Circle(Start, 14.0, 0.0) * Scale).rgb;
vec3 N1 = texture(image, uv + Circle(Start, 14.0, 1.0) * Scale).rgb;
vec3 N2 = texture(image, uv + Circle(Start, 14.0, 2.0) * Scale).rgb;
vec3 N3 = texture(image, uv + Circle(Start, 14.0, 3.0) * Scale).rgb;
vec3 N4 = texture(image, uv + Circle(Start, 14.0, 4.0) * Scale).rgb;
vec3 N5 = texture(image, uv + Circle(Start, 14.0, 5.0) * Scale).rgb;
vec3 N6 = texture(image, uv + Circle(Start, 14.0, 6.0) * Scale).rgb;
vec3 N7 = texture(image, uv + Circle(Start, 14.0, 7.0) * Scale).rgb;
vec3 N8 = texture(image, uv + Circle(Start, 14.0, 8.0) * Scale).rgb;
vec3 N9 = texture(image, uv + Circle(Start, 14.0, 9.0) * Scale).rgb;
vec3 N10 = texture(image, uv + Circle(Start, 14.0, 10.0) * Scale).rgb;
vec3 N11 = texture(image, uv + Circle(Start, 14.0, 11.0) * Scale).rgb;
vec3 N12 = texture(image, uv + Circle(Start, 14.0, 12.0) * Scale).rgb;
vec3 N13 = texture(image, uv + Circle(Start, 14.0, 13.0) * Scale).rgb;
vec3 N14 = texture(image, uv).rgb;
vec3 color = vec3(0, 0, 0);
color.rgb =
(N0 * 0.01478636) +
(N1 * 0.03696590) +
(N2 * 0.07393179) +
(N3 * 0.07393179) +
(N4 * 0.12013917) +
(N5 * 0.16018555) +
(N6 * 0.17620411) +
(N7 * 0.17620411) +
(N8 * 0.16018555) +
(N9 * 0.12013917) +
(N10 * 0.07393179) +
(N11 * 0.07393179) +
(N12 * 0.03696590) +
(N13 * 0.03696590) +
(N14 * 0.01478636);
return vec4(color.rgb, 1.0);
}
vec4 blur25(sampler2D image, vec2 uv, vec2 resolution, vec2 direction) {
//curent implentation doesn't work in cemu..
//mattdesl MIT - https://github.com/Jam3/glsl-fast-gaussian-blur
vec4 color = vec4(0.0);
vec2 off1 = vec2(1.3846153846) * direction;
vec2 off2 = vec2(3.2307692308) * direction;
color += texture2D(image, uv) * 0.2270270270;
color += texture2D(image, uv + (off1 / resolution)) * 0.3162162162;
color += texture2D(image, uv - (off1 / resolution)) * 0.3162162162;
color += texture2D(image, uv + (off2 / resolution)) * 0.0702702703;
color += texture2D(image, uv - (off2 / resolution)) * 0.0702702703;
return color;
vec2 off1 = vec2(1.44827586) * direction;
vec2 off2 = vec2(3.37931034) * direction;
vec2 off3 = vec2(5.31034483) * direction;
vec2 off4 = vec2(7.24137931) * direction;
vec2 off5 = vec2(9.17241379) * direction;
vec2 off6 = vec2(11.10344828) * direction;
//color += texture2D(image, uv - (off6 / resolution)) * 0.00001361;
color += texture2D(image, uv - (off5 / resolution)) * 0.00044240;
color += texture2D(image, uv - (off4 / resolution)) * 0.00581436;
color += texture2D(image, uv - (off3 / resolution)) * 0.03730881;
color += texture2D(image, uv - (off2 / resolution)) * 0.12888498;
color += texture2D(image, uv - (off1 / resolution)) * 0.25281284;
color += texture2D(image, uv) * 0.14944601;
color += texture2D(image, uv + (off1 / resolution)) * 0.25281284;
color += texture2D(image, uv + (off2 / resolution)) * 0.12888498;
color += texture2D(image, uv + (off3 / resolution)) * 0.03730881;
color += texture2D(image, uv + (off4 / resolution)) * 0.00581436;
color += texture2D(image, uv + (off5 / resolution)) * 0.00044240;
//color += texture2D(image, uv + (off6 / resolution)) * 0.00001361;
///= 0.93423
return color /= 0.93423;
}
int clampFI32(int v)
@ -66,25 +200,22 @@ bool predResult = true;
vec3 cubeMapSTM;
int cubeMapFaceId;
R0f = passParameterSem0;
vec2 scaleFactor = vec2(repositionBlur, repositionBlur); //Added
R0f.xy = R0f.xy * scaleFactor;// re-align bloom.. hack until issue source is found.
R0f.xy = vec2((passParameterSem0.x + passParameterSem0.z) , (passParameterSem0.y + passParameterSem0.w) ); //center point
// 0
R1f.x = R0f.x + (intBitsToFloat(uf_remappedPS[0].x)/ resScale);
R1f.y = R0f.y + (intBitsToFloat(uf_remappedPS[0].y)/ resScale);
R0f.z = R0f.x + (intBitsToFloat(uf_remappedPS[0].z)/ resScale);
R0f.w = R0f.y + (intBitsToFloat(uf_remappedPS[0].w)/ resScale);
R1f.x = R0f.x + intBitsToFloat(uf_remappedPS[0].x)/resScale;
R1f.y = R0f.y + intBitsToFloat(uf_remappedPS[0].y)/resScale;
R0f.z = R0f.x + intBitsToFloat(uf_remappedPS[0].z)/resScale;
R0f.w = R0f.y + intBitsToFloat(uf_remappedPS[0].w)/resScale;
// 1
backupReg0f = R0f.x;
backupReg1f = R0f.y;
backupReg0f = R0f.x;
backupReg1f = R0f.y;
R0f.x = backupReg0f + (intBitsToFloat(uf_remappedPS[1].x)/ resScale);
R0f.y = backupReg1f + (intBitsToFloat(uf_remappedPS[1].y)/ resScale);
R1f.z = backupReg0f + (intBitsToFloat(uf_remappedPS[1].z)/ resScale);
R1f.w = backupReg1f + (intBitsToFloat(uf_remappedPS[1].w)/ resScale);
R0f.x = backupReg0f + intBitsToFloat(uf_remappedPS[1].x)/resScale;
R0f.y = backupReg1f + intBitsToFloat(uf_remappedPS[1].y)/resScale;
R1f.z = backupReg0f + intBitsToFloat(uf_remappedPS[1].z)/resScale;
R1f.w = backupReg1f + intBitsToFloat(uf_remappedPS[1].w)/resScale;
R2f.xyz = (texture(textureUnitPS1, R1f.xy).xyz);
@ -92,20 +223,22 @@ R3f.xyz = (texture(textureUnitPS1, R0f.zw).xyz);
R4f.xyz = (texture(textureUnitPS1, R0f.xy).xyz);
R5f.xyz = (texture(textureUnitPS1, R1f.zw).xyz);
//hack aproximate 720 blur
R6f = blur9(textureUnitPS0, R1f.xy, textureSize(textureUnitPS0, 0), vec2(0.0, 1.0)); // note, check what goes wrong with textureSize(textureUnitPS0, 0),
R7f = blur9(textureUnitPS0, R0f.zw, textureSize(textureUnitPS0, 0), vec2(1.0, 0.0));
R0f = blur9(textureUnitPS0, R0f.xy, textureSize(textureUnitPS0, 0), vec2(0.0, 1.0));
R1f = blur9(textureUnitPS0, R1f.zw, textureSize(textureUnitPS0, 0), vec2(1.0, 0.0));
//vec2 iResolution = textureSize(textureUnitPS0, 0);
R6f = circleBlur(textureUnitPS0, R1f.xy, textureSize(textureUnitPS0, 0));
R7f = circleBlur(textureUnitPS0, R0f.zw, textureSize(textureUnitPS0, 0));
R0f = circleBlur(textureUnitPS0, R0f.xy, textureSize(textureUnitPS0, 0));
R1f = circleBlur(textureUnitPS0, R1f.zw, textureSize(textureUnitPS0, 0));
// Sample distance fails :(
//R6f = mix(blur25(textureUnitPS0, R1f.xy, vec2(2560, 1440), vec2(0.0, 1.0)), blur13(textureUnitPS0, R1f.xy, textureSize(textureUnitPS0, 0), vec2(1.0,0.0)), 0.5);
//R7f = mix(blur25(textureUnitPS0, R0f.zw, textureSize(textureUnitPS0, 0), vec2(2.0, -3.0)), blur13(textureUnitPS0, R0f.zw, textureSize(textureUnitPS0, 0), vec2(4.0, 6.0)), 0.5);
//R0f = mix(blur25(textureUnitPS0, R0f.xy, textureSize(textureUnitPS0, 0), vec2(4.0, -6.0)), blur13(textureUnitPS0, R0f.xy, textureSize(textureUnitPS0, 0), vec2(2.0, 3.0)), 0.5);
//R1f = mix(blur25(textureUnitPS0, R1f.zw, textureSize(textureUnitPS0, 0), vec2(8.0, -9.0)), blur13(textureUnitPS0, R1f.zw, textureSize(textureUnitPS0, 0), vec2(1.1, 1.5)), 0.5);
/*
R6f.xyz = (texture(textureUnitPS0, R1f.xy).xyz);
R7f.xyz = (texture(textureUnitPS0, R0f.zw).xyz);
R0f.xyz = (texture(textureUnitPS0, R0f.xy).xyz);
R1f.xyz = (texture(textureUnitPS0, R1f.zw).xyz);
*/
// 0// 0.125, 31.875, 8128.125
tempf.x = dot(vec4(R2f.x,R2f.y,R2f.z,-0.0),vec4(intBitsToFloat(0x3e000000),intBitsToFloat(0x41ff0000),intBitsToFloat(0x45fe0100),0.0));
PV0f.x = tempf.x;
PV0f.y = tempf.x;
@ -175,8 +308,6 @@ PS1f = R1f.x;
PS0f = exp2(PV1f.x);
// 11
R1f.w = PS0f * intBitsToFloat(uf_remappedPS[2].z);
//R1f = blur9(textureUnitPS0, R1f.xy, vec2(2560.0, 1440.0), vec2(1.0, 0.0));
// export
passPixelColor0 = vec4(R1f.x, R1f.y, R1f.z, R1f.w);
}

View File

@ -31,6 +31,12 @@ tileModesExcluded = 0x001
overwriteWidth = <?=round($scaleFactorX*1280)?>
overwriteHeight = <?=round($scaleFactorY*720)?>
[TextureRedefine] # Do not remove, must be scaled to TV or probe view breaks
width = 854
height = 480
overwriteWidth = <?=round($scaleFactorX*854)?>
overwriteHeight = <?=round($scaleFactorY*480)?>
[TextureRedefine] # half-res alpha
width = 640
height = 360