Integrate hand fingertip force overlays

This commit is contained in:
lenn
2026-07-07 09:43:25 +08:00
parent c4bccc1747
commit a04b903e96
11 changed files with 409 additions and 164 deletions

View File

@@ -478,8 +478,8 @@ fn fs_hand_membrane(in: HandMembraneVertexOutput) -> @location(0) vec4f {
let bevel_highlight = vec3f(0.48, 1.00, 1.00);
let bevel_dark_color = vec3f(0.004, 0.035, 0.060);
let dot_color = vec3f(0.08, 0.48, 0.58);
let pressure_green = vec3f(0.01, 0.78, 0.23);
let pressure_hot_color = vec3f(0.20, 1.00, 0.42);
let pressure_color = dot_color;
let pressure_hot_color = dot_color;
let color = extrusion_color * extrusion * 0.90
+ extrusion_edge_color * extrusion * halo_shape * 0.32
@@ -492,7 +492,7 @@ fn fs_hand_membrane(in: HandMembraneVertexOutput) -> @location(0) vec4f {
+ bevel_highlight * shell_sheen * 0.28
+ rim_color * halo * 0.16
+ dot_color * dots * 0.68
+ pressure_green * dots * pressure * 0.82
+ pressure_color * dots * pressure * 0.82
+ pressure_hot_color * dots * pressure_hot * 0.90;
let alpha = clamp(
@@ -583,13 +583,13 @@ fn vs_hand_palm_chip(vertex: DotVertexInput, instance: DotInstanceInput) -> Hand
@fragment
fn fs_hand_palm_chip(in: HandPalmChipVertexOutput) -> @location(0) vec4f {
// Inactive palm matrix: only independent dots, with no filled patch underneath.
let panel = rounded_rect_alpha(in.local, 0.11, 0.040);
let inner = rounded_rect_alpha(in.local * vec2f(1.08, 1.08), 0.09, 0.052);
let panel = rounded_rect_alpha(in.local, 0.16, 0.050);
let inner = rounded_rect_alpha(in.local * vec2f(1.03, 1.03), 0.13, 0.062);
let uv = clamp(in.local * 0.5 + vec2f(0.5, 0.5), vec2f(0.0, 0.0), vec2f(1.0, 1.0));
let patch_mask = smoothstep(0.0, 0.36, inner) * panel;
let grid = max(in.grid * 1.70, vec2f(1.0, 1.0));
let grid = max(in.grid * 1.42, vec2f(1.0, 1.0));
let cell_uv = fract(uv * grid) - vec2f(0.5, 0.5);
let dot_dist = length(cell_uv);
let dot_aa = max(fwidth(dot_dist) * 1.5, 0.008);
@@ -607,8 +607,8 @@ fn fs_hand_palm_chip(in: HandPalmChipVertexOutput) -> @location(0) vec4f {
let pressure_hot = (1.0 - smoothstep(0.02, 0.14, pressure_dist)) * patch_mask;
let idle_dot_color = vec3f(0.18, 0.32, 0.38);
let active_dot_color = vec3f(0.02, 0.88, 0.34);
let hot_dot_color = vec3f(0.28, 1.00, 0.52);
let active_dot_color = idle_dot_color;
let hot_dot_color = idle_dot_color;
let dot_color = mix(idle_dot_color, active_dot_color, pressure);
@@ -633,7 +633,7 @@ fn vs_hand_palm_dot(vertex: DotVertexInput, instance: DotInstanceInput) -> DotVe
// Palm chip pixels are deliberately smaller than fingertip beads so they read as a chip matrix.
let center = hand_image_uv_to_clip(instance.world_position.xy);
let pixel_size = u.glyph.x * mix(0.13, 0.25, shaped);
let pixel_size = u.glyph.x * mix(0.16, 0.30, shaped);
let ndc_offset = vertex.local * vec2f(pixel_size / u.viewport.x, pixel_size / u.viewport.y) * 2.0;
var out: DotVertexOutput;