# How to tile the Gradient Texture node with the spherical gradient type? How do I make it repeat itself along the X-axis?

• Possible duplicate of Repeat a generated texture in Cycles? Apr 23, 2019 at 23:14
• Yeah, I tried their methods and none of them worked out for me. Apr 23, 2019 at 23:25
• Then how about giving us something to work with? More than one sentence? Adding images? You can edit your question to make it better. Apr 23, 2019 at 23:32
• done that, thought it was clear enough Apr 23, 2019 at 23:39

This is a little more complex than the linked question due to the spherical gradient texture needing a range of [-1,1] to generate a full circle.

The modulo(1) function will generate a repeating pattern by mapping positive values to a new value in [0,1] and negative values to a value in [-1,0]. This means that half the circle will be repeated in either direction from 0, not what we want.

Instead we can generate two versions of our repeating pattern that each work for just one side of the zero point, and then combine them by masking out values we don't want and using a maximum: 1. Modulo(x,2) - 1 generates a repeating [-1,1] range for x > 0 and [-3,-1] otherwise
2. Modulo(x,2) + 1 generates a repeating [-1,1] range for x < 0 and [1,3] otherwise. This [1,3] range will present problems when combining each side with maximum so we need to set it to something less than or equal to 0
3. By exploiting the fact that the spherical gradient is symmetrical around x=0, we can invert the part from (2) to avoid the issues with maximum.

Just out of interest.. (this is no better than @Sazerac's answer) .. this set of nodes has the same effect as Sazerac's cluster between the Mapping and Gradient nodes, this time placing the full gradient in the ranges ...[0,2],[2,4]... of whichever space you are using. The graphs in the illustration below show the sequential effects on the mapping of X by the numbered nodes.The squares are all 8 units on the side. Thanks to @Rich Sedman for the tip on how to display graphs of f(x).

• Nowadays, Pingpong will do the job. Dec 17, 2020 at 10:32