Texture gets distorted when trying to move the UV coordinates
Asked Answered
N

2

0

Hi all,

I´m trying to create a water shader and I have a foam texture i want to animate but i have a problem when I try to modify the Y coordinate for it:

COLOR = texture(foam_texture, UV + vec2(0.0, 0.5));

the image gets distorted instead of repeating itself:

This texture is an image I grabbed from Google, converted it to greyscale and added an alpha channel with GIMP. Then i created a uniform variable and selected the texture from the inspector.

I´m new with this topic and need help to understand if there is any preprocessing i need to do to the texture or if it´s a coding issue.

Thank you very much.

Nada answered 21/10, 2022 at 10:46 Comment(0)
M
0

This is with the texture sample mode clamp to edge. You can also use repeat (which you want) or mirror. Click on the texture on the bottom left, click the Import tab on the top left, then scroll down to Flags -> Repeat and select Enabled. Then click Reimport on the bottom middle.

Menstruate answered 21/10, 2022 at 11:18 Comment(0)
N
0

Menstruate

That was it, thank you very much.

Nada answered 21/10, 2022 at 14:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.