"매 N 장 의 동일 size texture 의 single bind". 매 GL_TEXTURE_2D_ARRAY 의 atlas 의 alternative 의 sub-texel bleed 의 X 의 mipmap-safe 의 layered access 의 enable. 매 2026 년 의 WebGPU 의 default storage 의 voxel terrain, sprite atlas, lookup table 의 standard.
매 핵심
매 vs Atlas
Atlas: 매 single 2D texture 의 grid. 매 mipmap 의 bleed problem.
Array texture: 매 layer 의 independent. 매 mipmap-safe. 매 single bind 의 N draw call 의 1 draw call 의 reduction.
매 제약
매 모든 layer 의 same size + same format.
매 max_array_layers (보통 2048) 의 hardware limit.
매 sampler 의 layer index 의 third coord (z) 로 access.
매 응용
Voxel/Minecraft-like terrain (block type → layer index).
Sprite animation (frame → layer).
LUT (lookup table) batch.
Instanced material variation.
ML inference의 batched feature map.
💻 패턴
WebGL2 array texture upload
constgl=canvas.getContext('webgl2');consttex=gl.createTexture();gl.bindTexture(gl.TEXTURE_2D_ARRAY,tex);constW=64,H=64,LAYERS=16;gl.texStorage3D(gl.TEXTURE_2D_ARRAY,1,gl.RGBA8,W,H,LAYERS);for(leti=0;i<LAYERS;i++){constpixels=loadLayer(i);// Uint8Array(W*H*4)
gl.texSubImage3D(gl.TEXTURE_2D_ARRAY,0,0,0,i,// x, y, layer offset
W,H,1,gl.RGBA,gl.UNSIGNED_BYTE,pixels);}gl.texParameteri(gl.TEXTURE_2D_ARRAY,gl.TEXTURE_MIN_FILTER,gl.LINEAR);
consttex=device.createTexture({size:[W,H,LAYERS],format:'rgba8unorm',usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST,dimension:'2d',// array via depthOrArrayLayers
});device.queue.writeTexture({texture:tex,origin:[0,0,layer]},pixels,{bytesPerRow:W*4},{width:W,height:H,depthOrArrayLayers:1});
import{DataArrayTexture,RGBAFormat,UnsignedByteType}from'three';constdata=newUint8Array(W*H*LAYERS*4);// fill data...
consttex=newDataArrayTexture(data,W,H,LAYERS);tex.format=RGBAFormat;tex.type=UnsignedByteType;tex.needsUpdate=true;material.uniforms.uBlocks.value=tex;
Mipmap generation
gl.bindTexture(gl.TEXTURE_2D_ARRAY,tex);gl.generateMipmap(gl.TEXTURE_2D_ARRAY);// → each layer mipmapped independently → no atlas-style bleed
언제: 매 shader code generation 의 boilerplate 의 GLSL/WGSL 의 sample. 매 LLM 의 layer index 의 binding 의 OK.
언제 X: 매 driver-specific 의 size limit 의 query 는 runtime 의 getParameter. 매 LLM 의 hardcode 의 X.
❌ 안티패턴
Mixed sizes의 attempt: 매 array texture 의 disqualify. 매 atlas 또는 bindless.
Layer count 의 over 2048: 매 split 의 multi-array-texture 또는 bindless.
Mipmap 의 atlas로: 매 bleed 의 inevitable. 매 array texture 의 fix.