Skip to content

cockpit torso: fix upside-down /torso-live and /torso-map (Y-up rotation)#58

Merged
AdaWorldAPI merged 1 commit into
mainfrom
claude/torso-shading
Jun 24, 2026
Merged

cockpit torso: fix upside-down /torso-live and /torso-map (Y-up rotation)#58
AdaWorldAPI merged 1 commit into
mainfrom
claude/torso-shading

Conversation

@AdaWorldAPI

Copy link
Copy Markdown
Owner

What

Follow-up to #57 (merged). After #57 landed, the live three.js views rendered upside down/torso-live (the filled mesh) and /torso-map (the picker). /torso (the pre-rendered turntable) was fine.

Why

The decode rotated the BodyParts3D model with (x,y,z) -> (x,-z,y). The Rust preview driver (which renders /torso's frames) compensates with a screen-space Y-flip, so its output is head-up. But three.js uses standard Y-up with no such flip, so the same decode renders the body inverted.

Fix

Use (x,y,z) -> (-x, z, y) instead — a proper rotation (det +1):

  • Stands the body head-up in three.js Y-up (model +Z superior → world +Y up).
  • det +1 means triangle winding and gl_FrontFacing are unchanged, so the mesh's two-sided Phong lighting stays correct (a naive Y-negate would be a reflection and break winding).
  • Not a mirror — anatomically correct.

Applied to all three three.js views (TorsoMesh, TorsoSplat, TorsoMap). The preview driver and the /torso turntable frames were re-rendered to the same orientation, so all four views now agree.

Verification

  • Rendered the corrected orientation via the preview driver → confirmed head-up, upright, no mirror (clean side profile + posterior views; detailed skull).
  • tsc --noEmit clean; cockpit npm run build green.
  • Diff is the 3 view decoders (16 insertions / 12 deletions) + 20 re-rendered turntable frames.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TzqvDqbFRzyx17EkLKBoZF


Generated by Claude Code

/torso-live and /torso-map rendered head-down: the decode used (x,y,z)->(x,-z,y),
which the Rust preview driver compensated with a screen-space Y-flip, but three.js
uses standard Y-up with no flip -> inverted. Replace with (x,y,z)->(-x,z,y): a
PROPER rotation (det +1, so triangle winding + gl_FrontFacing stay correct, no
mirror) that stands the body head-up in three.js Y-up (model +Z superior -> +Y up).
Applied to all three three.js views (mesh, surfels, map); the preview driver +
/torso turntable frames re-rendered to the same orientation so all four agree.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TzqvDqbFRzyx17EkLKBoZF
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@AdaWorldAPI, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 28 minutes and 30 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d715f616-39de-4f66-a68e-e8a42002a94c

📥 Commits

Reviewing files that changed from the base of the PR and between 092fdc9 and 034957f.

⛔ Files ignored due to path filters (20)
  • cockpit/public/torso-frames/torso_000.png is excluded by !**/*.png
  • cockpit/public/torso-frames/torso_001.png is excluded by !**/*.png
  • cockpit/public/torso-frames/torso_002.png is excluded by !**/*.png
  • cockpit/public/torso-frames/torso_003.png is excluded by !**/*.png
  • cockpit/public/torso-frames/torso_004.png is excluded by !**/*.png
  • cockpit/public/torso-frames/torso_005.png is excluded by !**/*.png
  • cockpit/public/torso-frames/torso_006.png is excluded by !**/*.png
  • cockpit/public/torso-frames/torso_007.png is excluded by !**/*.png
  • cockpit/public/torso-frames/torso_008.png is excluded by !**/*.png
  • cockpit/public/torso-frames/torso_009.png is excluded by !**/*.png
  • cockpit/public/torso-frames/torso_010.png is excluded by !**/*.png
  • cockpit/public/torso-frames/torso_011.png is excluded by !**/*.png
  • cockpit/public/torso-frames/torso_012.png is excluded by !**/*.png
  • cockpit/public/torso-frames/torso_013.png is excluded by !**/*.png
  • cockpit/public/torso-frames/torso_014.png is excluded by !**/*.png
  • cockpit/public/torso-frames/torso_015.png is excluded by !**/*.png
  • cockpit/public/torso-frames/torso_016.png is excluded by !**/*.png
  • cockpit/public/torso-frames/torso_017.png is excluded by !**/*.png
  • cockpit/public/torso-frames/torso_018.png is excluded by !**/*.png
  • cockpit/public/torso-frames/torso_019.png is excluded by !**/*.png
📒 Files selected for processing (3)
  • cockpit/src/TorsoMap.tsx
  • cockpit/src/TorsoMesh.tsx
  • cockpit/src/TorsoSplat.tsx

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@AdaWorldAPI AdaWorldAPI merged commit 6c2eed9 into main Jun 24, 2026
4 checks passed
AdaWorldAPI pushed a commit that referenced this pull request Jun 24, 2026
…er toggles + transparency

Adds MY interactive cockpit viewer, additive to the other session's /torso* (#57/#58 —
their TorsoMesh/torso.mesh are untouched; main.tsx gains only one import + one route).

- cockpit_bake (new fma bin): bakes the full body → cockpit/public/fma_body.mesh, the
  same SPM1 wire the cockpit already decodes, but the per-vertex `opacity` byte carries a
  clean LAYER id (1 skin·2 muscle·3 organ·4 skeleton·5 vessel·6 nerve·7 connective·8 other)
  instead of a continuous alpha — so each layer can be toggled exactly. Color is the
  converged `tissue` byte (is_a); geometry is the BodyParts3D is_a OBJ set, vertex-cluster
  decimated (a Rust port of bake_torso_mesh.py's cluster_decimate). 329K verts, 745K tris.

- cockpit/src/FmaBody.tsx (new): loads /fma_body.mesh, renders the solid THREE.Mesh with
  the same (-x,z,y) upright decode as TorsoMesh (head-up), and a shader that gates each
  layer via uEnabled[9] (indexed by the vertex layer id) + a global alpha. UI: a button
  per layer (skin/muscle/organ/skeleton/vessel/nerve) toggling visibility, and a
  solid↔transparent switch. Skin off by default so the anatomy shows.

- cockpit/src/main.tsx: + route /fma-body (additive; /torso* unchanged).

- README: fix the v3 image (the removed dot-graph PNG → the skeleton render) and document
  cockpit_bake + /fma-body.

Verified: cockpit `npm run build` (tsc && vite build) is green (102 modules). The live
browser render was not exercised in this environment (no browser) — the component mirrors
the working TorsoMesh exactly and shares its decode, so it should render head-up on deploy.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GJ4NVBSjq1w5h7RmTbVafb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants