summaryrefslogtreecommitdiff
path: root/src/effects/ntsc_rgb.wgsl
blob: c377d4703b4cef81d5b750082aa688a3ee772f5a (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
// NTSC post-process effect (RGB input): fisheye distortion, scanlines, color bleeding.
// Input texture is in RGB color space; converted to YIQ for NTSC processing.
#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;

// RGB input: sample texture and convert to luma/chroma/phase
fn sample_ntsc_signal(uv: vec2f) -> vec4f {
  let rgba = textureSample(input_texture, input_sampler, uv);
  return rgba_to_luma_chroma_phase(rgba, uv.y, YSIZE);
}

#include "render/ntsc_common"

@fragment fn fs_main(in: VertexOutput) -> @location(0) vec4f {
  return render_ntsc(in.st);
}