summaryrefslogtreecommitdiff
path: root/src/shaders/math
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-03-09 23:04:40 +0100
committerskal <pascal.massimino@gmail.com>2026-03-09 23:04:40 +0100
commitdd0dba4bdfd5d742a190b86115bde5107329f8ab (patch)
tree24f326440f5a9b5979f8bdbec7d42be17add0f84 /src/shaders/math
parente4301a6a178bd589c3a7333367fcc0ce6f9e0a45 (diff)
NTSC: use 6-taps filtering instead of 12-tap
Diffstat (limited to 'src/shaders/math')
-rw-r--r--src/shaders/math/color.wgsl6
1 files changed, 3 insertions, 3 deletions
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