適用:要真的人體解剖構造的 3D——認骨頭、肌肉、器官、血管、神經的位置與名稱,部位導覽,構造查詢,「找出肱骨」這種小測驗,衛教用的圖。
模型來自平台書架上的 BodyParts3D 4.3(全身 3,210 個網格、3,954 個構造),工具只載入用到的那幾個。不存資料。
只是示意的位置圖(例如抽血位置:一條手臂加幾個標記),用 three-d 的基本形狀就好。
先講清楚
- 模型已經在平台上:
https://platform.wanfangai.tw/lib/[email protected]/。不要下載 BodyParts3D、Open Anatomy Atlas、Z-Anatomy 的原始資料或執行它們的下載程式,不要把模型檔放進工具資料夾。院內電腦多半下載不到(約 185 MB、連日本的伺服器),平台已經切好放在書架上了(2026-11-07 團隊決定)。 - 這是成人男性的參考模型:不是病人的影像,沒有女性、兒童或個體差異;剖開或裁切的畫面不能說成 CT 或 MRI。
- 授權 CC BY 4.0:頁面上一定要有署名與修改說明(下面骨架的頁尾有現成文字),匯出的圖或列印版也要帶。
- 不存資料、不用 AI:測驗分數只留在這一頁,重新整理就沒了。使用者要記成績或名單,先跟他說要重新分級(會存資料),再看
form-app。
平台給的東西
- 目錄
catalog.json(約 2.2 MB):做工具的時候讀,用來挑構造;工具執行時不要載入整份目錄。 structures:每個構造的 FMA 編號id、英文名name、左右side、它包含的網格meshes、它屬於哪些上層構造part_of。meshes:每個網格的代號key、檔名file、所屬構造structure、類別category、左右、是否鏡射mirrored、頂點數vertices、索引數indices與型別index_type、大小bytes。categories:類別的英文與中文名、建議顏色。license:署名原文與修改說明。- 網格檔
m/<key>.bin:一個網格一個檔,中位數 23 KB;格式照下面的載入片段讀,不需要任何模型載入器。 - three.js 0.186.1 與 OrbitControls 也在書架上,照
three-d寫 import map。 - 座標已經整理好:Y 向上、+Z 是前面、+X 是病人的左邊,單位公尺。正面看的時候,病人的左邊在畫面右邊。
1. 挑構造(做工具時,在工作資料夾外)
- 用
wanfangai_list_libraries確認bodyparts3d的網址與版本。 - 把目錄抓到工作資料夾外(它不屬於工具),用英文名找候選,例如肱骨找
humerus、心臟找heart:
node -e "
const want = process.argv[1].toLowerCase();
fetch('https://platform.wanfangai.tw/lib/[email protected]/catalog.json').then((r) => r.json()).then((c) => {
const mesh = new Map(c.meshes.map((m) => [m.key, m]));
for (const s of c.structures.filter((s) => s.name && s.name.toLowerCase().includes(want))) {
const kb = s.meshes.reduce((n, k) => n + (mesh.get(k)?.bytes ?? 0), 0) / 1024;
console.log(s.id, '|', s.name, '|', s.side ?? '-', '|', s.meshes.length, 'meshes |', Math.round(kb), 'KB');
}
});" humerus- 跟使用者確認要哪幾個構造(左右、要不要周邊的構造)。用 FMA 編號與網格代號,不要憑名字猜。上層構造(例如
heart)的meshes已經包含它底下的網格,合併時去掉重複的。 - 把選好的網格寫進工具的
parts.js,每個網格一筆。欄位照目錄抄,zh是中文名:
// parts.js — 從平台目錄([email protected])挑的構造;中文名由(單位)審閱
export const PARTS = [
{ key: 'FJ3165', file: 'm/FJ3165.bin', vertices: 1234, indices: 6789, index_type: 'uint16',
structure: 'FMA…', name: 'left humerus', zh: '左肱骨', side: 'left', category: 'bone', mirrored: false },
];- 上面的代號與數字只是示意,一定照目錄裡查到的填。
- 中文名由使用者提供或確認。沒確認的保留英文,旁邊標「待審」;不要自己編拉丁文或臨床說明。
- 把選好的網格
bytes加總,告訴使用者大概多大。一個主題通常 1–15 MB;超過 30 MB,手機打開會慢,建議縮小主題或分成幾頁。
2. 骨架
<!doctype html>
<html lang="zh-Hant">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>上肢骨骼 3D|解剖學教材</title>
<style>
body { margin: 0; font-family: system-ui, sans-serif; }
.wrap { display: grid; grid-template-columns: minmax(0, 1fr) 320px; min-height: 100vh; }
#view { position: relative; min-height: 60vh; } #view canvas { display: block; width: 100%; height: 100%; touch-action: none; }
aside { padding: 16px; border-left: 1px solid #ddd; overflow-wrap: anywhere; }
@media (max-width: 760px) { .wrap { grid-template-columns: 1fr; } aside { border-left: 0; } }
#list button { display: block; width: 100%; margin: 4px 0; padding: 8px; font-size: 16px; text-align: left; }
#list button[aria-pressed="true"] { outline: 3px solid #f4a261; }
#status { position: absolute; left: 12px; top: 12px; background: #fffc; padding: 4px 8px; }
footer { font-size: 12px; color: #555; margin-top: 16px; }
</style>
<script type="importmap">{"imports":{"three":"https://platform.wanfangai.tw/lib/[email protected]/three.module.js","three/addons/":"https://platform.wanfangai.tw/lib/[email protected]/examples/jsm/"}}</script>
</head>
<body>
<div class="wrap">
<div id="view"><p id="status" role="status">模型載入中…</p></div>
<aside>
<h1>上肢骨骼 3D</h1>
<p>拖曳(手機用單指)轉動,滾輪或雙指縮放。點骨頭或下面的名稱看說明。</p>
<input id="find" type="search" placeholder="搜尋名稱(中文或英文)" aria-label="搜尋構造">
<div id="list"></div>
<button id="reset" type="button">全部顯示、回到正面</button>
<section id="info" aria-live="polite"><p>請選一個構造。</p></section>
<footer>
模型:BodyParts3D, © The Database Center for Life Science licensed under CC Attribution 4.0 International
(<a href="https://creativecommons.org/licenses/by/4.0/">授權條款</a>)。
本教材從 BodyParts3D 4.3 擷取上述構造,沿用 Open Anatomy Atlas 的座標整理,逐一切出並轉成教學用網格;標「鏡射」的是另一側的鏡射。
成人男性參考模型,不代表個體差異。教學用,不取代院內課程。審閱單位:(請填)|最後審閱:(請填)
</footer>
</aside>
</div>
<script type="module">
import * as THREE from 'three';
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
import { PARTS } from './parts.js';
const BASE = 'https://platform.wanfangai.tw/lib/[email protected]/';
const COLORS = { bone: '#e3dbc7', muscle: '#b83d38', artery: '#d91f21', vein: '#3857c7', nervous: '#f2d152', organ: '#cc8085', cartilage: '#a8ccdb', ligament: '#ccc494' };
// One mesh file: positions Float32×3, normals Int16×3 (normalised, padded to 4 bytes), indices.
async function loadMesh(p) {
const res = await fetch(BASE + p.file);
if (!res.ok) throw new Error(`${p.zh || p.name}:HTTP ${res.status}`);
const buf = await res.arrayBuffer();
const v = p.vertices;
const g = new THREE.BufferGeometry();
g.setAttribute('position', new THREE.BufferAttribute(new Float32Array(buf, 0, v * 3), 3));
g.setAttribute('normal', new THREE.BufferAttribute(new Int16Array(buf, v * 12, v * 3), 3, true));
const at = v * 12 + Math.ceil((v * 6) / 4) * 4;
const Index = p.index_type === 'uint16' ? Uint16Array : Uint32Array;
g.setIndex(new THREE.BufferAttribute(new Index(buf, at, p.indices), 1));
return g;
}
const view = document.getElementById('view');
const status = document.getElementById('status');
const scene = new THREE.Scene(); scene.background = new THREE.Color('#eef4f7');
const camera = new THREE.PerspectiveCamera(35, 1, 0.01, 100);
const renderer = new THREE.WebGLRenderer({ antialias: true }); renderer.setPixelRatio(Math.min(devicePixelRatio, 2));
view.appendChild(renderer.domElement);
scene.add(new THREE.HemisphereLight('#ffffff', '#8899aa', 1.3));
const sun = new THREE.DirectionalLight('#ffffff', 1.4); sun.position.set(1, 2, 3); scene.add(sun);
const controls = new OrbitControls(camera, renderer.domElement); controls.enableDamping = true;
// Everything in one group: moved and scaled as a whole, never one structure on its own.
const body = new THREE.Group(); scene.add(body);
const meshes = [];
let done = 0;
async function load() {
status.textContent = `模型載入中 0/${PARTS.length}`;
await Promise.all(PARTS.map(async (p) => {
const mat = new THREE.MeshStandardMaterial({ color: COLORS[p.category] ?? '#cccccc', roughness: 0.6 });
const m = new THREE.Mesh(await loadMesh(p), mat);
m.userData = p; body.add(m); meshes.push(m);
status.textContent = `模型載入中 ${++done}/${PARTS.length}`;
}));
frame(); status.hidden = true;
}
function frame() {
const box = new THREE.Box3().setFromObject(body);
const size = box.getSize(new THREE.Vector3()).length();
body.position.sub(box.getCenter(new THREE.Vector3()));
camera.position.set(0, 0, size * 1.6); controls.target.set(0, 0, 0); controls.update();
}
const info = document.getElementById('info');
const list = document.getElementById('list');
function label(p) { return `${p.zh || p.name}${p.zh ? `(${p.name})` : ''}${p.mirrored ? '・鏡射' : ''}`; }
function select(p) {
for (const m of meshes) m.material.emissive.set(m.userData === p ? '#553300' : '#000000');
for (const b of list.children) b.setAttribute('aria-pressed', String(b.dataset.key === p.key));
info.innerHTML = '';
const h = document.createElement('h2'); h.textContent = label(p); info.append(h);
const s = document.createElement('p'); s.textContent = `FMA:${p.structure}${p.side ? `|${p.side === 'left' ? '左側' : '右側'}` : ''}`; info.append(s);
}
for (const p of PARTS) {
const b = document.createElement('button'); b.type = 'button'; b.dataset.key = p.key;
b.textContent = label(p); b.onclick = () => select(p); list.append(b);
}
document.getElementById('find').addEventListener('input', (e) => {
const q = e.target.value.trim().toLowerCase();
for (const b of list.children) b.hidden = q !== '' && !b.textContent.toLowerCase().includes(q);
});
document.getElementById('reset').onclick = () => { for (const m of meshes) m.visible = true; frame(); };
// Click or tap a structure (a drag that turns the model is not a click).
const ray = new THREE.Raycaster(); const at = new THREE.Vector2(); let down = null;
renderer.domElement.addEventListener('pointerdown', (e) => { down = [e.clientX, e.clientY]; });
renderer.domElement.addEventListener('pointerup', (e) => {
if (!down || Math.hypot(e.clientX - down[0], e.clientY - down[1]) > 5) return;
const r = renderer.domElement.getBoundingClientRect();
at.set(((e.clientX - r.left) / r.width) * 2 - 1, -((e.clientY - r.top) / r.height) * 2 + 1);
ray.setFromCamera(at, camera);
const hit = ray.intersectObjects(meshes.filter((m) => m.visible))[0]; if (hit) select(hit.object.userData);
});
function resize() {
const w = view.clientWidth, h = view.clientHeight || 400;
renderer.setSize(w, h, false); camera.aspect = w / h; camera.updateProjectionMatrix();
}
addEventListener('resize', resize); resize();
renderer.setAnimationLoop(() => { controls.update(); renderer.render(scene, camera); });
load().catch((err) => {
status.textContent = `模型載入失敗:${err.message}。請重新整理再試一次。`;
});
</script>
</body>
</html>- 名稱清單、搜尋與 3D 點選要同步:點不準的人、用鍵盤或報讀軟體的人也選得到每一個構造。
- 沒有 WebGL 的電腦也要看得到名稱清單;載入中顯示進度,失敗顯示原因。不要用簡化的小人圖假裝模型已經載入。
- 測驗(「點出肱骨」):題目從
PARTS抽,點對或點錯當下回饋,錯的題目最後再列一次;分數只放在這一頁的變數裡。 - 頁尾的署名與修改說明不要刪;只列實際做的修改(沒有簡化就不要寫簡化)。列印版或截圖也要帶。
說「做好了」之前
- 發佈後打開:主控台沒有紅字、沒有被安全設定擋下的訊息;每個構造都載入(狀態列消失)、左右與相對位置正確(正面看時病人左側在畫面右邊)。
- 點構造與點清單都會選到同一個;搜尋找得到;「全部顯示、回到正面」有效;手機上單指能轉、雙指能縮放,拖曳不會被當成點選。
- 頁尾有署名、授權連結與修改說明。
- 確認不了的,不要說它已經可以用,改成請使用者打開確認哪幾項。
不要做
- 下載 BodyParts3D、Open Anatomy Atlas、Z-Anatomy 的資料,或把
.bin、.obj、.glb放進工具資料夾。 - 工具執行時連 GitHub、Wikipedia、Anatomography,或用 iframe 嵌入它們的網站。
- WebAssembly、Draco、背景執行緒解碼(平台的安全設定會擋)。
- 自己編 FMA 編號、中文名、拉丁文、臨床說明、審閱人或審閱日期。