How can I flip a material upside down?

I followed the UE4 tutorials on the paper 2d project. There is a part where he shows you how to have a material repeat. I made my own texture to try this out and I have one problem. My texture has a certain position it needs to be in and when I follow the tutorial my texture is upside down. Other than that it works fine. I am unsure on how to flip the texture in that noding.

Thanks in advance!

Hey VigeoJames-

You could add a Texture Coordinate node and wire it into the Texture Sample. If you then change the UTiling/VTiling on the texture coordinate node you can flip the texture along the x/y axis respectively. However this is rather performance heavy. If you’re trying to optimize performance your best bet would be to edit the texture directly in another program (Photoshop for instance).

Cheers

Doug Wilson

Haha wow. The photoshop idea is probably the best way to go about it. Don’t know why I didn’t think of that. Thanks!

I just encountered this issue as well. For anyone else reading this the solution I found was to use the “OneMinus” node on the product of the value derived from the absolute world position and plug the result of that into the texture sample instead. This is needed as UV inputs gradient from right to left, and from bottom to top, which is why the texture appears upside down. Subtracting the value from 1.0 reorders the values from left to right, and top to bottom, as you would expect.

That inverts horizontally as well, which fixes vertical, but breaks horizontal. =/

Why not just fix the coordinate system? Take the connection between the product of the AbsoluteWorldPosition node and the TextureSample (in my case, SpriteTexture), and add a second multiplication to a constant Vector2 of value (1,-1). This effectively flips the inverted vertical coordinate-system back to upright.

Thanks, that worked perfect!!

use a component mask to sepeperate the r or g channel ( u or v) and flip the one you want, then recombine using and append vector or make float 2

This is ridiculous. I have to do all this blueprint work just to flip the diffuse of a texture? Why is there no ‘flip’ for UVs in UE4? Dumb.

This is ridiculous. I have to do all this blueprint work just to flip the diffuse of a texture? Why is there no ‘flip’ for UVs in UE4? Dumb.

I just flipped the texture in PS, and re-exported it. Done. May not work for everyone, but for my issue, this was acceptable.

There is now a ‘WorldAlignedTexture’ node in the materials which tiles properly for you.

All this? 2 nodes?

What do you all think of this? (Invert output from G mask to flip on Horizontal axis)

If you need to flip (mirror) any texture, you just need textcoords and a constant2 node (-1, 1 or 1, -1) going into a multiply node and it’ll flip either horizontally or vertically

Here is how you can flip UVs

Make sure your texture Sampler Source is set to Wrap.

1 Like

You just saved my life ;D