[CXC] Brightness improved, z tweak deprecated

Brightness improved, acne tweak deprecated
[Add] Uses shadowmap to limit overall brightness. Since less of
shadowmap is used during night sequences (too dark) it doesn’t impact as
much as it does during daylight (too bright)
[Remove] Shadow acne fix is no longer needed, scaling of shadows
resolved the worst issues.
This commit is contained in:
getdls 2017-11-17 16:43:20 +01:00
parent 4041d7be41
commit 5039752b45
5 changed files with 8 additions and 134 deletions

View File

@ -1,128 +0,0 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_shading_language_packing : enable
// shader 034f3827969964b2
//shadow acne fix time-of-day station
// to-do Magic value, review other solution.
layout(binding = 1, std140) uniform uniformBlockVS1
{
vec4 uf_blockVS1[1024];
};
layout(binding = 2, std140) uniform uniformBlockVS2
{
vec4 uf_blockVS2[1024];
};
uniform vec2 uf_windowSpaceToClipSpaceTransform;
layout(location = 0) in uvec4 attrDataSem0;
layout(location = 1) in uvec4 attrDataSem1;
out gl_PerVertex
{
vec4 gl_Position;
float gl_PointSize;
};
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()
{
ivec4 R0i = ivec4(0);
ivec4 R1i = ivec4(0);
ivec4 R2i = ivec4(0);
ivec4 R3i = ivec4(0);
ivec4 R4i = ivec4(0);
ivec4 R127i = ivec4(0);
uvec4 attrDecoder;
int backupReg0i, backupReg1i, backupReg2i, backupReg3i, backupReg4i;
ivec4 PV0i = ivec4(0), PV1i = ivec4(0);
int PS0i = 0, PS1i = 0;
ivec4 tempi = ivec4(0);
float tempResultf;
int tempResulti;
ivec4 ARi = ivec4(0);
bool predResult = true;
vec3 cubeMapSTM;
int cubeMapFaceId;
R0i = ivec4(gl_VertexID, 0, 0, gl_InstanceID);
attrDecoder.xyz = attrDataSem0.xyz;
attrDecoder.xyz = (attrDecoder.xyz>>24)|((attrDecoder.xyz>>8)&0xFF00)|((attrDecoder.xyz<<8)&0xFF0000)|((attrDecoder.xyz<<24));
attrDecoder.w = 0;
R2i = ivec4(int(attrDecoder.x), int(attrDecoder.y), int(attrDecoder.z), floatBitsToInt(1.0));
attrDecoder.xy = attrDataSem1.xy;
attrDecoder.xy = ((attrDecoder.xy>>8)&0xFF)|((attrDecoder.xy<<8)&0xFF00);
attrDecoder.z = 0;
attrDecoder.w = 0;
R1i = ivec4(int(attrDecoder.x), int(attrDecoder.y), 0, 1);
// 0
R4i.w = 0x3f800000;
R0i.z = R1i.x * 0x00000003;
PS0i = R0i.z;
// 1
R1i.x = PS0i + 0x00000002;
R0i.y = PS0i + int(1);
R3i.xyzw = floatBitsToInt(uf_blockVS1[R0i.z].xyzw);
R0i.xyzw = floatBitsToInt(uf_blockVS1[R0i.y].xyzw);
R1i.xyzw = floatBitsToInt(uf_blockVS1[R1i.x].xyzw);
// 0
R127i.x = floatBitsToInt(dot(vec4(intBitsToFloat(R2i.x),intBitsToFloat(R2i.y),intBitsToFloat(R2i.z),intBitsToFloat(R2i.w)),vec4(intBitsToFloat(R3i.x),intBitsToFloat(R3i.y),intBitsToFloat(R3i.z),intBitsToFloat(R3i.w))));
PV0i.x = R127i.x;
PV0i.y = R127i.x;
PV0i.z = R127i.x;
PV0i.w = R127i.x;
// 1
backupReg0i = R0i.x;
backupReg1i = R0i.z;
backupReg2i = R0i.w;
tempi.x = floatBitsToInt(dot(vec4(intBitsToFloat(R2i.x),intBitsToFloat(R2i.y),intBitsToFloat(R2i.z),intBitsToFloat(R2i.w)),vec4(intBitsToFloat(backupReg0i),intBitsToFloat(R0i.y),intBitsToFloat(backupReg1i),intBitsToFloat(backupReg2i))));
PV1i.x = tempi.x;
PV1i.y = tempi.x;
PV1i.z = tempi.x;
PV1i.w = tempi.x;
R127i.y = tempi.x;
// 2
tempi.x = floatBitsToInt(dot(vec4(intBitsToFloat(R2i.x),intBitsToFloat(R2i.y),intBitsToFloat(R2i.z),intBitsToFloat(R2i.w)),vec4(intBitsToFloat(R1i.x),intBitsToFloat(R1i.y),intBitsToFloat(R1i.z),intBitsToFloat(R1i.w))));
PV0i.x = tempi.x;
PV0i.y = tempi.x;
PV0i.z = tempi.x;
PV0i.w = tempi.x;
R127i.z = tempi.x;
// 3
R1i.x = floatBitsToInt(dot(vec4(intBitsToFloat(R127i.x),intBitsToFloat(R127i.y),intBitsToFloat(PV0i.x),intBitsToFloat(R4i.w)),vec4(uf_blockVS2[0].x,uf_blockVS2[0].y,uf_blockVS2[0].z,uf_blockVS2[0].w)));
PV1i.x = R1i.x;
PV1i.y = R1i.x;
PV1i.z = R1i.x;
PV1i.w = R1i.x;
// 4
tempi.x = floatBitsToInt(dot(vec4(intBitsToFloat(R127i.x),intBitsToFloat(R127i.y),intBitsToFloat(R127i.z),intBitsToFloat(R4i.w)),vec4(uf_blockVS2[1].x,uf_blockVS2[1].y,uf_blockVS2[1].z,uf_blockVS2[1].w)));
PV0i.x = tempi.x;
PV0i.y = tempi.x;
PV0i.z = tempi.x;
PV0i.w = tempi.x;
R1i.y = tempi.x;
// 5
tempi.x = floatBitsToInt(dot(vec4(intBitsToFloat(R127i.x),intBitsToFloat(R127i.y),intBitsToFloat(R127i.z),intBitsToFloat(R4i.w)),vec4(uf_blockVS2[2].x,uf_blockVS2[2].y,uf_blockVS2[2].z,uf_blockVS2[2].w)));
PV1i.x = tempi.x;
PV1i.y = tempi.x;
PV1i.z = tempi.x;
PV1i.w = tempi.x;
R1i.z = tempi.x;
// 6
tempi.x = floatBitsToInt(dot(vec4(intBitsToFloat(R127i.x),intBitsToFloat(R127i.y),intBitsToFloat(R127i.z),intBitsToFloat(R4i.w)),vec4(uf_blockVS2[3].x,uf_blockVS2[3].y,uf_blockVS2[3].z,uf_blockVS2[3].w)));
PV0i.x = tempi.x;
PV0i.y = tempi.x;
PV0i.z = tempi.x;
PV0i.w = tempi.x;
R1i.w = tempi.x;
// export
gl_Position = vec4(intBitsToFloat(R1i.x), intBitsToFloat(R1i.y), intBitsToFloat(R1i.z)+0.0002, intBitsToFloat(R1i.w)); //shadow bias
// export
// skipped export to semanticId 255
// 0
}

View File

@ -4,8 +4,8 @@
// To-do, .5 is daylight and 1.0 night is wiiu "correct" for nvidia
// changes here in turn "breaks" bloom as they over or under expose depending on day/night
const float preExposure = 0.55; // old brigntess tweak. Truncates at around .45+
const float gammaPostExposure = 1.1; // compensate pre exposure, but loss of contrast when positive.
const float preExposure = 0.85; // old brigntess tweak. Truncates at around .45+
const float gammaPostExposure = 0.9; // compensate pre exposure, but loss of contrast when positive.
uniform ivec4 uf_remappedPS[1];
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 sampler3D textureUnitPS1;// Tex1 addr 0x2603b000 res 16x16x16 dim 2 tm: 7 format 001a compSel: 0 1 2 3 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x10) Sampler1 ClampX/Y/Z: 2 2 2 border: 0

View File

@ -13,6 +13,7 @@ $scaleFactorY = always_decimal_format($fullHeight / 720.0);
//to do - extra edge smooth pass,
//const float resScale = 2.0;// 2.0 looks good
const float resScale = <?=$scaleFactorX?>;
const float shadowExposure = 0.75; //By truncating shadow, we decrease overall exposure during day only.
uniform ivec4 uf_remappedPS[31];
layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf4386000 res 1280x720x1 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(binding = 1) uniform sampler2D textureUnitPS1;// Tex1 addr 0xf599a000 res 1024x1024x1 dim 1 tm: 4 format 0005 compSel: 0 4 4 5 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler1 ClampX/Y/Z: 6 6 6 border: 2
@ -581,5 +582,5 @@ R0i.y = floatBitsToInt((intBitsToFloat(PV0i.y) * intBitsToFloat(uf_remappedPS[30
R0i.z = floatBitsToInt((intBitsToFloat(PV0i.x) * intBitsToFloat(uf_remappedPS[30].x) + intBitsToFloat(uf_remappedPS[30].y)));
}
// export
passPixelColor0 = vec4(intBitsToFloat(R0i.x), intBitsToFloat(R0i.y), intBitsToFloat(R0i.z), intBitsToFloat(R0i.w));
passPixelColor0 = vec4(intBitsToFloat(R0i.x)*shadowExposure, intBitsToFloat(R0i.y), intBitsToFloat(R0i.z), intBitsToFloat(R0i.w));
}

View File

@ -4,8 +4,8 @@
// cross fade brightness
// To-do, .5 is daylight and 1.0 night is wiiu "correct" for nvidia
// changes here in turn "breaks" bloom as they over or under expose depending on day/night
const float preExposure = 0.55; // old brigntess tweak. Truncates at around .45+
const float gammaPostExposure = 1.1; // compensate pre exposure, but loss of contrast when positive.
const float preExposure = 0.85; // old brigntess tweak. Truncates at around .45+
const float gammaPostExposure = 0.9; // compensate pre exposure, but loss of contrast when positive.
uniform ivec4 uf_remappedPS[1];
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

View File

@ -12,6 +12,7 @@ $scaleFactorY = always_decimal_format($fullHeight / 720.0);
// shadows scaling, ie 4096 = x4
// To do - some nice edge smoothing at higher res
const float resScale = <?=$scaleFactorX?>;
const float shadowExposure = 0.75;
//const float resScale = 4;
uniform ivec4 uf_remappedPS[23];
layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf4386000 res 1280x720x1 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
@ -475,5 +476,5 @@ R0i.x = floatBitsToInt((intBitsToFloat(R1i.w) * intBitsToFloat(uf_remappedPS[22]
R0i.w = 0;
}
// export
passPixelColor0 = vec4(intBitsToFloat(R0i.x), intBitsToFloat(R0i.x), intBitsToFloat(R0i.x), intBitsToFloat(R0i.w));
passPixelColor0 = vec4(intBitsToFloat(R0i.x)*shadowExposure, intBitsToFloat(R0i.x), intBitsToFloat(R0i.x), intBitsToFloat(R0i.w));
}