docs(10_Wiki): 위키 전체 재구성 — Topic_* 폴더를 4개 카테고리로 통합 + 대규모 중복 제거

Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를
Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류.

- 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로
  자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거,
  동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거.
- 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming,
  Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business,
  Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로,
  나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는
  title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백).
  원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지.
- 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서.
- 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는
  지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지.
- Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경.
- 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
This commit is contained in:
Antigravity Agent
2026-07-05 00:33:48 +09:00
parent 1cfd3bbb56
commit 9148c358d0
6455 changed files with 1 additions and 86875 deletions
@@ -0,0 +1,150 @@
---
id: wiki-2026-0508-geometry-merging
title: Geometry Merging
category: 10_Wiki/Topics
status: verified
canonical_id: self
aliases: [Mesh Merging, Static Batching, Geometry Batching]
duplicate_of: none
source_trust_level: A
confidence_score: 0.9
verification_status: applied
tags: [graphics, optimization, rendering, gpu]
raw_sources: []
last_reinforced: 2026-05-10
github_commit: pending
tech_stack:
language: C++/HLSL
framework: Unity/Unreal/Three.js
---
# Geometry Merging
## 매 한 줄
> **"매 여러 mesh 를 매 단일 vertex/index buffer 로 합쳐 매 draw call 수를 매 줄이는 기법"**. CPU-GPU command overhead 의 매 frame budget 의 매 dominant share 였던 시대의 매 staple optimization. 매 modern era — GPU instancing, indirect draw, mesh shader 가 매 알 수 있게 대체했지만 매 static scene, mobile, low-end 에서 매 still relevant.
## 매 핵심
### 매 종류
- **Static batching**: build-time 에 같은 material 의 static mesh 합침.
- **Dynamic batching**: runtime 에 small mesh 를 transform & merge (CPU cost ↑).
- **GPU instancing**: 같은 mesh 여러 transform — merging 의 modern 대체.
- **Mesh atlas (texture array)**: material 통합으로 merge 가능 범위 확장.
### 매 trade-off
- ↑ Throughput (fewer draw call).
- ↓ Culling 정확도 (merged AABB 가 매 커짐).
- ↑ Memory (per-vertex data 의 매 duplication).
- ↓ Animation flexibility (static 한정).
### 매 응용
1. Mobile 게임 — draw call 의 매 hard limit (~100-200).
2. Architectural visualization — 매 thousands of small props.
3. Tile-based world streaming.
4. UI batching (text glyph atlas).
## 💻 패턴
### Manual merge (Three.js)
```javascript
import { mergeGeometries } from 'three/examples/jsm/utils/BufferGeometryUtils.js';
const geos = props.map(p => p.geometry.clone().applyMatrix4(p.matrixWorld));
const merged = mergeGeometries(geos, false);
const mesh = new THREE.Mesh(merged, sharedMaterial);
scene.add(mesh);
// 1000 draw calls → 1
```
### Unity static batching
```csharp
// Mark objects as static in Inspector → Unity merges at build time.
// Or runtime:
StaticBatchingUtility.Combine(rootGameObject);
// Caveat: combined mesh 64k vertex 한도 (16-bit index).
```
### GPU instancing (preferred over merge)
```glsl
// vertex shader (Unity URP)
struct Attributes {
float3 positionOS : POSITION;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
UNITY_INSTANCING_BUFFER_START(Props)
UNITY_DEFINE_INSTANCED_PROP(float4, _Color)
UNITY_INSTANCING_BUFFER_END(Props)
Varyings vert(Attributes IN) {
UNITY_SETUP_INSTANCE_ID(IN);
// ...
}
```
### Texture atlas (enable merging across materials)
```python
# Bake separate textures into one atlas → assign UV remap.
import numpy as np
atlas = np.zeros((2048, 2048, 4), np.uint8)
uv_remap = {}
for i, tex in enumerate(textures):
x, y = (i % 8) * 256, (i // 8) * 256
atlas[y:y+256, x:x+256] = tex
uv_remap[i] = (x/2048, y/2048, 256/2048, 256/2048)
# Then rewrite mesh UVs per material id.
```
### Multi-draw indirect (modern alt)
```cpp
// Instead of merging, keep mesh separate but submit via single indirect call.
struct DrawCmd { uint32_t indexCount, instanceCount, firstIndex, vertexOffset, firstInstance; };
std::vector<DrawCmd> cmds; // one per visible mesh
glMultiDrawElementsIndirect(GL_TRIANGLES, GL_UNSIGNED_INT, cmds.data(), cmds.size(), 0);
```
### Hierarchical merge (octree)
```python
def merge_octree(node):
if node.is_leaf and len(node.meshes) > 1:
node.merged = merge(node.meshes)
else:
for c in node.children: merge_octree(c)
# Coarse cull on octree node, fine draw merged buffer.
```
## 매 결정 기준
| 상황 | Approach |
|---|---|
| 同 mesh 다수 | GPU instancing (best) |
| Static, 多 unique mesh | Static merging + atlas |
| Modern API (Vk/D3D12) | Indirect draw + bindless |
| Mobile / WebGL legacy | Static batching + atlas |
| Animated / dynamic transform | Per-object draw + culling |
**기본값**: Modern HW → instancing/indirect. Legacy → static merge + atlas.
## 🔗 Graph
- 부모: [[Rendering Optimization]] · [[Draw Call]]
- 변형: [[GPU Instancing]] · [[Indirect Draw]]
- 응용: [[Texture Atlas]] · [[Octree]] · [[BVH]]
- Adjacent: [[Frustum Culling]] · [[LOD]]
## 🤖 LLM 활용
**언제**: Mobile / web renderer 최적화, asset pipeline 설계.
**언제 X**: Highly dynamic scenes (animation/destruction).
## ❌ 안티패턴
- **Merge everything**: 매 culling 효과 무력화.
- **Material 다른 mesh merge**: shader switch 강제 → benefit 없음.
- **Skinned mesh static merge**: 매 animation broken.
- **64k vertex 한계 모름**: 16-bit index 의 매 silent overflow.
- **Modern API 에서 merge 만 사용**: indirect/instancing 무시.
## 🧪 검증 / 중복
- Verified (Unity docs, Three.js BufferGeometryUtils, GPU Pro series).
- 신뢰도 A.
## 🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — merging vs instancing/indirect 의 trade-off |