uniformTexture
A fundamental node for passing a 2D image (Texture) from JavaScript to the shader, to be used as a color, data, or mask map.
Core Advantages
It greatly simplifies texture usage by automatically handling the underlying sampler2D declaration and binding, and allows for easy runtime texture swapping by modifying the .value property without recompiling the shader.
Common Uses
As a base color map (Albedo/Diffuse Map) to define surface patterns and colors.
Providing PBR data, such as normal maps and roughness maps, to enhance realism.
As a mask to control effect areas or blend multiple textures.
How to adjust
Adjust by performing math operations on the UV coordinates provided to the .sample() method in the node graph. For example, multiplying the UVs by a constant (`uv().mul(5)`) creates a tiling effect; adding a time-based value to the UVs creates a scrolling effect.
Code Examples
1// In JS: const textureNode = uniformTexture( myImageTexture );
2
3// In TSL, sample the texture with uv() coordinates to get the color
4material.colorNode = textureNode.sample( uv() );