[TPHD] Misc quality tweaks for high resolution , QL

TPHD  QL tweaks aka, sunday gaming delayed

Resolution
* Sharper, unscaled blur fixed. See contrasty note
* Resolutions 4k and above scale sub viewports 75-> 50% of the main res.
7680x4320 is now 30 fps stable on a 1070, SSAA looks sweet.
* Added some off-aspect custom res with horizontal res x2. Good for SSAA
fixing shimmering as it's mostly horizontal in TPHD

Contrasty
* Sharper, unscaled blur fixed. Note, contrasty must be pre-selected at
start to override same shader in resolution folder
* Minor tweaks to cold setting

Fancy FX
*Added option to disable blur, just keeping other tweaks active.
Realized that half scaling sub-view port mostly replaces fancy fX :/
*Tweaked to somewhat scale, tries to emulate original look by default.
Ie 4x res = 4x blur "qualitative look" (not the same as nr of passes)
*Added "defocus" looks blurrier by scaling incorrectly, masked by more
draw passes. This is similar to the old default

Not happy about the results of moving blur from res folder, too many
drawbacks as quality of scaling really needs to be per-setting.
Will probably deprecate if things start to break again. Maybe global
variables in the future?
This commit is contained in:
getdls 2019-01-21 00:13:06 +01:00
parent 8dc4c7017b
commit 079da6f21e
7 changed files with 335 additions and 122 deletions

View File

@ -99,7 +99,7 @@ $redShadows = 0.99 #0.99
$greenShadows = 1.0 # 1.0
$blueSadows = 1.01 #1.0 #1.01
$redMid = 0.89 #0.87
$greenMid = 0.925 #0.9 #0.88
$greenMid = 0.95 #0.9 #0.88
$blueMid = 1.0
$redHilight = 1.0
$greenHilight = 1.01 #.86
@ -110,10 +110,10 @@ $hazeFactor = 0.1
$bloom = 0.975
$gamma = 1.025
$exposure = 1.025
$vibrance = 0.4
$vibrance = 0.48
$crushContrast = 0.0
$bleach = 0.875
$sharp_mix = 0.05
$sharp_mix = 0.00
[Preset] # jff
name = Skyward Swordish

View File

@ -4,21 +4,26 @@
// shader e334517825fdd599
//basline dof blur..
const float dither = 0.5 ;
const float scaleShader = 0.5;
const float scaleBlur = $scaleBlur; //0.125 4k
const int sampleScale = 2;
const float lightBloom = 0.95;
const int sampleScaling = $presetPass;
#define EnableBlur $enableBlur
layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf4001000 res 1920x1080x1 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;
/* Nr of pass hack since we don't know what the res pack set to after moving shader from main pack :(
* Would have been better to manually tweak per res setting , and then add static scaler on top of that.
* ~1080 -> 2 pass, 1440->3 , 4k -> 5
*/
const int sampleScale = 2 + int(1.0/uf_fragCoordScale.x) + sampleScaling;
//const int sampleScale = 2 + sampleScaling;
// FabriceNeyret2 CC, single shader gaussian by intermediate MIPmap level. www.shadertoy.com/view/ltScRG
const int samples = 8 * sampleScale, //8 or 4 balances xy position
const int samples = 4 * sampleScale, //8 or 4 balances xy position + brightness hack
LOD = 2, // gaussian done on MIPmap at scale LOD
sLOD = 1 << LOD; // tile size = 2^LOD
const float sigma = float(samples) * .25;
@ -37,7 +42,7 @@ vec4 blur(sampler2D sp, vec2 U, vec2 scale) {
}
//return O / O.a;
return vec4(O.x, O.y, O.z, 1.0)*19; // balance loss of brightness
return vec4(O.x, O.y, O.z, 0.0)*20.0; // balance loss of brightness
}
int clampFI32(int v)
@ -65,14 +70,22 @@ vec3 cubeMapSTM;
int cubeMapFaceId;
R0f = passParameterSem0;
#if (EnableBlur == 1)
vec2 scaler = uf_fragCoordScale.xy;
vec2 coord = R0f.xy*textureSize(textureUnitPS0, 0); //
vec2 ps = vec2(1.0) / textureSize(textureUnitPS0, 0);
vec2 uv = coord * ps;
R9f.xyzw = blur(textureUnitPS0, R0f.xy, ps*scaleBlur).xyzw;
R0f.xyzw = (textureLod(textureUnitPS0, R0f.xy,0.0).xyzw);
R0f.xyz = mix(R0f.xyz, R9f.xyz, 0.75);
R9f.xyz = blur(textureUnitPS0, R0f.xy, ps*0.5*scaleBlur*scaler).xyz;
R0f.w = (textureLod(textureUnitPS0, R0f.xy,0.0).w);
// export
passPixelColor0 = vec4(R9f.x, R9f.y, R9f.z, R0f.w);
#elif (EnableBlur == 0)
R0f.xyzw = (textureLod(textureUnitPS0, R0f.xy,0.0).xyzw);
// export
passPixelColor0 = vec4(R0f.x, R0f.y, R0f.z, R0f.w);
#endif
}

View File

@ -2,23 +2,54 @@
titleIds = 000500001019C800,000500001019E600,000500001019E500
name = Resolution
path = "The Legend of Zelda: Twilight Princess HD/Enhancements/Fancy FX"
description = Pretty blur, de-band sky, re-align cinematic etc, maintained on Nvidia.
description = Pretty blur, shadow x2, de-band sky, maintained on Nvidia.
version = 3
[Preset]
name = 1080 -> 2160
$dither = 0.2
$scaleShader = 1.0
$scaleBlur = 0.5
$internalRes = 1
[Preset]
name = 2880 -> 4320
[Preset] # Gaussian blur w correct scaling
name = Light blur - Original look++
$dither = 0.2
$scaleShader = 1.0
$scaleBlur = 1.0
$internalRes = 1
$presetPass:int = 0
$enableBlur:int = 1
[Preset] # Scaling offset, looks blurrier on high res as additional passes mostly hide the error
name = LB + defocus, better for high res, same performance
$dither = 0.2
$scaleShader = 1.0
$scaleBlur = 1.25
$internalRes = 1
$presetPass:int = 0
$enableBlur:int = 1
[Preset] # gaussian blur w correct scaling and an additional 4 passes
name = +1 extra blur pass, slower, pretty in high res
$dither = 0.2
$scaleShader = 1.0
$scaleBlur = 1.0
$internalRes = 1
$presetPass:int = 1
$enableBlur:int = 1
[Preset] #
name = Disable extra blur, keep other tweaks active
$dither = 0.2
$scaleShader = 1.0
$scaleBlur = 1.0
$internalRes = 1
$presetPass:int = 0
$enableBlur:int = 0
#[Preset] # Tanks performance, debug merge w res file.
#name = +1 Blur pass and defocus.
#$dither = 0.2
#$scaleShader = 1.0
#$scaleBlur = 1.5
#$internalRes = 1
#$presetPass:int = 1
#$enableBlur:int = 1
#Fog banding
[TextureRedefine]
@ -57,3 +88,9 @@ height = 270
formats = 0x01a
overwriteFormat = 0x01f
[TextureRedefine] #Double shadow res
width = 384
height = 384
###formatsExcluded =
overwriteWidth = 768
overwriteHeight = 768

View File

@ -0,0 +1,51 @@
[Definition]
titleIds = 000500001019C800,000500001019E600,000500001019E500
name = Resolution
path = "The Legend of Zelda: Twilight Princess HD/Graphics/Performance Resolution"
description = Changes the resolution of the game.
version = 3
[Preset]
name = 1280x720
$width = 1280
$height = 720
$gameWidth = 1920
$gameHeight = 1080
[Preset]
name = 640x360
$width = 640
$height = 360
$gameWidth = 1920
$gameHeight = 1080
[Preset]
name = 960x540
$width = 960
$height = 540
$gameWidth = 1920
$gameHeight = 1080
[Preset]
name = 1600x900
$width = 1600
$height = 900
$gameWidth = 1920
$gameHeight = 1080
[TextureRedefine]
width = 1920
height = 1088
#formats = 0x011,0x01a
overwriteWidth = ($width/$gameWidth) * 1920
overwriteHeight = ($height/$gameHeight) * 1088
[TextureRedefine]
width = 1920
height = 1080
#formats =
overwriteWidth = ($width/$gameWidth) * 1920
overwriteHeight = ($height/$gameHeight) * 1080

View File

@ -0,0 +1,135 @@
#version 420
#extension GL_ARB_texture_gather : enable
#extension GL_ARB_separate_shader_objects : enable
// shader c14019840473ff86
//scale boxblur fx
layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf4001000 res 1920x1080x1 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 0xf5187000 res 1920x1080x1 dim 1 tm: 4 format 0011 compSel: 0 4 4 5 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;
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){ if( a == 0.0 || b == 0.0 ) return 0.0; return a*b; }
void main()
{
vec4 R0f = vec4(0.0);
vec4 R1f = vec4(0.0);
vec4 R2f = vec4(0.0);
vec4 R3f = 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;
float scaler;
R0f = passParameterSem0;
scaler = uf_fragCoordScale.x;
R0f.w = (textureGather(textureUnitPS1, R0f.xy).y);
// 0
R1f.x = R0f.x + intBitsToFloat(0xba088889);
R1f.y = R0f.y + intBitsToFloat(0xba72b9d6);
R2f.z = R0f.x;
R2f.y = R0f.y + intBitsToFloat(0xba72b9d6);
PS0f = R2f.y;
// 1
R3f.x = R0f.x + intBitsToFloat(0xba088889);
R3f.y = R0f.y;
R1f.xyzw = (textureGather(textureUnitPS1, R1f.xy).xyzw);
R2f.yz = (textureGather(textureUnitPS1, R2f.zy).yz);
R3f.xy = (textureGather(textureUnitPS1, R3f.xy).xy);
// 0
PV0f.x = R2f.z + R3f.x;
PV0f.y = R1f.w + R0f.w;
PV0f.z = R1f.z + R3f.y;
PV0f.w = R1f.x + R2f.y;
// 1
R123f.x = (R1f.y * 2.0 + -(PV0f.x));
PV1f.x = R123f.x;
R123f.y = (R1f.y * 2.0 + -(PV0f.y));
PV1f.y = R123f.y;
R123f.z = (R1f.y * 2.0 + -(PV0f.z));
PV1f.z = R123f.z;
R123f.w = (R1f.y * 2.0 + -(PV0f.w));
PV1f.w = R123f.w;
// 2
PV0f.x = max(PV1f.x, -(PV1f.x));
PV0f.y = max(PV1f.y, -(PV1f.y));
PV0f.z = max(PV1f.z, -(PV1f.z));
PV0f.w = max(PV1f.w, -(PV1f.w));
// 3
PV1f.x = PV0f.x + intBitsToFloat(0xb400d959);
PV1f.y = PV0f.y + intBitsToFloat(0xb400d959);
PV1f.z = PV0f.z + intBitsToFloat(0xb400d959);
PV1f.w = PV0f.w + intBitsToFloat(0xb400d959);
// 4
R123f.x = intBitsToFloat(((PV1f.w >= 0.0)?(floatBitsToInt(1.0)):(0)));
PV0f.x = R123f.x;
R123f.y = intBitsToFloat(((PV1f.z >= 0.0)?(floatBitsToInt(1.0)):(0)));
PV0f.y = R123f.y;
R123f.z = intBitsToFloat(((PV1f.y >= 0.0)?(floatBitsToInt(1.0)):(0)));
PV0f.z = R123f.z;
R123f.w = intBitsToFloat(((PV1f.x >= 0.0)?(floatBitsToInt(1.0)):(0)));
PV0f.w = R123f.w;
// 5
tempf.x = dot(vec4(PV0f.x,PV0f.y,PV0f.z,PV0f.w),vec4(0.25*scaler,0.25*scaler,0.25*scaler,0.25*scaler));
PV1f.x = tempf.x;
PV1f.y = tempf.x;
PV1f.z = tempf.x;
PV1f.w = tempf.x;
// 6
R127f.z = PV1f.x * intBitsToFloat(0x3f400000);
PV0f.z = R127f.z;
// 7
R1f.x = (PV0f.z * intBitsToFloat(0xba088889) + R0f.x);
R1f.y = R0f.y;
R2f.z = R0f.x;
R2f.y = (PV0f.z * intBitsToFloat(0xba72b9d6) + R0f.y);
PS1f = R2f.y;
// 8
R3f.x = (R127f.z * intBitsToFloat(0x3a088889) + R0f.x);
R3f.y = R0f.y;
R0f.w = (R127f.z * intBitsToFloat(0x3a72b9d6) + R0f.y);
R1f.xyzw = (texture(textureUnitPS0, R1f.xy).xyzw);
R2f.xyzw = (texture(textureUnitPS0, R2f.zy).xyzw);
R3f.xyzw = (texture(textureUnitPS0, R3f.xy).xyzw);
R0f.xyzw = (texture(textureUnitPS0, R0f.xw).xyzw);
// 0
PV0f.x = R1f.w + R2f.w;
PV0f.y = R1f.z + R2f.z;
PV0f.z = R1f.y + R2f.y;
PV0f.w = R1f.x + R2f.x;
// 1
PV1f.x = R3f.w + PV0f.x;
PV1f.y = R3f.z + PV0f.y;
PV1f.z = R3f.y + PV0f.z;
PV1f.w = R3f.x + PV0f.w;
// 2
backupReg0f = R0f.y;
backupReg1f = R0f.x;
PV0f.x = R0f.w + PV1f.x;
PV0f.y = R0f.z + PV1f.y;
PV0f.z = backupReg0f + PV1f.z;
PV0f.w = backupReg1f + PV1f.w;
// 3
R0f.x = PV0f.w * 0.25;
R0f.y = PV0f.z * 0.25;
R0f.z = PV0f.y * 0.25;
R0f.w = PV0f.x * 0.25;
// export
passPixelColor0 = vec4(R0f.x, R0f.y, R0f.z, R0f.w);
}

View File

@ -2,7 +2,7 @@
moduleMatches = 0x1A03E108
#rodata constants
0x1005AAD8 = .float $width/$height
0x1005AAD8 = .float $aspectRatio #$width/$height
_aspectAddr = 0x1006AAD8

View File

@ -14,66 +14,8 @@ $gameHeight = 1080
$dither = 0.01
$scaleShader = 1.0
$scaleBlur = 0.05
$internalRes = 1
// Performance
[Preset]
name = 640x360
$width = 640
$height = 360
$gameWidth = 1920
$gameHeight = 1080
$dither = 0.01
$scaleShader = 1.0
$scaleBlur = 0.05
$internalRes = 1
[Preset]
name = 854x480
$width = 854
$height = 480
$gameWidth = 1920
$gameHeight = 1080
$dither = 0.01
$scaleShader = 1.0
$scaleBlur = 0.05
$internalRes = 1
[Preset]
name = 960x540
$width = 960
$height = 540
$gameWidth = 1920
$gameHeight = 1080
$dither = 0.01
$scaleShader = 1.0
$scaleBlur = 0.05
$internalRes = 1
[Preset]
name = 1280x720
$width = 1280
$height = 720
$gameWidth = 1920
$gameHeight = 1080
$dither = 0.01
$scaleShader = 1.0
$scaleBlur = 0.05
$internalRes = 1
// Quality
[Preset]
name = 1600x900
$width = 1600
$height = 900
$gameWidth = 1920
$gameHeight = 1080
$dither = 0.01
$scaleShader = 1.0
$scaleBlur = 0.05
$internalRes = 1
$internalRes = 1.0
$aspectRatio = (16.0/9.0)
[Preset]
name = 2560x1080 (21:9 HD)
@ -84,18 +26,20 @@ $gameHeight = 1080
$dither = 0.1
$scaleShader = 1.0
$scaleBlur = 0.25
$internalRes = 1
$internalRes = 1.0
$aspectRatio = (64.0 / 27.0)
[Preset]
name = 5760x1080 (48:9 HD)
$width = 2560
$width = 5760
$height = 1080
$gameWidth = 1920
$gameHeight = 1080
$dither = 0.1
$scaleShader = 1.0
$scaleBlur = 0.25
$internalRes = 1
$internalRes = 1.0
$aspectRatio = (48.0/9.0)
[Preset]
name = 2560x1440
@ -106,7 +50,8 @@ $gameHeight = 1080
$dither = 0.1
$scaleShader = 1.0
$scaleBlur = 0.25
$internalRes = 1
$internalRes = 1.0
$aspectRatio = (16.0/9.0)
[Preset]
name = 3440x1440 (21:9)
@ -117,7 +62,8 @@ $gameHeight = 1080
$dither = 0.1
$scaleShader = 1.0
$scaleBlur = 0.25
$internalRes = 1
$internalRes = 1.0
$aspectRatio = (64.0 / 27.0)
[Preset]
name = 7680x1440 (48:9)
@ -128,7 +74,8 @@ $gameHeight = 1080
$dither = 0.1
$scaleShader = 1.0
$scaleBlur = 0.25
$internalRes = 1
$internalRes = 0.70
$aspectRatio = (48.0/9.0)
[Preset]
name = 2732x1536
@ -139,7 +86,8 @@ $gameHeight = 1080
$dither = 0.2
$scaleShader = 1.0
$scaleBlur = 0.25
$internalRes = 1
$internalRes = 1.0
$aspectRatio = (16.0/9.0)
[Preset]
name = 3200x1800
@ -150,7 +98,8 @@ $gameHeight = 1080
$dither = 0.2
$scaleShader = 1.0
$scaleBlur = 0.5
$internalRes = 1
$internalRes = 1.0
$aspectRatio = (16.0/9.0)
[Preset]
name = 3840x2160 (4k - Native x2)
@ -161,7 +110,8 @@ $gameHeight = 1080
$dither = 0.2
$scaleShader = 1.0
$scaleBlur = 0.75
$internalRes = 1
$internalRes = 0.75
$aspectRatio = (16.0/9.0)
[Preset]
name = 5120x2160 (4k 21:9)
@ -172,30 +122,8 @@ $gameHeight = 1080
$dither = 0.2
$scaleShader = 1.0
$scaleBlur = 0.5
$internalRes = 1
[Preset]
name = 5120x2160 (4k 48:9)
$width = 11520
$height = 2160
$gameWidth = 1920
$gameHeight = 1080
$dither = 0.2
$scaleShader = 1.0
$scaleBlur = 0.5
$internalRes = 1
[Preset]
name = 3840x2160 (4k - Native x2) 0.75 sub scaling
$width = 3840
$height = 2160
$gameWidth= 1920
$gameHeight= 1080
$internalRes = 0.75
$dither = 0.2
$scaleShader = 1.0
$scaleBlur = 0.5
$aspectRatio = (64.0 / 27.0)
[Preset]
name = 5120x2880
@ -206,7 +134,8 @@ $gameHeight = 1080
$dither = 0.2
$scaleShader = 1.0
$scaleBlur = 0.5
$internalRes = 1
$internalRes = 0.75
$aspectRatio = (16.0/9.0)
// Enthusiast
@ -219,22 +148,70 @@ $gameHeight = 1080
$dither = 0.25
$scaleShader = 1.0
$scaleBlur = 0.5
$internalRes = 1
$internalRes = 0.5
$aspectRatio = (16.0/9.0)
[Preset] # Should work fine on a 1070 and fixes most of horizontal shimmering
name = ---- Custom res - SSAA Tweaks ----
$width = 1920
$height = 1080
$gameWidth = 1920
$gameHeight = 1080
$dither = 0.01
$scaleShader = 1.0
$scaleBlur = 0.05
$internalRes = 1.0
$aspectRatio = (16.0/9.0)
[Preset]
name = 1920x2160 (Vertical x2
$width = 1920
$height = 2160
$gameWidth = 1920
$gameHeight = 1080
$dither = 0.01
$scaleShader = 1.0
$scaleBlur = 0.05
$internalRes = 1.0
$aspectRatio = (16.0/9.0)
[Preset]
name = 2560x2880 (Vertical x2 - 0.75 sub scaling)
$width = 2560
$height = 2880
$gameWidth = 1920
$gameHeight = 1080
$dither = 0.1
$scaleShader = 1.0
$scaleBlur = 0.25
$internalRes = 0.75
$aspectRatio = (16.0/9.0)
[Preset] #
name = 3840x4320 (Vertical x2 - 0.75 sub scaling)
$width = 3840
$height = 4320
$gameWidth = 1920
$gameHeight = 1080
$dither = 0.25
$scaleShader = 1.0
$scaleBlur = 0.5
$internalRes = 0.75
$aspectRatio = (16.0/9.0)
[TextureRedefine]
width = 1920
height = 1088
#formats = 0x011,0x01a
overwriteWidth = ($width/$gameWidth) * 1920
overwriteWidth = ($width/$gameWidth) * 1920
overwriteHeight = ($height/$gameHeight) * 1088
[TextureRedefine]
width = 1920
height = 1080
#formats =
overwriteWidth = ($width/$gameWidth) * 1920
overwriteHeight = ($height/$gameHeight) * 1080
overwriteWidth = ($width/$gameWidth) * 1920
overwriteHeight = ($height/$gameHeight) * 1080
[TextureRedefine]
width = 960