bible-strong-avatar-lab/examples/portfolio-gallery/davebot-gaze.html
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

56 lines
1.9 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="theme-color" content="#f6f6f6" />
<title>Davebot gaze lab - tune how hard he looks at the cursor</title>
</head>
<body>
<div class="shell">
<header>
<h1>Davebot gaze lab</h1>
<p>
Move the cursor anywhere on the page. Davebot's eyes point at it, and the settings on the
right change how hard he locks on. Values save as you drag, and the portfolio header reads
the same values, so tune here and reload that page to see it in place.
</p>
</header>
<div class="layout">
<main>
<section class="stage" id="stage" aria-label="Davebot at review size"></section>
<section class="scales" id="scales" aria-label="Davebot at shipping size"></section>
</main>
<aside class="panel">
<h2>Feel</h2>
<div class="presets" id="presets"></div>
<div id="controls"></div>
<div class="meter">
<div class="meter-head">
<span>Deflection</span>
<span id="deflection-value">0%</span>
</div>
<div class="bar" id="deflection-bar"></div>
<div class="meter-head meter-sub">
<span>Clip headroom</span>
<span id="headroom-value">&mdash;</span>
</div>
</div>
<div class="actions">
<button type="button" id="copy">Copy JSON</button>
<button type="button" id="reset">Reset</button>
</div>
<pre><code id="settings-json"></code></pre>
</aside>
</div>
<footer>Design System 01 &middot; gaze tuning &middot; values persist locally</footer>
</div>
<script type="module" src="/src/davebot-gaze-main.ts"></script>
</body>
</html>