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

TextureLoader

Quick answer

TextureLoader loads images asynchronously and returns a Texture ready for material map, normalMap, or alphaMap slots. load() returns the texture immediately and fills it later, while loadAsync() resolves a promise once decoding finishes. Set colorSpace to SRGBColorSpace for color maps and RepeatWrapping for tiled surfaces.

Last verified 2026-11-03 · three.js 0.160.0 · Cite this page
new THREE.TextureLoader ( manager )
Key points
Example
const loader = new THREE.TextureLoader();
loader.setCrossOrigin('anonymous');
const colorMap = loader.load(
  '/textures/facade.jpg',
  function (texture) {
    texture.colorSpace = THREE.SRGBColorSpace;
    texture.anisotropy = renderer.capabilities.getMaxAnisotropy();
    console.log('贴图就绪', texture.image.width, texture.image.height);
  },
  undefined,
  function (error) {
    console.error('贴图加载失败', error);
  }
);

const material = new THREE.MeshStandardMaterial({
  map: colorMap,
  roughness: 0.7
});
const normalMap = await loader.loadAsync('/textures/facade-normal.jpg');
normalMap.wrapS = normalMap.wrapT = THREE.RepeatWrapping;
normalMap.repeat.set(4, 4);
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). TextureLoader. https://www.jingweizhi.com/en/three/api/texture-loader.html (accessed 2026-11-03).