Commit Graph

2 Commits

Author SHA1 Message Date
David Lafond
0b7b0db7f6 Cap Davebot's gaze to the clip room left inside his head
The previous travel ceiling was derived from arithmetic on the neutral
pose and was wrong three times over. Measured from the rendered SVG
instead:

- The head is an ellipse rotated 84 degrees, not the axis-aligned box
  the arithmetic assumed.
- The engine's own expressions already displace and reshape the eyes
  before gaze is applied, swinging an eye centre from -52.7 to +48.6.
- The head drifts during playback, so it is not centred on the origin.

Together those left the worst-case safe travel at 21.9 units while the
default asked for 30, so the pupils crossed the silhouette on peak
expression frames. Relying on the clip to hide that is not acceptable:
a cut-off pupil reads as a rendering bug, not as anatomy.

Every frame now measures the head and both eyes from live geometry and
caps the reach to the room actually left, using the eye bounding box's
support function so the bound holds for any eye shape or rotation. The
convergence sign is re-derived per frame as well, because a sign cached
at setup eventually points outward and spends budget the clamp never
reserved.

Travel can now be raised to 48 safely; it simply spends more frames held
at the edge. Default stays 30, which is capped on 14% of frames against
33% at 36 and 81% at 48. Lock-on preset drops to 34 travel and leans on
its low depth knee instead.

Verified over 560 samples at travel 48, convergence 1 and smoothing 0:
zero outline points outside the silhouette, down from 5 breaches.
2026-08-24 22:55:22 -04:00
David Lafond
b5246b1f7f Add Davebot gaze lab and make his eyes lock on to the cursor
Gaze magnitude now comes from the angle to the pointer rather than a
linear distance ramp:

  gain = distance / hypot(distance, depth)

That is the projection of an eyeball rotating to face a target `depth`
away, so it saturates. Once the pointer passes the knee the eyes hold
near-full deflection and keep pointing straight at it, which is what
reads as being looked at. Measured angle error against the true cursor
direction is 0 degrees.

Default travel rises from 9 to 30 SVG units. The eye group is clipped to
the head silhouette and the outer eye edge sits 48 units from it, so 30
stays clear while the slider can explore up to the clip. At the shipping
46px render this moves the pupils 4.5 screen px instead of 1.4.

Extract the tracker into davebotGaze.ts and add davebot-gaze.html, a
tuning lab with live controls for travel, depth, smoothing, convergence
and lean. Settings persist, so the header reads whatever the lab last
saved. Sliders are generated from the engine's own limits and read back
its clamped values, so the panel cannot display a number the tracker is
not using.
2026-08-24 22:41:40 -04:00