Files
2nd/10_Wiki/Topics/Domain_Programming/AI_and_ML/Mipmap.md
T
Antigravity Agent c24165b8bc refactor(topics): 멀티 에이전트용 지식 재편 — _Common(공통 기본기) + Domain_* 구조
에이전트 8종(대화형/프로그래머 C·S/디자이너/설계자/기획자/QA/PD/PM)에게
[공통 기본 능력 + 롤별 Specialty] 2층으로 지식을 주입하기 위한 재분류.
문서 내용·포맷은 무수정, 폴더 이동만 (6,372개 문서 수 보존 확인).

- Topic_Programming → Domain_Programming (내부 구조 보존)
- Topic_Graphic → Domain_Design
- Topic_Business → Domain_Product
- Topic_General → Domain_General
- _Common 신설: Math(구 Topic_Math_Specialty), Reasoning(구 General/From_Thinking & Reasoning),
  Reasoning_Creativity(구 General/From_창의성), Communication(Poetic_Blog_Writing + From_writing)
- 타 도메인의 From_* 폴더는 유지 (출처 표기일 뿐, 이미 도메인에 맞게 분류된 문서)
- 빈 폴더 정리 (memory/procedures)
- 에이전트→폴더 매핑은 workspace의 .astra/agent-knowledge-map.json (9개 에이전트)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 11:05:56 +09:00

3.8 KiB
Raw Blame History

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
mipmap
MIP map
LOD pyramid
none A 0.9 applied
graphics
gpu
texture
lod
sampling
opengl
vulkan
2026-05-10 pending
language framework
glsl opengl-vulkan

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 선택.

매 필터링

  1. Nearest mip + nearest — 픽셀 단위 jitter.
  2. Nearest mip + linear (bilinear) — mip 경계에서 hard switch.
  3. Linear mip + linear (trilinear) — 두 mip level 사이 보간, 부드러움.
  4. Anisotropic — 비스듬한 표면에서 footprint 가 늘어진 방향으로 더 많은 샘플 → 경사면 텍스처 선명.

매 효과

  1. 멀리 있는 표면 aliasing/shimmering 제거.
  2. cache hit ↑ (작은 mip 이 caches 에 잘 맞음).
  3. 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

🤖 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