2
$\begingroup$

I made a nice-looking tile texture:

enter image description here

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

.blend file

$\endgroup$
1

4 Answers 4

3
$\begingroup$

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.

enter image description here

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.

enter image description here

*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.

enter image description here

$\endgroup$
3
  • $\begingroup$ 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 :) $\endgroup$
    – Robin Betts
    Feb 4, 2021 at 18:39
  • $\begingroup$ @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. $\endgroup$
    – PGmath
    Feb 4, 2021 at 21:15
  • 1
    $\begingroup$ 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 ) $\endgroup$
    – Robin Betts
    Feb 4, 2021 at 21:29
2
$\begingroup$

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. enter image description here 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. enter image description here

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

$\endgroup$
1
$\begingroup$

Did it after some research, thank you for responce.

.blend file

enter image description here

$\endgroup$
0
$\begingroup$

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.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.