From dd0dba4bdfd5d742a190b86115bde5107329f8ab Mon Sep 17 00:00:00 2001 From: skal Date: Mon, 9 Mar 2026 23:04:40 +0100 Subject: NTSC: use 6-taps filtering instead of 12-tap --- src/shaders/math/color.wgsl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/shaders/math/color.wgsl') diff --git a/src/shaders/math/color.wgsl b/src/shaders/math/color.wgsl index 0639bf7..f5f06f8 100644 --- a/src/shaders/math/color.wgsl +++ b/src/shaders/math/color.wgsl @@ -27,13 +27,13 @@ fn yiqa_to_rgba(yiq: vec4f) -> vec4f { // Convert RGBA to packed luma/chroma/phase signal for NTSC processing. // Returns vec4f(luma, chroma_level, phase/TAU, alpha). -// ysize: virtual scanline count (e.g. 33.*8.); drives 22.5-degree inter-line phase shift. +// ysize: virtual scanline count (e.g. 264 lines); drives 22.5-degree inter-line phase shift. fn rgba_to_luma_chroma_phase(rgba: vec4f, uv_y: f32, ysize: f32) -> vec4f { let yiq = rgba_to_yiqa(rgba); let chroma_level = length(yiq.yz); let mscanl = (uv_y * ysize) % 2.0; - let phase = atan2(yiq.y, yiq.z) - 0.3926991 + mscanl * 0.19634954; - return vec4f(yiq.x, chroma_level, phase / TAU_COLOR, yiq.a); + let phase = atan2(yiq.y, yiq.z) / TAU_COLOR - (1. - mscanl * 0.5) / 16.; + return vec4f(yiq.x, chroma_level, phase, yiq.a); } // sRGB to Linear approximation -- cgit v1.2.3