Documentation / Node reference / code nodes
code/TextureTexel
Reads one pixel of a texture, at the pixel this tex/Builder is writing.
Texture
Connect a texture, from a code/TextureInput (a picture wired into the tex/Builder) or a code/Param set to NodePath, and this node reads it at the pixel being written, exactly, with no blending. Move the read with offsetX and offsetY, in whole pixels: an offset of 1, 0 reads the pixel to the right, 0, -1 the pixel above, -1, 1 the one down and to the left. Nine of these nodes read a pixel and its eight neighbours, which is what a blur, an edge detector or a reaction-diffusion step needs.
In a 3D tex/Builder, a 3D texture is read at the voxel being written, and offsetZ moves the read along z as well: 27 of these nodes read a voxel and its 26 neighbours. A 2D picture in a 3D builder is read at the voxel's x and y, the same on every slice, and offsetZ is not used. A 2D builder cannot read a 3D texture: the build is refused with a message.
borderMode says what is read past the edge of the texture, on each axis. CLAMP repeats the edge pixels. TRANSPARENT reads transparent black. REPEAT reads the opposite side, so a picture that tiles keeps tiling, which a simulation on a tile needs. MIRROR reads the picture flipped at its edge.
A picture from code/TextureInput comes out in linear light, whatever it holds. The pixel is counted in the tex/Builder's own picture, so when input 0 is wired the two are the same size and pixel for pixel. A texture of another size is read pixel for pixel from its corner, unless stretch is on: it is then stretched over the whole picture, and the pixels around the place read are blended, so a small map, even of one pixel, covers a large picture. To read at any uv, use code/TextureSample2D, or code/TextureSample3D for a 3D texture.
Parameters
| Name | Type | What it does |
|---|---|---|
| offsetX | SInt32 | How many pixels to the right of the pixel being written to read. Negative reads to the left. |
| offsetY | SInt32 | How many pixels below the pixel being written to read. Negative reads above. |
| offsetZ | SInt32 | How many voxels further along z than the voxel being written to read, in a 3D texture. Negative reads nearer. Greyed out when the texture is a 2D picture, which has no z. |
| borderMode | UInt8 CLAMP · TRANSPARENT · REPEAT · MIRROR | What is read past the edge of the texture. CLAMP: the edge pixels repeat. TRANSPARENT: transparent black. REPEAT: the opposite side of the texture, for a picture that tiles. MIRROR: the picture flipped at its edge. |
| stretch | Bool | Off: the texture is read pixel for pixel, from its corner, whatever its size. On: a texture of another size is stretched over the whole picture, blending its pixels around the place read; the offsets then count the texture's own pixels. A texture of the picture's size reads the same either way. |
See also
- code/TextureInput
- code/TextureSample2D
- code/TextureSample3D
- tex/Builder
This page is generated from the engine, so it describes the release you can download. The same text is in the editor's Help panel next to the node itself.