From 0e266fec6f74fa6d4f6ab53e5f0b5613e419181d Mon Sep 17 00:00:00 2001 From: getdls <25286924+getdls@users.noreply.github.com> Date: Thu, 16 Jan 2020 01:07:00 +0100 Subject: [PATCH] [MK8] Add LOD, radial Blur Original blur really need more samples above 1080p ...in every racing game. --- Enhancements/MarioKart8_NegativeLOD/rules.txt | 91 +++++++++++ .../fdf33c607cd1d737_0000000000000079_ps.txt | 149 ++++++++++++++++++ .../MarioKart8_SmothSpeedBlur/rules.txt | 24 +++ 3 files changed, 264 insertions(+) create mode 100644 Enhancements/MarioKart8_NegativeLOD/rules.txt create mode 100644 Enhancements/MarioKart8_SmothSpeedBlur/fdf33c607cd1d737_0000000000000079_ps.txt create mode 100644 Enhancements/MarioKart8_SmothSpeedBlur/rules.txt diff --git a/Enhancements/MarioKart8_NegativeLOD/rules.txt b/Enhancements/MarioKart8_NegativeLOD/rules.txt new file mode 100644 index 00000000..6653bf40 --- /dev/null +++ b/Enhancements/MarioKart8_NegativeLOD/rules.txt @@ -0,0 +1,91 @@ +[Definition] +titleIds = 000500001010ec00,000500001010ed00,000500001010eb00 +name = Texture level of detail +path = "Mario Kart 8/Enhancements/Negative Texture LOD" +description = Sharper textures at risk of shimmering when set too high. +version = 4 + +[Preset] +name = LOD -0.5 (Sharper) +$0x031 = -.5 +$0x033 = -.5 +$0x034 = -.5 +$0x035 = -.5 +$0x01a = -.5 +$0x431 = -.5 +$0x235 = -.5 +$0x433 = -.5 + +[Preset] +name = LOD -0.75 (Sharper) +$0x031 = -.75 +$0x033 = -.75 +$0x034 = -.75 +$0x035 = -.75 +$0x01a = -.75 +$0x431 = -.75 +$0x235 = -.75 +$0x433 = -.75 + +[Preset] +name = LOD -1 (Max for gameplay) +$0x031 = -1 +$0x033 = -1 +$0x034 = -1 +$0x035 = -1 +$0x01a = -1 +$0x431 = -1 +$0x235 = -1 +$0x433 = -1 + +[Preset] +name = LOD -4 (Overkill - For screenshots) +$0x031 = -4 +$0x033 = -4 +$0x034 = -4 +$0x035 = -4 +$0x01a = -4 +$0x431 = -4 +$0x235 = -4 +$0x433 = -4 + +[Preset] +name = LOD 0 Default +$0x031 = 0 +$0x033 = 0 +$0x034 = 0 +$0x035 = 0 +$0x01a = 0 +$0x431 = 0 +$0x235 = 0 +$0x433 = 0 + +[Preset] +name = LOD +1(Aprox WiiU Look on higher resolution) +$0x031 = +1 +$0x033 = +1 +$0x034 = +1 +$0x035 = +1 +$0x01a = 0 +$0x431 = +1 +$0x235 = +1 +$0x433 = +1 +[TextureRedefine] +formats = 0x031 #0x431,0x432,0x433,0x434,0x435 not used. +overwriteRelativeLodBias = $0x031 + +[TextureRedefine]#Per format, possible to have separate scaling if needed +formats = 0x033 +overwriteRelativeLodBias = $0x033 + +[TextureRedefine] +formats = 0x034 +overwriteRelativeLodBias = $0x034 + +[TextureRedefine] +formats = 0x035 +overwriteRelativeLodBias = $0x035 + +[TextureRedefine] +formats = 0x01a +overwriteRelativeLodBias = $0x01a diff --git a/Enhancements/MarioKart8_SmothSpeedBlur/fdf33c607cd1d737_0000000000000079_ps.txt b/Enhancements/MarioKart8_SmothSpeedBlur/fdf33c607cd1d737_0000000000000079_ps.txt new file mode 100644 index 00000000..92564c21 --- /dev/null +++ b/Enhancements/MarioKart8_SmothSpeedBlur/fdf33c607cd1d737_0000000000000079_ps.txt @@ -0,0 +1,149 @@ +#version 430 +#extension GL_ARB_texture_gather : enable +#extension GL_ARB_separate_shader_objects : enable +// shader fdf33c607cd1d737 //Radial blur replacement +// start of shader inputs/outputs, predetermined by Cemu. Do not touch +#ifdef VULKAN +#define ATTR_LAYOUT(__vkSet, __location) layout(set = __vkSet, location = __location) +#define UNIFORM_BUFFER_LAYOUT(__glLocation, __vkSet, __vkLocation) layout(set = __vkSet, binding = __vkLocation, std140) +#define TEXTURE_LAYOUT(__glLocation, __vkSet, __vkLocation) layout(set = __vkSet, binding = __vkLocation) +#define GET_FRAGCOORD() vec4(gl_FragCoord.xy*uf_fragCoordScale.xy,gl_FragCoord.zw) +#else +#define ATTR_LAYOUT(__vkSet, __location) layout(location = __location) +#define UNIFORM_BUFFER_LAYOUT(__glLocation, __vkSet, __vkLocation) layout(binding = __glLocation, std140) +#define TEXTURE_LAYOUT(__glLocation, __vkSet, __vkLocation) layout(binding = __glLocation) +#define GET_FRAGCOORD() vec4(gl_FragCoord.xy*uf_fragCoordScale,gl_FragCoord.zw) +#endif +#ifdef VULKAN +layout(set = 1, binding = 1) uniform ufBlock +{ +uniform vec4 uf_fragCoordScale; +}; +#else +uniform vec2 uf_fragCoordScale; +#endif +TEXTURE_LAYOUT(0, 1, 0) uniform sampler2D textureUnitPS0; +layout(location = 0) in vec4 passParameterSem0; +layout(location = 1) in vec4 passParameterSem1; +layout(location = 2) in vec4 passParameterSem2; +layout(location = 3) in vec4 passParameterSem3; +layout(location = 0) out vec4 passPixelColor0; +// end of shader inputs/outputs +float blurStart = $blurStart; +float blurWidth = $blurWidth; + +const int nsamples = $nrOfPasses ; //original had aprox 8 at 640x240 +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 R4f = vec4(0.0); +vec4 R5f = vec4(0.0); +vec4 R6f = vec4(0.0); +vec4 R7f = vec4(0.0); +vec4 colour = vec4(0.0); +vec2 center = vec2(0.5, 0.5); +vec4 R123f = 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; +R2f = passParameterSem2; +R3f = passParameterSem3; +vec2 coord = -1.0 + R0f.xy; +vec2 ps = vec2(1.0)*uf_fragCoordScale.xy / textureSize(textureUnitPS0, 0); +vec2 uv = gl_FragCoord.xy *2.0 / textureSize(textureUnitPS0, 0); +//Simle radial blur jcant0n, shadertoy.com +uv -= center; +float precompute = blurWidth * (1.0 / float(nsamples - 1)); +for(int i = 0; i < nsamples; i++) +{ + float scale = blurStart + (float(i)* precompute); + colour += texture(textureUnitPS0, uv* scale + center ); +} +colour /= float(nsamples); +//passPixelColor0 = colour; +R4f.xyz = colour.xyz; +R0f.xyz = R4f.xyz; +R5f.xyz = R4f.xyz; +R1f.xyz = R4f.xyz; +R6f.xyz = R4f.xyz; +R2f.xyz = R4f.xyz; +R7f.xyz = R4f.xyz; +R3f.xyz = R4f.xyz; +// 0 +PV0f.x = R4f.y * intBitsToFloat(0x3e000000); +PV0f.y = R4f.x * intBitsToFloat(0x3e000000); +PV0f.w = R4f.z * intBitsToFloat(0x3e000000); +R4f.w = 1.0; +PS0f = R4f.w; +// 1 +R123f.x = (R0f.z * intBitsToFloat(0x3e000000) + PV0f.w); +PV1f.x = R123f.x; +R123f.y = (R0f.y * intBitsToFloat(0x3e000000) + PV0f.x); +PV1f.y = R123f.y; +R123f.z = (R0f.x * intBitsToFloat(0x3e000000) + PV0f.y); +PV1f.z = R123f.z; +// 2 +R123f.x = (R5f.z * intBitsToFloat(0x3e000000) + PV1f.x); +PV0f.x = R123f.x; +R123f.z = (R5f.y * intBitsToFloat(0x3e000000) + PV1f.y); +PV0f.z = R123f.z; +R123f.w = (R5f.x * intBitsToFloat(0x3e000000) + PV1f.z); +PV0f.w = R123f.w; +// 3 +R123f.x = (R1f.y * intBitsToFloat(0x3e000000) + PV0f.z); +PV1f.x = R123f.x; +R123f.y = (R1f.x * intBitsToFloat(0x3e000000) + PV0f.w); +PV1f.y = R123f.y; +R123f.w = (R1f.z * intBitsToFloat(0x3e000000) + PV0f.x); +PV1f.w = R123f.w; +// 4 +R123f.y = (R6f.y * intBitsToFloat(0x3e000000) + PV1f.x); +PV0f.y = R123f.y; +R123f.z = (R6f.x * intBitsToFloat(0x3e000000) + PV1f.y); +PV0f.z = R123f.z; +R123f.w = (R6f.z * intBitsToFloat(0x3e000000) + PV1f.w); +PV0f.w = R123f.w; +// 5 +R123f.x = (R2f.x * intBitsToFloat(0x3e000000) + PV0f.z); +PV1f.x = R123f.x; +R123f.z = (R2f.z * intBitsToFloat(0x3e000000) + PV0f.w); +PV1f.z = R123f.z; +R123f.w = (R2f.y * intBitsToFloat(0x3e000000) + PV0f.y); +PV1f.w = R123f.w; +// 6 +R123f.x = (R7f.y * intBitsToFloat(0x3e000000) + PV1f.w); +PV0f.x = R123f.x; +R123f.y = (R7f.x * intBitsToFloat(0x3e000000) + PV1f.x); +PV0f.y = R123f.y; +R123f.w = (R7f.z * intBitsToFloat(0x3e000000) + PV1f.z); +PV0f.w = R123f.w; +// 7 +R4f.x = (R3f.x * intBitsToFloat(0x3e000000) + PV0f.y); +R4f.y = (R3f.y * intBitsToFloat(0x3e000000) + PV0f.x); +R4f.z = (R3f.z * intBitsToFloat(0x3e000000) + PV0f.w); +// export + +passPixelColor0 = vec4(R4f.x, R4f.y, R4f.z, R4f.w); + +} diff --git a/Enhancements/MarioKart8_SmothSpeedBlur/rules.txt b/Enhancements/MarioKart8_SmothSpeedBlur/rules.txt new file mode 100644 index 00000000..576a68a0 --- /dev/null +++ b/Enhancements/MarioKart8_SmothSpeedBlur/rules.txt @@ -0,0 +1,24 @@ +[Definition] +titleIds = 000500001010ec00,000500001010ed00,000500001010eb00 +name = Smooth speed blur +path = "Mario Kart 8/Enhancements/Smoother speed blur" +description = Smoother speed blur (radial), more GPU intensive +version = 4 + +[Preset] #twice the samples +name = Original speed feel (16 pass) +$nrOfPasses:int = 16 +$blurStart:float = 0.93 +$blurWidth:float = 0.1 + +[Preset] +name = Smooth half original (8 pass) +$nrOfPasses:int = 8 +$blurStart:float = 0.975 +$blurWidth:float = 0.025 + +[Preset] #3 times +name = Original speed feel smoother (24 pass) +$nrOfPasses:int = 24 +$blurStart:float = 0.93 +$blurWidth:float = 0.1 \ No newline at end of file