Flip imageTexture

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By brunosxs
:warning: Old Version Published before Godot 3 was released.

Hey guys, I have a shader that accepts an ImageTexture and I would like to avoid saving mirrored versions of the image. So, I thought of mirroying it on the X axis. How to achieve that?

:bust_in_silhouette: Reply From: Zylann

Instead of writing this to get the pixel color:

tex(TEXTURE, UV)

You write this to mirror it along the Y axis:

tex(TEXTURE,vec2(1-UV.x,UV.y))

Or this to mirror it along the X axis:

tex(TEXTURE,vec2(UV.x,1-UV.y))
:bust_in_silhouette: Reply From: Warlaan

As an alternative to what Zylann said you can also set the “Mirrored Repeat” flag and use addresses between 1 and 2.