Creating procedural patterns on a 3D surface, such as a torus, presents a specific challenge with value noise: the appearance of visible seams. Unlike hash noise, which can be tiled simply by taking the fractional part of coordinates, value noise blends between adjacent lattice points. To achieve a seamless wrap, the noise must be calculated such that the lattice points at the boundaries of one tile perfectly match the opposite side of the adjacent tile. This requires a specific logic to wrap the lattice coordinates before they are passed into the noise function.

This image illustrates the specific challenge of visible seams when applying value noise to a 3D surface like a torus.
The implementation involves a `lattice01` function that identifies the current and next lattice coordinates for a given point. To ensure seamless tiling, the logic checks if a coordinate falls outside the standard 0 to 1 range. If a coordinate is negative, it is shifted forward by the frequency; if it exceeds the frequency, it is shifted backward. This ensures that the lattice blocks at the boundaries are consistent across the tile edges. However, this method has specific constraints: the frequency must be a whole number to ensure lattice points align with the tile edges, and the tiling is only guaranteed to be seamless within a specific range (roughly one unit outside the 0–1 UV range).

This figure demonstrates the coordinate shifting logic used to align lattice blocks at the boundaries.

This image shows the spatial constraints of the seamless tiling logic described in the implementation details.

This figure illustrates the frequency constraints necessary to maintain seamless tiling across the geometry.
Furthermore, the technique introduces limitations regarding animation and frequency. For staggered animations to remain seamless, the frequencies used for the noise must be even numbers; otherwise, the time offsets for matching lattice points will mismatch. To support sliding animations without breaking the tiling, the implementation limits the UV offset to its fractional part. This ensures that the coordinates remain within the valid range where the tiling logic is functional. By combining these coordinate wrapping techniques with specific frequency requirements, developers can create continuous, repeating procedural textures on complex geometries like tori without visible discontinuities.