"매 매 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).
매 응용
2D game sprite (Phaser, Pixi.js).
3D static prop (Unreal lightmap atlas).
Font (signed-distance-field atlas).
UI icon system.
💻 패턴
Pattern 1: 매 atlas 의 build (offline, TexturePacker / 매 자체)
// 매 자체 packer 매 simple max-rects
import{MaxRectsPacker}from'maxrects-packer';constpacker=newMaxRectsPacker(2048,2048,2/* padding */);constinputs=[{width: 64,height: 64,name:'icon-a'},{width: 128,height: 96,name:'icon-b'},// ...
];packer.addArray(inputs);constatlasJson=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
// 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)
// fragment shader 매 매 distance field 의 alpha 의 deriveinvec2vUv;uniformsampler2DuMsdf;floatmedian(vec3v){returnmax(min(v.r,v.g),min(max(v.r,v.g),v.b));}outvec4fragColor;voidmain(){vec3s=texture(uMsdf,vUv).rgb;floatd=median(s)-0.5;floatalpha=smoothstep(-0.05,0.05,d);fragColor=vec4(1.0,1.0,1.0,alpha);}
Pattern 5: 매 array texture 매 atlas alternative (WebGL2)
consttex=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
언제: 매 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.