From ac5d1a770f4febce1706599a9b76f4cbc1644d64 Mon Sep 17 00:00:00 2001 From: getdls <25286924+getdls@users.noreply.github.com> Date: Sat, 18 Jan 2020 19:17:16 +0100 Subject: [PATCH] [TP] Contrasty Vulkan + local fixes This should play nice with the script update. Nasty merge conflict :( Local had folder changes and settings I never got around to commit. --- .../c14019840473ff86_00000000000003c9_ps.txt | 47 ++++++------------- .../TwilightPrincessHD_Contrasty/rules.txt | 18 +++---- 2 files changed, 23 insertions(+), 42 deletions(-) diff --git a/Enhancements/TwilightPrincessHD_Contrasty/c14019840473ff86_00000000000003c9_ps.txt b/Enhancements/TwilightPrincessHD_Contrasty/c14019840473ff86_00000000000003c9_ps.txt index c17d01e9..b917e9b2 100644 --- a/Enhancements/TwilightPrincessHD_Contrasty/c14019840473ff86_00000000000003c9_ps.txt +++ b/Enhancements/TwilightPrincessHD_Contrasty/c14019840473ff86_00000000000003c9_ps.txt @@ -1,24 +1,19 @@ -#version 420 +#version 430 #extension GL_ARB_texture_gather : enable #extension GL_ARB_separate_shader_objects : enable +// shader c14019840473ff86 +// 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 SET_POSITION(_v) gl_Position = _v; gl_Position.z = (gl_Position.z + gl_Position.w) / 2.0 #define GET_FRAGCOORD() vec4(gl_FragCoord.xy*uf_fragCoordScale.xy,gl_FragCoord.zw) -#define gl_VertexID gl_VertexIndex -#define gl_InstanceID gl_InstanceIndex #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 SET_POSITION(_v) gl_Position = _v #define GET_FRAGCOORD() vec4(gl_FragCoord.xy*uf_fragCoordScale,gl_FragCoord.zw) #endif -// This shader was automatically converted to be cross-compatible with Vulkan and OpenGL. - -// shader c14019840473ff86 //aa #ifdef VULKAN layout(set = 1, binding = 2) uniform ufBlock { @@ -27,16 +22,19 @@ uniform vec4 uf_fragCoordScale; #else uniform vec2 uf_fragCoordScale; #endif +TEXTURE_LAYOUT(0, 1, 0) uniform sampler2D textureUnitPS0; +TEXTURE_LAYOUT(1, 1, 1) uniform sampler2D textureUnitPS1; +layout(location = 0) in vec4 passParameterSem0; +layout(location = 0) out vec4 passPixelColor0; +// end of shader inputs/outputs const float hazeFactor = 0.1; - const float gamma = $gamma; // 1.0 is neutral Botw is already colour graded at this stage const float exposure = $exposure; // 1.0 is neutral const float vibrance = $vibrance; // 0.0 is neutral const float crushContrast = $crushContrast; // 0.0 is neutral. Use small increments, loss of shadow detail const float contrastCurve = $contrastCurve; - vec3 RGB_Lift = vec3($redShadows, $greenShadows , $blueSadows); // [0.000 to 2.000] Adjust shadows for Red, Green and Blue. vec3 RGB_Gamma = vec3($redMid ,$greenMid, $blueMid); // [0.000 to 2.000] Adjust midtones for Red, Green and Blue vec3 RGB_Gain = vec3($redHilight, $greenHilight, $blueHilight); // [0.000 to 2.000] Adjust highlights for Red, Green and Blue @@ -115,12 +113,6 @@ vec3 contrasty(vec3 colour){ return fColour; } - -TEXTURE_LAYOUT(0, 1, 0) uniform sampler2D textureUnitPS0; -TEXTURE_LAYOUT(1, 1, 1) uniform sampler2D textureUnitPS1; -layout(location = 0) in vec4 passParameterSem0; -layout(location = 0) out vec4 passPixelColor0; - int clampFI32(int v) { if( v == 0x7FFFFFFF ) @@ -148,6 +140,7 @@ ivec4 ARi = ivec4(0); bool predResult = true; vec3 cubeMapSTM; int cubeMapFaceId; +float scaleRes = uf_fragCoordScale.x; R0f = passParameterSem0; R0f.w = (textureGather(textureUnitPS1, R0f.xy).y); // 0 @@ -163,8 +156,6 @@ 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; @@ -204,18 +195,18 @@ PV1f.y = tempf.x; PV1f.z = tempf.x; PV1f.w = tempf.x; // 6 -R127f.z = PV1f.x * intBitsToFloat(0x3f400000)*0.5; +R127f.z = PV1f.x * intBitsToFloat(0x3f400000)* scaleRes; PV0f.z = R127f.z; // 7 -R1f.x = (PV0f.z * intBitsToFloat(0xba088889)*0.5 + R0f.x); +R1f.x = (PV0f.z * intBitsToFloat(0xba088889) * scaleRes + R0f.x); R1f.y = R0f.y; R2f.z = R0f.x; -R2f.y = (PV0f.z * intBitsToFloat(0xba72b9d6)*0.5 + R0f.y); +R2f.y = (PV0f.z * intBitsToFloat(0xba72b9d6) * scaleRes + R0f.y); PS1f = R2f.y; // 8 -R3f.x = (R127f.z * intBitsToFloat(0x3a088889)*0.5 + R0f.x); +R3f.x = (R127f.z * intBitsToFloat(0x3a088889) * scaleRes + R0f.x); R3f.y = R0f.y; -R0f.w = (R127f.z * intBitsToFloat(0x3a72b9d6) + R0f.y); +R0f.w = (R127f.z * intBitsToFloat(0x3a72b9d6) * scaleRes + R0f.y); R1f.xyzw = (texture(textureUnitPS0, R1f.xy).xyzw); R2f.xyzw = (texture(textureUnitPS0, R2f.zy).xyzw); R3f.xyzw = (texture(textureUnitPS0, R3f.xy).xyzw); @@ -243,19 +234,9 @@ R0f.y = PV0f.z * 0.25; R0f.z = PV0f.y * 0.25; R0f.w = PV0f.x * 0.25; // export -//R0f.xyz = vec3(Sigmoid(R0f.x), Sigmoid(R0f.y),Sigmoid(R0f.z)); -//R0f.x = Sigmoid(R0f.x); -//R0f.y = Sigmoid(R0f.y); - -//R0f.xyz = contrasty(R0f.xyz); -//R0f.y = Sigmoid(R0f.y) -//R0f.xyz = clamp(R0f.xyz,0,1); -//R0f.x = max(0.0, R0f.x - crushContrast); R0f.xyz = contrasty(R0f.xyz); R0f.xyz = mix(R0f.xyz, smoothstep(0.0, 1.0, R0f.xyz), contrastCurve); -//vec3 mix(vec3 x, vec3 y, float a) -//R0f.xyz = mix(contrasty(R0f.xyz), vec3(Sigmoid(R0f.x), Sigmoid(R0f.y),Sigmoid(R0f.z)), 0.25); float smask = lumasharping(textureUnitPS0, passParameterSem0.xy); vec3 temp3 = R0f.xyz; R0f.xyz = mix(R0f.xyz, (temp3.xyz += (smask)), sharp_mix); diff --git a/Enhancements/TwilightPrincessHD_Contrasty/rules.txt b/Enhancements/TwilightPrincessHD_Contrasty/rules.txt index 355c5f0b..423e8fdf 100644 --- a/Enhancements/TwilightPrincessHD_Contrasty/rules.txt +++ b/Enhancements/TwilightPrincessHD_Contrasty/rules.txt @@ -127,20 +127,20 @@ $redHilight = 0.99 $greenHilight = 0.99 #.86 $blueHilight = 1.05 #1.14 -$contrastCurve = 0.95 +$contrastCurve = 0.75 $hazeFactor = 0.1 $bloom = 0.975 -$gamma = 1.05 -$exposure = 1.0 -$vibrance = 0.29 +$gamma = 1.03 +$exposure = 1.01 +$vibrance = 0.25 $crushContrast = 0.0 $bleach = 0.875 $sharp_mix = 0.00 [Preset] #Neutral/cold white point, light and shadows interplay, caves are dark. Some discoloration of multi layer fx name = Cold contrast crush -$redShadows = 0.98 #1.02 #0.99 -$greenShadows = 1.01 #1.05 # 1.0 +$redShadows = 1.01 #1.02 #0.99 +$greenShadows = 1.03 #1.05 # 1.0 $blueSadows = 1.04 #1.0 #1.01 $redMid = 0.99 #0.87 $greenMid = 1.06 #0.9 #0.88 @@ -149,7 +149,7 @@ $redHilight = 0.98 $greenHilight = 0.97 #.86 $blueHilight = 1.08 #1.14 -$contrastCurve = 0.95 +$contrastCurve = 0.75 $hazeFactor = 0.1 $bloom = 0.975 $gamma = 1.01 @@ -161,8 +161,8 @@ $sharp_mix = 0.00 [Preset] #Neutral/cold white point, light and shadows interplay, caves are dark. Some discoloration of multi layer fx name = Cold contrast preserve highlights -$redShadows = 0.98 #1.02 #0.99 -$greenShadows = 1.01 #1.05 # 1.0 +$redShadows = 1.01 #1.02 #0.99 +$greenShadows = 1.02 #1.05 # 1.0 $blueSadows = 1.04 #1.0 #1.01 $redMid = 0.97 #0.87 $greenMid = 1.06 #0.9 #0.88