d8a80f6272
이름만 다른(표기 변형) [[위키링크]]를 대상 문서의 canonical 제목으로 치환해 끊겼던 1,200개 링크를 연결. 제목/파일명 정규화 일치만 적용하고 별칭 매칭은 과병합 위험으로 제외(애매성 가드). 원본은 _link_reconcile_backup/ 에 백업. 도구: Datacollect/scripts/link_reconcile_apply.mjs Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
3.8 KiB
3.8 KiB
id, title, category, status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, verification_status, tags, raw_sources, last_reinforced, github_commit, tech_stack
| id | title | category | status | canonical_id | aliases | duplicate_of | source_trust_level | confidence_score | verification_status | tags | raw_sources | last_reinforced | github_commit | tech_stack | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| wiki-2026-0508-mipmap | Mipmap | 10_Wiki/Topics | verified | self |
|
none | A | 0.9 | applied |
|
2026-05-10 | pending |
|
Mipmap
매 한 줄
"매 거리에 맞는 매 해상도". Mipmap 은 같은 텍스처를 1/2, 1/4, 1/8 … 로 미리 다운샘플해 둔 LOD 피라미드이며, 멀리 있는 픽셀이 작은 mip level 을 샘플링해 aliasing 과 메모리 대역폭을 동시에 줄인다.
매 핵심
매 동작 원리
- mip 0 = 원본 (e.g. 1024×1024), mip 1 = 512², mip 2 = 256², …, mip N = 1×1.
- 총 추가 메모리 = 원본의 약 33% (∑ 1/4ⁿ).
- 픽셀 footprint (∂u/∂x, ∂v/∂x …) → LOD λ 계산 → 적절 mip level 선택.
매 필터링
- Nearest mip + nearest — 픽셀 단위 jitter.
- Nearest mip + linear (bilinear) — mip 경계에서 hard switch.
- Linear mip + linear (trilinear) — 두 mip level 사이 보간, 부드러움.
- Anisotropic — 비스듬한 표면에서 footprint 가 늘어진 방향으로 더 많은 샘플 → 경사면 텍스처 선명.
매 효과
- 멀리 있는 표면 aliasing/shimmering 제거.
- cache hit ↑ (작은 mip 이 caches 에 잘 맞음).
- fillrate / bandwidth 감소 → 모바일 GPU 에 특히 큼.
💻 패턴
1. OpenGL mipmap 자동 생성
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
glGenerateMipmap(GL_TEXTURE_2D);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); // trilinear
2. Vulkan blit 으로 mip chain
for (uint32_t i = 1; i < mipLevels; i++) {
VkImageBlit blit{};
blit.srcOffsets[1] = { mipW, mipH, 1 };
blit.dstOffsets[1] = { mipW>1?mipW/2:1, mipH>1?mipH/2:1, 1 };
vkCmdBlitImage(cmd, img, SRC_OPT, img, DST_OPT, 1, &blit, VK_FILTER_LINEAR);
}
3. Anisotropic
GLfloat maxAniso;
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maxAniso);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, std::min(8.0f, maxAniso));
4. Shader 강제 LOD
vec4 c = textureLod(tex, uv, 2.0); // mip 2 강제
vec4 b = textureGrad(tex, uv, ddx, ddy);
5. LOD bias
vec4 c = texture(tex, uv, -0.5); // 한 단계 더 선명 (alias 위험)
6. Streaming / partial residency
- 전체 mip 중 큰 것은 disk, 작은 것만 GPU resident (Sparse texture / DirectStorage).
7. Pre-built KTX2 + BasisU
toktx --genmipmap --bcmp out.ktx2 input.png
오프라인 generate + GPU compressed format 으로 메모리 ↓.
매 결정 기준
| 상황 | 설정 |
|---|---|
| 일반 3D 씬 | Trilinear + Aniso 4-8x |
| 픽셀아트 / UI | mipmap off, nearest |
| 모바일 저사양 | Bilinear + Aniso 2x |
| 거대 월드 | Streaming + Sparse mip |
| Procedural noise | runtime mip 생성 또는 explicit LOD |
기본값: trilinear + aniso 4x, GPU 압축 (BC7/ASTC) + KTX2 로 사전 생성.
🔗 Graph
- Adjacent: Texture Compression, KTX2
🤖 LLM 활용
언제: filtering 차이 설명, 메모리 계산 (×1.33), shader API snippet 초안. 언제 X: 특정 GPU 의 anisotropic 품질/성능 측정 (실측 필요).
❌ 안티패턴
- mipmap off + 작게 그리기 → moiré/shimmer.
- non-POT 텍스처에 자동 mip + GL ES 2 — 일부 드라이버 문제.
- runtime
glGenerateMipmap매 프레임 — 첫 업로드 1회만. - UI atlas 에 mip 생성 — bleeding 으로 인접 셀 색상 침투.
🧪 검증 / 중복
- Verified. 신뢰도 A.
🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup |