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:
@@ -0,0 +1,148 @@
|
||||
---
|
||||
id: wiki-2026-0508-texture-atlas
|
||||
title: Texture Atlas
|
||||
category: 10_Wiki/Topics
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [P-Reinforce-AUTO-71CA1F, Sprite Sheet, Atlas, Texture Sheet]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.95
|
||||
verification_status: applied
|
||||
tags: [graphics, gpu, texture, draw-call, optimization]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
tech_stack:
|
||||
language: GLSL / TypeScript
|
||||
framework: Three.js / WebGL2 / Unity / Unreal
|
||||
---
|
||||
|
||||
# Texture Atlas
|
||||
|
||||
## 매 한 줄
|
||||
> **"매 매 sprite/material 의 별도 texture 의 X — 매 single big texture 의 sub-rect 의 share, 매 draw-call 의 batch"**. 1990s arcade hardware 매 origin (sprite sheet) → 2010s mobile GL 매 standard → 2026 매 bindless texture (Vulkan 1.3, WebGPU)+ virtual texturing 의 era. 매 atlas 매 매 still 매 fundamental.
|
||||
|
||||
## 매 핵심
|
||||
|
||||
### 매 4 motivation
|
||||
- **Draw-call reduction**: 매 same-material batch — 매 매 mobile GPU 매 critical.
|
||||
- **Texture switch cost**: 매 GPU 의 texture-binding 매 stall — 매 atlas 매 single bind.
|
||||
- **Cache locality**: 매 nearby UV 의 same memory page.
|
||||
- **Compression efficiency**: 매 큰 texture 의 BC7/ASTC 의 better ratio.
|
||||
|
||||
### 매 trade-off
|
||||
- **Bleeding**: 매 mipmap + 매 bilinear 매 인접 sub-rect 의 sample → 매 padding (2-4 px) 의 필요.
|
||||
- **Wrap mode**: 매 atlas 매 `REPEAT` 의 incompatible — 매 `CLAMP_TO_EDGE` 만.
|
||||
- **Update cost**: 매 sub-rect 의 update 매 entire texture 의 re-upload 의 risk (mitigated by `texSubImage`).
|
||||
|
||||
### 매 응용
|
||||
1. 2D game sprite (Phaser, Pixi.js).
|
||||
2. 3D static prop (Unreal lightmap atlas).
|
||||
3. Font (signed-distance-field atlas).
|
||||
4. UI icon system.
|
||||
|
||||
## 💻 패턴
|
||||
|
||||
### Pattern 1: 매 atlas 의 build (offline, TexturePacker / 매 자체)
|
||||
```ts
|
||||
// 매 자체 packer 매 simple max-rects
|
||||
import { MaxRectsPacker } from 'maxrects-packer';
|
||||
const packer = new MaxRectsPacker(2048, 2048, 2 /* padding */);
|
||||
const inputs = [
|
||||
{ width: 64, height: 64, name: 'icon-a' },
|
||||
{ width: 128, height: 96, name: 'icon-b' },
|
||||
// ...
|
||||
];
|
||||
packer.addArray(inputs);
|
||||
const atlasJson = packer.bins[0].rects.map((r) => ({
|
||||
name: r.data?.name, x: r.x, y: r.y, w: r.width, h: r.height,
|
||||
}));
|
||||
// 매 actual pixel composition 매 sharp / canvas 의 use
|
||||
```
|
||||
|
||||
### Pattern 2: 매 Three.js 매 sub-UV
|
||||
```ts
|
||||
import * as THREE from 'three';
|
||||
const atlas = new THREE.TextureLoader().load('/atlas.png');
|
||||
atlas.wrapS = atlas.wrapT = THREE.ClampToEdgeWrapping;
|
||||
|
||||
// rect: { x: 64, y: 0, w: 64, h: 64 } in 1024x1024 atlas
|
||||
const u0 = 64 / 1024, v0 = 0 / 1024;
|
||||
const du = 64 / 1024, dv = 64 / 1024;
|
||||
const geom = new THREE.PlaneGeometry(1, 1);
|
||||
geom.setAttribute('uv', new THREE.Float32BufferAttribute([
|
||||
u0, v0 + dv,
|
||||
u0 + du, v0 + dv,
|
||||
u0, v0,
|
||||
u0 + du, v0,
|
||||
], 2));
|
||||
```
|
||||
|
||||
### Pattern 3: 매 dynamic atlas (`texSubImage2D`)
|
||||
```ts
|
||||
// runtime 매 새 sprite 의 add (e.g., user avatar)
|
||||
gl.bindTexture(gl.TEXTURE_2D, atlasTex);
|
||||
gl.texSubImage2D(gl.TEXTURE_2D, 0, x, y, w, h, gl.RGBA, gl.UNSIGNED_BYTE, pixels);
|
||||
```
|
||||
|
||||
### Pattern 4: 매 SDF font atlas (msdfgen)
|
||||
```glsl
|
||||
// fragment shader 매 매 distance field 의 alpha 의 derive
|
||||
in vec2 vUv;
|
||||
uniform sampler2D uMsdf;
|
||||
float median(vec3 v) { return max(min(v.r,v.g),min(max(v.r,v.g),v.b)); }
|
||||
out vec4 fragColor;
|
||||
void main() {
|
||||
vec3 s = texture(uMsdf, vUv).rgb;
|
||||
float d = median(s) - 0.5;
|
||||
float alpha = smoothstep(-0.05, 0.05, d);
|
||||
fragColor = vec4(1.0, 1.0, 1.0, alpha);
|
||||
}
|
||||
```
|
||||
|
||||
### Pattern 5: 매 array texture 매 atlas alternative (WebGL2)
|
||||
```ts
|
||||
const tex = gl.createTexture();
|
||||
gl.bindTexture(gl.TEXTURE_2D_ARRAY, tex);
|
||||
gl.texImage3D(gl.TEXTURE_2D_ARRAY, 0, gl.RGBA8, 256, 256, layers, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
|
||||
// 매 layer 별 upload — 매 bleeding X, wrap OK, but 매 same size 의 require
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| 매 매 same size 의 sprite | Array texture (no bleed) |
|
||||
| 매 매 mixed size, mobile | Atlas + 2-4 px padding + CLAMP |
|
||||
| 매 매 procedural / runtime sprite add | Dynamic atlas + `texSubImage` |
|
||||
| 매 매 large unique texture (terrain) | Virtual / sparse texture |
|
||||
| 매 font | SDF / MSDF atlas |
|
||||
| 매 modern desktop / WebGPU | Bindless / array — atlas 의 less critical |
|
||||
|
||||
**기본값**: 2048x2048 atlas + 2px padding + CLAMP_TO_EDGE + offline packer (TexturePacker / sharp).
|
||||
|
||||
## 🔗 Graph
|
||||
- 응용: [[Draw Call]] · [[BatchedMesh 및 InstancedMesh 성능 벤치마크]]
|
||||
- Adjacent: [[Frustum Culling]] · [[Geometry Merging]] · [[Data Array Textures]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: 매 atlas layout 의 design (rect packing strategy), 매 padding/wrap bug 의 diagnose, 매 SDF shader 의 derivation.
|
||||
**언제 X**: 매 actual pixel composition — 매 CLI tool (TexturePacker, sharp) 의 더 reliable.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **매 padding 의 X** + 매 mipmap → 매 visible bleeding seam.
|
||||
- **매 atlas 의 `REPEAT` 의 expectation** — 매 sub-rect 매 wrap mode 의 incompatible.
|
||||
- **매 atlas 의 over-large** (> 4096 매 mobile) — 매 GPU memory + 매 fillrate cost.
|
||||
- **매 매 frame 매 atlas 의 rebuild** — 매 GPU upload cost 매 huge. 매 dirty-rect partial update.
|
||||
- **매 매 sprite 의 별도 atlas** — 매 batching 의 defeat 의 purpose.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (Real-Time Rendering 4e Ch.6, Three.js docs r170, msdfgen Chlumský 2017).
|
||||
- 신뢰도 A.
|
||||
- 중복 risk: [[Sprite Sheet]] (alias).
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — atlas motivation, packer/Three.js/SDF/array texture patterns 정리 |
|
||||
Reference in New Issue
Block a user