17

I'm trying to make a texture tiling mirrored as you can do in Internal. It seems that it's not so easy in Cycles. I want this:

enter image description here

Note that besides the A1 square you can see the same square mirrored, as well as in the G8 one and any other square in the texture's limit.

Is there any way to achieve this in Cycles?

Antonio Buch
  • 2,177
  • 14
  • 37

4 Answers4

11

Blender 2.82 added a new Pingpong mode to the Math node, which simplifies maddin45's answer. Make sure to set the scale on the Pingpong nodes to 1.0.

Mirrored tiling setup using Pingpong nodes

scurest
  • 10,349
  • 13
  • 31
  • Is there a way to make this apply to the UVs after they've been affected by a UV Warp modifier? – ArrowCase Dec 11 '20 at 03:00
  • 1
    @ArrowCase The UVs coming out of the UV Map node already have the UV Wrap modifier, so this does apply after the UV Wrap. – scurest Dec 12 '20 at 14:37
11

You can achieve this usign math nodes:
Click for full size nodes

Edit: I have just seen you can even leave out the modulo operation. I thought it would make the coordinates repeat between 0 and 1 but it just does nothing.

Here is the .blend file for you.

What this node setup does is basically flip the UV coordinates when the image border is reached.

Result (with multiple flips):

enter image description here

David
  • 49,291
  • 38
  • 159
  • 317
maddin45
  • 4,804
  • 16
  • 21
  • Thanks! It works perfectly, even better than Internal! :D Just a little more question, how you can even made that node setup from scratch? It's crazy :P – Antonio Buch Jan 20 '15 at 12:59
  • Well, I just thought about what happens to the texture coordinates and translated that to math nodes ;) And I had to solve similar problems for an image processing lecture, so I already had a rough structure for the calculations in my head. – maddin45 Jan 20 '15 at 13:05
  • 1
    @AntonioBuch recommend you watch: http://cgcookie.com/blender/cgc-courses/custom-uv-transformation-nodes-cycles/ to understand all the math :) – Greg Zaal Jan 20 '15 at 15:20
  • 1
    I'd also recommend watching this talk from the blender conference: http://youtu.be/kAUmLcXhUj0 – gandalf3 Jan 20 '15 at 22:22
  • That's awesome, but took me a while to notice that the second input of the power node is used instead of the first. Also your .blend file is no longer available. Try the blender stack exchange dedicated server. – ChameleonScales Dec 06 '16 at 17:12
9

I would propose a simpler set-up, pay attention to the highlighted values:

enter image description here

It basically uses two Mapping nodes and one Vector Math node. Note that the first mapping node is optional, just for pre-transformation:

Leon Cheung
  • 27,718
  • 11
  • 89
  • 161
2

Update December 2022

In Blender 3.5, the Image Texture node has a new mirror extension type (see here). So you can finally just set the Texture node to "Mirror".

Image Texture node with set to Mirror

scurest
  • 10,349
  • 13
  • 31