Repository navigation
Fit Lab: poke metric follows holdout margin, push-out and occlusion modes (#16) - #21
Conversation
…and occlusion modes Fixes #16. Pure rule in poke-rules.mjs with Node tests; README Measure section states the rule. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: edb0ab3fb6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const pokeMaterials = new Map(); // allowance in metres -> red body material shifted back by it | ||
| function pokeMaterial(allowance) { | ||
| const key = allowance.toFixed(4); | ||
| if (!pokeMaterials.has(key)) { const m = flat(0xff0000); m.onBeforeCompile = pushBack(allowance); pokeMaterials.set(key, m); } |
There was a problem hiding this comment.
Give each allowance shader a distinct program cache key
When measurements use different allowances—for example, a 1.6 cm skinned garment followed by a 1 cm rigid item—all callbacks returned by pushBack() have the same string representation. Three.js r160 uses onBeforeCompile.toString() as the default custom program cache key, so it reuses the first compiled shader, including that shader's embedded distance literal, for subsequent materials. Measurements after the first allowance therefore use the wrong depth offset; define a customProgramCacheKey containing the allowance or pass the distance through a uniform.
Useful? React with 👍 / 👎.
| const mode = fit.occlusion || 'clothing'; | ||
| if (mode === 'none') return { measure: false, mode, allowance: 0, faces: 'none' }; // renderer skips the holdout | ||
| const tolerance = mode === 'clothing' && fit.hide?.enabled ? (fit.hide.inward ?? 0.01) : 0; | ||
| const pushed = fit.bind !== 'rigid' && !NO_PUSH_OUT.has(info.part) && !NO_PUSH_OUT.has(info.slot); |
There was a problem hiding this comment.
Check the renderer part when disabling push-out
For mapped assets, info.part is the pack-specific code and info.slot is the UO equipment slot, while blender_build.py disables BODY_GAP using the mapping's canonical studio_part. Consequently, skinned items whose codes are not literally weapon, shield, bow, or quiver receive an erroneous 6 mm allowance here; the committed CC0 weapon-sword and shield-round entries are concrete examples. Include the canonical studio part in the manifest/rule input so the metric matches the build.
Useful? React with 👍 / 👎.
…t pack part code or layer name Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Correction (SM-16a, work/SM-16a 373c2d7): push-out is decided by
|
| slot | before | edb0ab3 | fixed |
|---|---|---|---|
| Neck | 437 | 388 | 62 |
| Hair | 333 | 256 | 86 |
| Helm | 308 | 308 | 289 |
| FacialHair | 301 | 139 | 3 |
| TwoHanded | 767 | 728 | 400 |
| Face | 73 | 65 | 14 |
| Gloves | 32 | 26 | 2 |
| OneHanded | 4 | 4 | 2 |
| Backpack, Arms, Waist | 0 | 0 | 0 |
| Other slots (Shirt 3747->445, Shoes 8727->871, OuterLegs 4659->1905, Pants 1014->237, OuterTorso 527->305, MiddleTorso 359->170, Cloak/InnerLegs/InnerTorso 0) are the same as the first table. Note: the first table's "after" column equals the fixed column, not edb0ab3 as committed; I could not reproduce those after-numbers from edb0ab3. |
Fixes #16.
Rule (README, Measure section; code in
tools/fit-lab/web/poke-rules.mjs)A body pixel counts as poke where the body shows in front of the item by more than an allowance:
HOLDOUT_MARGINin the installed canonical renderer'srender_uo_layer.py(workspace canonical-model pipeline), andblocked_pixelsintools/uo-content/occlusion.py. In clothing mode with Hide body on, the larger of the margin and Hide body inward.BODY_GAPin the same renderer file;tools/uo-content/blender_build.pysets it to 0 for rigid items and helm/weapon/shield/bow/quiver, and the rule does too. Added to the allowance as an upper bound; the push-out solver itself is not modelled.clothing= limb/head faces under the item,body= whole body ignoring Hide body,none= nothing counted.The body is pushed back by the allowance in the UO camera depth (same shader trick the preview cutout already used).
Before/after (cc0-starter, actions 0/2/4/9/16, 5 directions, slot totals, Measure "first" vs this branch)
Old baselines
Measure baselines live only in the open page (
state.baseline, never persisted), so they reset on reload; no stored baseline mixes old and new counts. A tab left open from before this change keeps old "first" numbers until reloaded.Verification
node --testin tools/fit-lab/web: 7 pass (5 new in poke-rules.test.mjs).PYTHONPATH=<worktree>, butspritemotionstill resolved to the main checkout'scommon/(the venv trap). This change touches no Python, so it doesn't matter here. No lease taken.tools/agents/run.py --check: up to date.🤖 Generated with Claude Code