From ff2ef5dfb86476bbea12b05f2659fc9528a57f5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=27=C3=A9lectron=20rare?= <108685187+electron-rare@users.noreply.github.com> Date: Fri, 26 Jun 2026 10:24:48 +0200 Subject: [PATCH] feat(viz): scene reacts to hand features Add hand_height/openness/speed/dist to SceneUniforms (struct now 24 floats, matching Python pack order). bg_fragment: dist-based zoom (all modes except hands3d) and post-dispatch color modulation (luminosity, bloom, turbulence driven by hand pose). --- data_only_viz/shaders/scene.metal | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/data_only_viz/shaders/scene.metal b/data_only_viz/shaders/scene.metal index 675fdf4..503109e 100644 --- a/data_only_viz/shaders/scene.metal +++ b/data_only_viz/shaders/scene.metal @@ -34,6 +34,10 @@ struct SceneUniforms { float hand_l_y; float hand_r_x; float hand_r_y; + float hand_height; + float hand_openness; + float hand_speed; + float hand_dist; float _pad0; float _pad1; }; @@ -454,6 +458,10 @@ fragment float4 bg_fragment(VsOut in [[stage_in]], p.x *= U.width / U.height; int mode = int(U.viz_mode + 0.5); + + // Mains ecartees -> leger zoom (sauf mode 8 qui pilote sa propre camera). + if (mode != 8) { p *= (1.0 - U.hand_dist * 0.2); } + float3 color; if (mode == 1) color = mode_tunnel(p, U); else if (mode == 2) color = mode_plasma(p, U); @@ -466,6 +474,11 @@ fragment float4 bg_fragment(VsOut in [[stage_in]], else if (mode == 9) color = mode_openpos(p, U); else color = mode_storm(p, U); + // Modulation expressive pilotee par les mains (subtile, tous les modes). + color *= (1.0 + U.hand_height * 0.6); // luminosite + color += U.hand_openness * 0.5 * color; // bloom / dispersion + color += U.hand_speed * 0.05 * sin(U.time * 8.0 + p.x * 10.0); // turbulence + // Flash global + vignette color += float3(U.lightning_flash * 1.2); color *= vignette(p);