All guides

How to Bind iChannel0 in Three.js

iChannel0 is a host-defined sampler name, not an automatically associated image. Load a texture, bind it to a uniform with the same name and match the shader sampler type. A labeled fixture with arrows is a useful first test for binding, orientation and filtering.

Fix the problem and environment

iChannel0 is a host-defined sampler name, not an automatically associated image. Load a texture, bind it to a uniform with the same name and match the shader sampler type. A labeled fixture with arrows is a useful first test for binding, orientation and filtering.

The controlling code

const texture=new THREE.TextureLoader().load('/fixture.png');
texture.wrapS=texture.wrapT=THREE.ClampToEdgeWrapping;
const uniforms={iChannel0:{value:texture}};
// In the fragment shader:
// uniform sampler2D iChannel0;
// gl_FragColor=texture2D(iChannel0,vUv);

Verify in order

Display the whole image with vUv before adding pixelation or refraction offsets. Follow the importer channel mapping on the host side as well as renaming GLSL variables.

Scope and common mistakes

Cube maps, video frames, audio data and Buffer A are not ordinary static 2D images; each requires a suitable upload and update path.

Continue experimenting

Reference

Official documentation

Run the related examples