--- id: wiki-2026-0508-skinnedmesh title: SkinnedMesh category: 10_Wiki/Topics status: verified canonical_id: self aliases: [P-Reinforce-AUTO-1189F7, Skinned Mesh, GPU Skinning] duplicate_of: none source_trust_level: A confidence_score: 0.93 verification_status: applied tags: [3d, graphics, animation, threejs, webgl] raw_sources: [] last_reinforced: 2026-05-10 github_commit: pending tech_stack: language: TypeScript framework: Three.js / WebGL2 --- # SkinnedMesh ## 매 한 줄 > **"매 mesh 의 vertex 가 매 bone weight 에 의해 deformed — single draw call 의 articulated character"**. 1990s SGI/PowerAnimator 의 skinning 매 origin → 2026 GPU compute shader 매 thousands-of-bones 매 real-time. Three.js `SkinnedMesh` 매 WebGPU compute path 매 standard. ## 매 핵심 ### 매 구성 요소 - **Mesh geometry**: vertex position + skin index (4 bones/vertex 매 typical) + skin weight. - **Skeleton**: bone hierarchy + bind matrix (rest pose inverse). - **Bone matrices**: world-space transform 매 per-bone, GPU 의 uniform buffer / data texture 의 upload. ### 매 GPU pipeline - Vertex shader 의 매 vertex 의 bone matrices 의 weighted blend 의 적용 → world-space pos. - Linear Blend Skinning (LBS) 매 default — 매 fast, 매 candy-wrapper artifact 의 risk. - Dual Quaternion Skinning (DQS) 매 alternative — 매 volume-preserving, 매 ~1.3x cost. ### 매 응용 1. Character animation (게임, AR/VR avatar). 2. Cloth/soft-body 의 partial rigging. 3. Procedural creature 의 spline-driven bones. ## 💻 패턴 ### Three.js 매 SkinnedMesh 생성 ```ts import * as THREE from 'three'; const geometry = new THREE.CylinderGeometry(0.3, 0.3, 4, 8, 8); // skinIndex / skinWeight buffer 의 attach const skinIndices: number[] = []; const skinWeights: number[] = []; for (let i = 0; i < geometry.attributes.position.count; i++) { const y = geometry.attributes.position.getY(i) + 2; // 0..4 const skinIndex = Math.floor(y); const skinWeight = y - skinIndex; skinIndices.push(skinIndex, skinIndex + 1, 0, 0); skinWeights.push(1 - skinWeight, skinWeight, 0, 0); } geometry.setAttribute('skinIndex', new THREE.Uint16BufferAttribute(skinIndices, 4)); geometry.setAttribute('skinWeight', new THREE.Float32BufferAttribute(skinWeights, 4)); // Bone hierarchy const bones: THREE.Bone[] = []; for (let i = 0; i <= 4; i++) { const b = new THREE.Bone(); b.position.y = i === 0 ? -2 : 1; if (i > 0) bones[i - 1].add(b); bones.push(b); } const skeleton = new THREE.Skeleton(bones); const mesh = new THREE.SkinnedMesh(geometry, new THREE.MeshStandardMaterial({ skinning: true } as any)); mesh.add(bones[0]); mesh.bind(skeleton); ``` ### 매 GLTF asset 매 load ```ts import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js'; const loader = new GLTFLoader(); const gltf = await loader.loadAsync('/models/character.glb'); const skinned = gltf.scene.getObjectByProperty('isSkinnedMesh', true) as THREE.SkinnedMesh; const mixer = new THREE.AnimationMixer(skinned); const action = mixer.clipAction(gltf.animations[0]); action.play(); ``` ### 매 GPU instancing 매 SkinnedMesh — `BatchedMesh` + skeleton texture ```ts // 2026 Three.js r170+ 의 InstancedSkinnedMesh const inst = new THREE.InstancedSkinnedMesh(geometry, material, 1000); inst.boundingSphere = new THREE.Sphere(new THREE.Vector3(), 5); // 매 per-instance 의 별도 skeleton bone matrix texture 의 upload ``` ### 매 LBS 매 vertex shader (GLSL) ```glsl mat4 skinMatrix = skinWeight.x * boneMatrix(skinIndex.x) + skinWeight.y * boneMatrix(skinIndex.y) + skinWeight.z * boneMatrix(skinIndex.z) + skinWeight.w * boneMatrix(skinIndex.w); vec4 skinned = skinMatrix * vec4(position, 1.0); gl_Position = projectionMatrix * modelViewMatrix * skinned; ``` ### 매 bone matrix 의 DataTexture 매 upload (large skeleton) ```ts const boneTexture = new THREE.DataTexture( new Float32Array(bones.length * 16), bones.length * 4, 1, THREE.RGBAFormat, THREE.FloatType, ); skeleton.boneTexture = boneTexture; // automatically updated ``` ## 매 결정 기준 | 상황 | Approach | |---|---| | Character < 256 bones, 단일 instance | uniform array bone matrices | | Character ≥ 256 bones, 매 mobile 의 uniform limit 의 hit | `boneTexture` (DataTexture) | | 매 large crowd (100+ chars) | `InstancedSkinnedMesh` + 매 per-instance skeleton texture | | 매 volume-preserving 의 deformation 의 필요 | DQS or 매 corrective shape keys | | 매 simple twist 매 only | Bend modifier or 매 spline-IK 의 fallback | **기본값**: GLTF + Three.js `SkinnedMesh` + LBS + `boneTexture` 의 mobile path. ## 🔗 Graph - 부모: [[Three.js]] · [[WebGL 20|WebGL2]] - Adjacent: [[BufferGeometry]] · [[BatchedMesh 및 InstancedMesh 성능 벤치마크]] ## 🤖 LLM 활용 **언제**: GLTF rigged character 의 import, 매 bone weight 의 painting 의 review, 매 skinning artifact 의 debug. **언제 X**: 매 static prop 의 transform — `Mesh` + matrix update 의 더 cheap. ## ❌ 안티패턴 - **매 vertex 별 매 8+ bone weight**: GPU 매 4-weight 의 standard. Excess bones 의 normalize + drop low-weight 의 필요. - **매 frame 별 `skeleton.update()` 의 manual call**: Three.js 매 already 매 auto. Redundant 의 cost. - **매 bone matrix 의 CPU-side recompute** 매 frame: bone hierarchy 의 dirty flag 의 활용. - **`SkinnedMesh.clone()` 의 후 매 same skeleton 의 share**: 매 separate `Skeleton.clone()` 의 필요 — else 매 모든 instances 매 같은 pose. ## 🧪 검증 / 중복 - Verified (Three.js docs r170, Khronos glTF 2.0 spec, Real-Time Rendering 4e Ch.4). - 신뢰도 A. - 중복 risk: [[GPU Skinning]] (alias). ## 🕓 Changelog | 날짜 | 변경 | |---|---| | 2026-05-08 | Phase 1 | | 2026-05-10 | Manual cleanup — SkinnedMesh의 components, GPU pipeline, instancing 정리 |