# How to mirror textures using shader nodes?

How to use a shader from texture 3 to make texture 4 (see attached image)?

if you have a "nice" uv unwrapping like this:

with "nice" i mean, that with exact the same uv mapping values, you get an image which is placed right in the middle.

you will get this:

• One question for clarification, since you mention the "image which is placed right in the middle": is it just my impression or do the resulting 4 images have the character closer to the center of the area as if the character of the original image had been moved to the right? Commented Apr 25 at 13:29
• yes, mine wasn't exactly in the middle, but it should be - i was lazy :( Commented Apr 25 at 14:12

You can also do some math with the texture coordinates. You can split them in to X,Y and Z (that is irrelevant for UV) and use modulo and multiply to repeat the range then find out what is every other repeated range by another modulo twice as "big" as a mask and flip them multiplying by -1. This also let's you choose how many times to repeat this easily:

Actually, you could also do "ping-pong" operation from the math node as well:

...or do the modulo thing with vector math node without splitting the vector.

• You can get rid of the Sep/PingPong/Combine and just change "Repeat" on the Image node to "Mirror". Commented Apr 26 at 6:13
• Now what's the fun in that?.. :D OK, I did not know about that... :D :D :D Commented Apr 26 at 8:18

First of all, I expect your texture 3 to be fully covering the UV map of the plane, i.e. the image stretches all the way from bottom left to top right of the plane and so does the plane's UV. Then here is a step-by-step guide how you can do it and what each node does:

1. Starting with the UV output of the Texture Coordinate node plugged into the Vector input of the Image Texture node.

2. Next you take a Vector Math node and Subtract 0.5 on each axis (actually like in my example only X and Y are needed, because the UVs are 2-dimensional). This way the bottom left (the origin) of the UV map is in the center of the plane.

3. Now you add a Vector Math node set to Scale by 2, this way the texture gets mapped to all four quadrants of the plane.

4. The step before made the texture just repeat from four times, but the coordinates left of the left and below the center are negative. If you now take another Vector Math node set to Absolute, the textures get mapped from the center to the border, meaning the ones to the left and bottom are now mirrored.

5. Finally, since your example texture 4 shows the correctly oriented text in the bottom left quadrant not the top right, mirror everything again by using another Scale node, this time by -1.

• but to be nit picky ;) ...yours won't work if the image isn't places perfectly, because then you would see pieces of more images, my setup "ignores" sloppy work ;) Commented Apr 26 at 5:04
• @Chris Yeah sure, that's why my first paragraph tells it has to match the UV map, might have been not clear enough from what I've written. It looks like in the question it is simply the basic plane with an unaltered UV map stretching across the whole UV area, and that's the case which I made this answer for and said it at the beginning... doesn't really matter though since my answer wasn't accepted anyway. But: as long as the UVs are not outside the UV map's bounds, you will not "see pieces of more images". Commented Apr 26 at 5:56