# How to make tileable procedural noise texture?

I'm trying to figure out how to make procedural noise textures tile. This is my simple setup so far, with a plane using 2 array modifiers (X/Y) and a single noise texture mapped from UVs:

However this doesn't really tile :S

UPDATE: I've managed to get it tiling in 1D, using the trick of mapping UVs to a circle in 2D noise:

So now just have to figure out how to extend this to 2D (4D noise)

UPDATE 2 So I've played around a bit with adding 4D noise to blender, here is where I'm at:

I'm not quite sure about the interface to the node, maybe it would be better (easier to use) to just have a Tiling Noise node with a normal texture coord input.

• This is a possible duplication of blender.stackexchange.com/q/26692/35559.. the very good answers there might help you out. – Robin Betts Mar 27 at 10:27
• I've looked at those, which are interesting, but they give a kind of mirrored look :S I think what I'm after is the 4D noise solution, like here (under A 2D tileable image): ronvalstar.nl/creating-tileable-noise-maps. However I have yet to figure out how to do 4D noise in blender – pjoe Mar 27 at 12:10
• Getting there for sure.. have you used OSL 4-noise? .. implemented your own Detail / Distortion? What's in your 4-noise node? – Robin Betts Apr 3 at 7:58
• I mainly need this in viewport/eevee so haven't looked at OSL ... yet :) Distortion is already working (more or less copied from normal noise shader), still need to look at handling the detail stuff – pjoe Apr 4 at 9:10
• Nice work! 4-textures are not just for tiling .. IMO, the UNIX philosophy,... do one thing, do it well, make sure it can talk to all the other things it needs to, rely on the best processor (the user's brain) to decide on combinations. If I'm given a hammer, I don't want to brush my teeth with it.. stick with a minimal and complete interface to your version of 4-noise. Is this a branch, then? – Robin Betts Apr 4 at 9:45

One way to avoid reflection as method of achieving continuity from u=1 to u=0, and v=1 to v=0, is to map u and v on the 2D tile from the surface of a torus embedded in the 3D texture space.

The parametric equation for the X,Y and Z of u,v on the surface of a torus, where u runs around the major circumference, and v runs around the minor circumference, is as follows. c is the major radius of the torus and a is its minor radius. u and v must run from 0 to 2 pi, or some variation giving a whole number of cycles.

• X(u,v) = (c + a cos(v)) cos(u)
• Y(u,v) = (c + a cos(v)) sin(u)
• Z(u,v) = a sin(v)

Thanks to this answer on Math SE

Here's an implementation of that as nodes, expressing c as a multiple of a. The U and V nodes multiply the generated 0-1 X and Y values by 2pi.

whose output can be put through a mapping node for conveniently hunting down locations and rotations of the torus which give a desirable pattern..

with this sort of result:

There is a disadvantage of uneven scaling.. the inner radius of the torus is shorter than the outer, for u. For v, the radius is constant. But changing the ratio of c to a covers most anisotropy.

It's very possible that someone with better math than me comes along and improves / corrects this, but it's working so far.

• A torus in 3D noise does sound promising, though I would think it difficult to get uniform scale distribution like you mention, as the inner circumference naturally is smaller than the outer, i.e. areas of the texture moving along the outer circumference will have bigger change than along the inner one, I'll give it a try though :) – pjoe Mar 27 at 19:37
• @pjoe I agree .. There's no doubt 4D would do it.. but somehow, you would have to generate 4D noise of your own, make it quick, and accessible.. – Robin Betts Mar 27 at 23:42
• yeah, maybe I should just start digging into adding 4D noise to blender, I've seen various implementations even for GLSL, so think it should be possible. Had just hoped maybe there was an easy shortcut, like generating 4D noise from 3D noise or something. Thanks for your insight :) – pjoe Mar 28 at 7:20
• @pjoe there's a 4D noise function supposedly accessible through OSL .. (haven't tried it yet).. will give it a shot when I've got a moment .. and a built in periodic noise function. – Robin Betts Mar 28 at 11:07
• @pjoe ..and if you're prepared to use OSL's 4D textures, there's a blend file on this link which does the job. Apparently, the periodic noises don't work in the Blender OSL implementation. – Robin Betts Mar 28 at 12:31