# Repeat a generated texture in Blender 2.91 [duplicate]

I made a nice-looking tile texture:

Now I want to repeat it on x and y axes. Is there any easy way to do it?

.blend file

As others have suggested, you can achieve the effect you want for this specific pattern by changing the way you create the pattern (using a color ramp node). For this application that is probably best, however in general it may be useful to know how to tile generic coordinate systems.

It looks like the area of your texture which you would like repeated is within the bounds $$-1\leq x,y\leq1$$, think of this as a 2x2 tile. To repeat the texture, you need to map all values outside of this range into this range by shifting by an even number of 2x2 tiles (e.g. the point $$(3.2, 7.8)$$ should be shifted $$2\times 2$$ units to the left and $$2\times 4$$ units down, bringing it to $$(-0.8, -0.2)$$).

The mathematical modulo function does exactly this. However, in Blender the modulo operator unfortunately doesn't work exactly like its proper mathematical counterpart for negative numbers*. Mathematically, the result of the modulo should always be positive, however Blender calculates the modulo of negative numbers to be the negative of their positive counterparts (i.e. if $$x\geq 0$$, $$-x,y \text{ mod } y = -(x \text{ mod } y)$$. To fix this I made a corrected modulo node which fixes this inversion for negative inputs.

Now we simply use this version of the modulo operation on our position coordinate system, with an offset to account for the desired $$[-1,1]$$ resultant range.

*Update:

As Robin Betts mentioned, there is now a math option called wrap available in both the scalar and vector math nodes which both implements a mathematically correct modulo operation and allows for an offset shift. This then can be done with just one node added to your setup.

• True. Blender's modulo follows the Python convention for negative numerators .. I once used a home-brew 'Sawtooth Mod' like yours. Nowadays, though, the 'Wrap' Math operation will do the job, and the Vector Math version will do it element-wise to vectors, too, so you can save yourself some nodes :) Feb 4 '21 at 18:39
• @RobinBetts Wow that's nifty. I guess there's been a lot of features added (and keybindings changed, grrr) since I last considered myself fluent in Blender. Feb 4 '21 at 21:15
• Grrr.. me.. too. I know it's more 'user-friendly' to reduce the keymap, but the loss of standard shortcuts makes explanations more lengthy, and means experienced users lose a shared language. I'd rather learn to use a chisel any way I like, than have to hunt for bits for my milling machine. (Even niftier is to use a Voronoi > Distance from Edge > 0 Randomness, a 1 node solution ) Feb 4 '21 at 21:29

Several ways to do this. The first one, of course, setup the node. In the following nodes, i just replace the geometry node using gradient textures. Maybe you think it's complicated. The second way you can do is to add array modifier. Noted that the position should be replaced by uv.

Edit: I found another way to simplify the node. This does exactly the same thing as the first method.

Did it after some research, thank you for responce.

.blend file

To make it repeat you need to make a UV map out of the mesh you are texturing, Then go to the UV editing tab and you scale the vertices up and down and then it should work.