update phase in main function

This commit is contained in:
hunterk 2020-02-17 11:44:18 -06:00
parent df9b480805
commit a24fd351db
2 changed files with 11 additions and 15 deletions

View file

@ -37,18 +37,9 @@ layout(set = 0, binding = 2) uniform sampler2D Source;
#define PI 3.14159265 #define PI 3.14159265
float phase = (global.OriginalSize.x > 300.0) ? 2.0 : 3.0; float phase = (global.OriginalSize.x > 300.0) ? 2.0 : 3.0;
float CHROMA_MOD_FREQ = (phase < 2.5) ? (4.0 * PI / 15.0) : (PI / 3.0);
float ARTIFACTING = 1.0 - global.quality;
float FRINGING = 1.0 - global.quality;
float SATURATION = 1.0 - global.bw;
// prevent some very slight clipping that happens at 1.0
const float BRIGHTNESS = 0.95;
mat3 mix_mat = mat3(
BRIGHTNESS, FRINGING, FRINGING, #define mix_mat mat3(BRIGHTNESS, FRINGING, FRINGING, ARTIFACTING, 2.0 * SATURATION, 0.0, ARTIFACTING, 0.0, 2.0 * SATURATION)
ARTIFACTING, 2.0 * SATURATION, 0.0,
ARTIFACTING, 0.0, 2.0 * SATURATION
);
const mat3 yiq2rgb_mat = mat3( const mat3 yiq2rgb_mat = mat3(
1.0, 0.956, 0.6210, 1.0, 0.956, 0.6210,
@ -73,6 +64,12 @@ vec3 rgb2yiq(vec3 col)
void main() void main()
{ {
float CHROMA_MOD_FREQ = (phase < 2.5) ? (4.0 * PI / 15.0) : (PI / 3.0);
float ARTIFACTING = 1.0 - global.quality;
float FRINGING = 1.0 - global.quality;
float SATURATION = 1.0 - global.bw;
// prevent some very slight clipping that happens at 1.0
const float BRIGHTNESS = 0.95;
vec3 col = texture(Source, vTexCoord).rgb; vec3 col = texture(Source, vTexCoord).rgb;
vec3 yiq = rgb2yiq(col); vec3 yiq = rgb2yiq(col);
@ -87,4 +84,4 @@ void main()
yiq *= mix_mat; // Cross-talk. yiq *= mix_mat; // Cross-talk.
yiq.yz *= vec2(i_mod, q_mod); // Demodulate. yiq.yz *= vec2(i_mod, q_mod); // Demodulate.
FragColor = vec4(yiq, 1.0); FragColor = vec4(yiq, 1.0);
} }

View file

@ -33,8 +33,6 @@ layout(location = 0) in vec2 vTexCoord;
layout(location = 0) out vec4 FragColor; layout(location = 0) out vec4 FragColor;
layout(set = 0, binding = 2) uniform sampler2D Source; layout(set = 0, binding = 2) uniform sampler2D Source;
float phase = (global.OriginalSize.x > 300.0) ? 2.0 : 3.0;
const mat3 yiq2rgb_mat = mat3( const mat3 yiq2rgb_mat = mat3(
1.0, 0.956, 0.6210, 1.0, 0.956, 0.6210,
1.0, -0.2720, -0.6474, 1.0, -0.2720, -0.6474,
@ -184,6 +182,7 @@ const float chroma_filter_3_phase[25] = float[25](
void main() void main()
{ {
float phase = (global.OriginalSize.x > 300.0) ? 2.0 : 3.0;
float one_x = global.SourceSize.z; float one_x = global.SourceSize.z;
vec3 signal = vec3(0.0); vec3 signal = vec3(0.0);
@ -218,4 +217,4 @@ void main()
FragColor = vec4(rgb, 1.0); FragColor = vec4(rgb, 1.0);
if(global.linearize < 0.5) return; if(global.linearize < 0.5) return;
else FragColor = pow(FragColor, vec4(2.2)); else FragColor = pow(FragColor, vec4(2.2));
} }