"매 texture sampling 의 인접 texel이 unintended 하게 leak — atlas seam의 colored line으로 manifest.". 매 mipmap downsample / bilinear interpolation 매 texel boundary를 cross 하면서 발생. 매 sprite atlas, texture array, lightmap에서 매 visible artifact.
매 핵심
매 원인
Bilinear filter: 매 sample point 매 texel center 사이 → 인접 texel weighted.
Mipmap downsample: 매 box filter 매 atlas neighbor를 average.
UV precision: float precision 매 정확한 boundary 매 hit 못 함.
Anisotropic filtering: 매 large footprint → 매 더 많은 neighbor sampling.
매 manifestation
Sprite atlas: 매 sprite edge 매 인접 sprite color line.
Tilemap: 매 tile seam 매 dark/bright line.
Skybox cubemap: 매 face boundary 매 visible seam.
Lightmap: 매 chart boundary 매 dark crack.
매 응용 (해결책)
Padding (gutter): 매 sprite 사이 1-2px transparent / replicated edge.
Half-texel UV inset: UV 매 (0.5/W, 0.5/H) ~ (1 - 0.5/W, 1 - 0.5/H) 의 clamp.
CLAMP_TO_EDGE: wrap mode 매 repeat → clamp.
Conservative UV: 매 mesh UV 매 atlas region 의 inside 의 inset.
Mipmap-aware padding: 매 mip level 별 padding (1px → 2px → 4px).
💻 패턴
Half-texel inset (GLSL)
uniformvec2atlasSize;// e.g. (2048, 2048)uniformvec4spriteRect;// x, y, w, h in pixelsvec2sampleUV(vec2localUV){vec2halfTexel=0.5/atlasSize;vec2minUV=spriteRect.xy/atlasSize+halfTexel;vec2maxUV=(spriteRect.xy+spriteRect.zw)/atlasSize-halfTexel;returnmix(minUV,maxUV,localUV);}
기본값: 매 padding 2px + half-texel inset, 매 mipmap 매 사용 시 2 * (mip levels) px.
🔗 Graph
변형: Atlas Bleeding
응용: Texture Array
Adjacent: Mipmap
🤖 LLM 활용
언제: sprite atlas / tilemap / lightmap 매 visible seam, 매 mipmap 매 사용한 atlas, 매 cubemap face 경계 artifact.
언제 X: single texture (no atlas), 매 NEAREST filter 매 사용 + no mipmap, fully procedural texture.
❌ 안티패턴
Transparent padding alone: 매 bilinear가 transparent와 mix → 매 dark fringe.
Padding 너무 small: mip level 3+ 매 도달 시 여전히 leak.
Repeat wrap on atlas: 매 opposite edge 매 sample → 완전한 wrong color.
UV exactly at texel boundary: 매 float precision 의해 random side 매 sample.
Generate mipmap on packed atlas: 매 mip downsample 매 인접 sprite를 average → mid-mip levels artifact.