From 4bd4fc40d4aa3a22063f0e765f24f9ea55f189fe Mon Sep 17 00:00:00 2001 From: getdls Date: Thu, 28 Dec 2017 11:44:30 +0100 Subject: [PATCH] [XCX] light bleed scaling, blending of light sources --- .../430ac3a85ece61af_0000000000000079_ps.txt | 12 +- .../8b8ade20f1ae78e7_0000000000000079_ps.txt | 147 ++++++++++++++++++ 2 files changed, 158 insertions(+), 1 deletion(-) create mode 100644 Source/XenobladeX/8b8ade20f1ae78e7_0000000000000079_ps.txt diff --git a/Source/XenobladeX/430ac3a85ece61af_0000000000000079_ps.txt b/Source/XenobladeX/430ac3a85ece61af_0000000000000079_ps.txt index 6540f2f4..c47af4d2 100644 --- a/Source/XenobladeX/430ac3a85ece61af_0000000000000079_ps.txt +++ b/Source/XenobladeX/430ac3a85ece61af_0000000000000079_ps.txt @@ -5,11 +5,20 @@ $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 430ac3a85ece61af // bloom sampling scale const float resScale = ; +highp float lineRand(vec2 co) //to reduce banding +{ + 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); +} + //const float resScale = 4.0; uniform ivec4 uf_remappedPS[2]; layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf4e12000 res 256x144x1 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 @@ -51,6 +60,7 @@ bool predResult = true; vec3 cubeMapSTM; int cubeMapFaceId; R0f = passParameterSem0; +R0f.xy = R0f.xy + (lineRand(gl_FragCoord.xy)*0.005); // 0 backupReg0f = R0f.y; backupReg1f = R0f.x; diff --git a/Source/XenobladeX/8b8ade20f1ae78e7_0000000000000079_ps.txt b/Source/XenobladeX/8b8ade20f1ae78e7_0000000000000079_ps.txt new file mode 100644 index 00000000..97c6e3f3 --- /dev/null +++ b/Source/XenobladeX/8b8ade20f1ae78e7_0000000000000079_ps.txt @@ -0,0 +1,147 @@ + +#version 420 +#extension GL_ARB_texture_gather : enable +// shader 8b8ade20f1ae78e7 +//light bleed, waterfall fog +uniform ivec4 uf_remappedPS[5]; +const float resScale = ; +layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf5196000 res 320x180x1 dim 1 tm: 4 format 001a compSel: 0 1 2 3 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler0 ClampX/Y/Z: 2 2 2 border: 0 +layout(location = 0) in vec4 passParameterSem0; +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){ 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 R123f = vec4(0.0); +vec4 R124f = vec4(0.0); +vec4 R125f = vec4(0.0); +vec4 R126f = 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; +// 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; +// 1 +R2f.x = R0f.x + intBitsToFloat(uf_remappedPS[2].x)/ resScale; +R2f.y = R0f.y + intBitsToFloat(uf_remappedPS[2].y)/ resScale; +R1f.z = R0f.x + intBitsToFloat(uf_remappedPS[3].x)/ resScale; +R1f.w = R0f.y + intBitsToFloat(uf_remappedPS[3].y)/ resScale; +// 2 +backupReg0f = R0f.x; +backupReg1f = R0f.y; +R0f.x = backupReg0f + intBitsToFloat(uf_remappedPS[4].x)/ resScale; +R0f.y = backupReg1f + intBitsToFloat(uf_remappedPS[4].y)/ resScale; +R4f.xyzw = (texture(textureUnitPS0, R1f.xy).xyzw); +R3f.xyzw = (texture(textureUnitPS0, R0f.zw).xyzw); +R2f.xyzw = (texture(textureUnitPS0, R2f.xy).xyzw); +R1f.xyzw = (texture(textureUnitPS0, R1f.zw).xyzw); +R0f.xyzw = (texture(textureUnitPS0, R0f.xy).xyzw); +// 0 +PV0f.x = R4f.w * intBitsToFloat(uf_remappedPS[0].z); +PV0f.y = R4f.z * intBitsToFloat(uf_remappedPS[0].z); +PV0f.z = R4f.y * intBitsToFloat(uf_remappedPS[0].z); +PV0f.w = R4f.x * intBitsToFloat(uf_remappedPS[0].z); +R127f.w = max(R3f.x, R4f.x); +PS0f = R127f.w; +// 1 +R123f.x = (R3f.z * intBitsToFloat(uf_remappedPS[1].z) + PV0f.y); +PV1f.x = R123f.x; +R127f.y = (R3f.w * intBitsToFloat(uf_remappedPS[1].z) + PV0f.x); +R123f.z = (R3f.y * intBitsToFloat(uf_remappedPS[1].z) + PV0f.z); +PV1f.z = R123f.z; +R123f.w = (R3f.x * intBitsToFloat(uf_remappedPS[1].z) + PV0f.w); +PV1f.w = R123f.w; +R127f.z = max(R3f.y, R4f.y); +PS1f = R127f.z; +// 2 +PV0f.x = max(R3f.w, R4f.w); +PV0f.y = max(R3f.z, R4f.z); +R126f.z = (R2f.x * intBitsToFloat(uf_remappedPS[2].z) + PV1f.w); +R126f.w = (R2f.y * intBitsToFloat(uf_remappedPS[2].z) + PV1f.z); +R125f.w = (R2f.z * intBitsToFloat(uf_remappedPS[2].z) + PV1f.x); +PS0f = R125f.w; +// 3 +backupReg0f = R127f.y; +R127f.x = max(R127f.z, R2f.y); +R127f.y = max(R127f.w, R2f.x); +R123f.z = (R2f.w * intBitsToFloat(uf_remappedPS[2].z) + backupReg0f); +PV1f.z = R123f.z; +R127f.w = max(PV0f.y, R2f.z); +R127f.z = max(PV0f.x, R2f.w); +PS1f = R127f.z; +// 4 +backupReg0f = R0f.x; +R126f.x = (R1f.y * intBitsToFloat(uf_remappedPS[3].z) + R126f.w); +R123f.y = (R1f.x * intBitsToFloat(uf_remappedPS[3].z) + R126f.z); +PV0f.y = R123f.y; +R126f.z = (R1f.w * intBitsToFloat(uf_remappedPS[3].z) + PV1f.z); +R126f.w = (R1f.z * intBitsToFloat(uf_remappedPS[3].z) + R125f.w); +PS0f = max(backupReg0f, R1f.x); +// 5 +backupReg0f = R0f.y; +backupReg1f = R0f.x; +PV1f.x = max(R0f.w, R1f.w); +PV1f.y = max(R0f.z, R1f.z); +PV1f.z = max(backupReg0f, R1f.y); +R125f.w = max(R127f.y, PS0f); +R124f.w = (backupReg1f * intBitsToFloat(uf_remappedPS[4].z) + PV0f.y); +PS1f = R124f.w; +// 6 +backupReg0f = R127f.x; +backupReg1f = R0f.y; +backupReg2f = R0f.z; +R127f.x = max(R127f.z, PV1f.x); +PV0f.y = max(R127f.w, PV1f.y); +PV0f.z = max(backupReg0f, PV1f.z); +R127f.w = (backupReg1f * intBitsToFloat(uf_remappedPS[4].z) + R126f.x); +PV0f.w = R127f.w; +R127f.y = (backupReg2f * intBitsToFloat(uf_remappedPS[4].z) + R126f.w); +PS0f = R127f.y; +// 7 +R126f.x = (R0f.w * intBitsToFloat(uf_remappedPS[4].z) + R126f.z); +PV1f.x = R126f.x; +PV1f.y = PV0f.y + -(PS0f); +PV1f.z = PV0f.z + -(PV0f.w); +PV1f.w = R125f.w + -(R124f.w); +// 8 +PV0f.x = R127f.x + -(PV1f.x); +R0f.y = (PV1f.z * 0.25 + R127f.w); +R0f.z = (PV1f.y * 0.25 + R127f.y); +R0f.x = (PV1f.w * 0.25 + R124f.w); +PS0f = R0f.x; +// 9 +R0f.w = (PV0f.x * 0.25 + R126f.x); +// export +passPixelColor0 = vec4(R0f.x, R0f.y, R0f.z, R0f.w); +}