summaryrefslogtreecommitdiff
path: root/src/effects
diff options
context:
space:
mode:
Diffstat (limited to 'src/effects')
-rw-r--r--src/effects/ntsc.wgsl2
-rw-r--r--src/effects/rotating_cube.wgsl11
2 files changed, 9 insertions, 4 deletions
diff --git a/src/effects/ntsc.wgsl b/src/effects/ntsc.wgsl
index e0182f3..3ee02bc 100644
--- a/src/effects/ntsc.wgsl
+++ b/src/effects/ntsc.wgsl
@@ -140,7 +140,7 @@ fn randomized_f32(p: vec2f, t: f32) -> f32 {
var col = yiqa_to_rgba(signal);
// Slight NTSC warm tint (boost red/green, attenuate blue)
col *= vec4f(1.04, 1.01, .94, 1.);
-// col = Dither(col, uv, XSIZE, YSIZE);
+// col = dither_c64(col, uv, XSIZE, YSIZE);
let border_col = get_border_c64(uv, uniforms.beat_time, YSIZE);
diff --git a/src/effects/rotating_cube.wgsl b/src/effects/rotating_cube.wgsl
index 0c75a13..abd584c 100644
--- a/src/effects/rotating_cube.wgsl
+++ b/src/effects/rotating_cube.wgsl
@@ -1,4 +1,8 @@
// Rotating cube shader v2 (simplified, no masking)
+// output to YIQ color space
+
+#include "math/color"
+#include "math/color_c64"
struct Uniforms {
view_proj: mat4x4f,
@@ -76,8 +80,9 @@ fn get_cube_normal(vid: u32) -> vec3f {
return VSOut(clip_pos, world_pos.xyz, world_normal);
}
-@fragment fn fs_main(@location(0) world_pos: vec3f, @location(1) normal: vec3f) -> @location(0) vec4f {
- let N = normalize(normal);
+@fragment fn fs_main(in: VSOut) -> @location(0) vec4f {
+ let screen_uv = in.pos.xy / uniforms.resolution;
+ let N = in.normal; // not re-normalized: cube faces are flat, no drift
let light_dir = normalize(vec3f(1.0, 1.0, 1.0));
let diffuse = max(dot(N, light_dir), 0.0);
@@ -85,5 +90,5 @@ fn get_cube_normal(vid: u32) -> vec3f {
let lighting = ambient + diffuse * 0.7;
let color = object.color.rgb * lighting;
- return vec4f(color, 1.0);
+ return rgba_to_luma_chroma_phase(vec4f(color, 1.0), screen_uv.y, 264.);
}