summaryrefslogtreecommitdiff
path: root/src/effects/ntsc_yiq.wgsl
blob: 854620bea35f0bcdfc7274a71e68ac52a469d241 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// NTSC post-process effect (YIQ input): fisheye distortion, scanlines, color bleeding.
// Input texture already stores luma/chroma/phase (e.g. from RotatingCube output).
#include "sequence_uniforms"
#include "render/fullscreen_uv_vs"
#include "math/noise"
#include "math/color"
#include "math/color_c64"
#include "debug/debug_print"

@group(0) @binding(0) var input_sampler: sampler;
@group(0) @binding(1) var input_texture: texture_2d<f32>;
@group(0) @binding(2) var<uniform> uniforms: UniformsSequenceParams;

// YIQ input: texture already stores luma/chroma/phase — pass through directly
fn sample_ntsc_signal(uv: vec2f) -> vec4f {
  return textureSample(input_texture, input_sampler, uv);
}

#include "render/ntsc_common"

@fragment fn fs_main(in: VertexOutput) -> @location(0) vec4f {
  var col = render_ntsc(in.st);
  col = debug_f32(col, in.position.xy / 2., vec2f(100., 75.), uniforms.beat_time);
  col = debug_str(col, in.position.xy / 2., vec2f(100., 150.), vec4u(0x48656C6Cu, 0x6F000000u, 0u, 0u), 5u);
  return col;
}