slang-shaders/ntsc/shaders/maister/ntsc-pass1-encode-demodulate.inc

20 lines
543 B
PHP
Raw Normal View History

2016-07-13 14:38:02 +10:00
vec3 col = texture(Source, vTexCoord).rgb;
vec3 yiq = rgb2yiq(col);
#if defined(TWO_PHASE)
2016-07-14 04:59:27 +10:00
float chroma_phase = PI * (mod(pix_no.y, 2.0) + global.FrameCount);
2016-07-13 14:38:02 +10:00
#elif defined(THREE_PHASE)
float chroma_phase = 0.6667 * PI * (mod(pix_no.y, 3.0) + global.FrameCount);
#endif
float mod_phase = chroma_phase + pix_no.x * CHROMA_MOD_FREQ;
float i_mod = cos(mod_phase);
float q_mod = sin(mod_phase);
yiq.yz *= vec2(i_mod, q_mod); // Modulate.
yiq *= mix_mat; // Cross-talk.
yiq.yz *= vec2(i_mod, q_mod); // Demodulate.
2016-07-14 04:59:27 +10:00
FragColor = vec4(yiq, 1.0);
2016-07-13 14:38:02 +10:00