Atlaslog
Atlaslog / three.js / API reference / Texture
three.js · API reference

Texture

Quick answer

Texture represents a 2D image on the GPU and controls sampling through wrapS, wrapT, repeat, offset, filters, anisotropy, and colorSpace. Supply it to material slots such as map or normalMap, and mark color textures as SRGBColorSpace while data textures stay linear.

Last verified 2026-11-03 · three.js 0.160.0 · Cite this page
new THREE.Texture ( image , mapping , wrapS , wrapT , magFilter , minFilter , format , type , anisotropy , colorSpace ) → Texture
Key points
Example
const texture = new THREE.TextureLoader().load('/textures/ground.jpg');

texture.wrapS = THREE.RepeatWrapping;
texture.wrapT = THREE.RepeatWrapping;
texture.repeat.set(8, 8);
texture.anisotropy = renderer.capabilities.getMaxAnisotropy();
texture.colorSpace = THREE.SRGBColorSpace;
const canvas = document.createElement('canvas');
canvas.width = 512;
canvas.height = 512;
const ctx = canvas.getContext('2d');

ctx.fillStyle = '#15303f';
ctx.fillRect(0, 0, 512, 512);
ctx.strokeStyle = '#3f6c86';
for (let i = 0; i <= 512; i += 64) {
  ctx.beginPath();
  ctx.moveTo(i, 0);
  ctx.lineTo(i, 512);
  ctx.stroke();
}

const texture = new THREE.CanvasTexture(canvas);
texture.colorSpace = THREE.SRGBColorSpace;
Notes
Runnable examplesChinese originalAll API references
English edition written for Atlaslog. Code is taken from the original Chinese page and runs unchanged.
Cite this page

Atlaslog (2026). Texture. https://www.jingweizhi.com/en/three/api/texture.html (accessed 2026-11-03).