Texture UV on a border impacted by other end of the texture?
Asked Answered
E

2

0

Hello.

I'm creating a simple shader like this:

shader_type spatial;

uniform sampler2D heightmap;

void vertex() {
float d = (texture(heightmap, UV).a - 0.5) * 10.0;
VERTEX.xyz += NORMAL * d;
}

I put that shader as a material on a plane object.
If I give an input texture which has a constant alpha, I get a flat plane.
If I give an input texture with various alpha on the right part of the texture, I get something rugged on the right part of my plane as expected, but I also get artefacts on the left border of the plane: Some points on the left border are higher than others. So, it looks like vertices with values of U or V == 0 or 1 are affected by the value at the other end of the texture.
My texture is a png file, setup with lossless compression.
Any idea what the issue may be?

Erenow answered 14/10, 2023 at 23:17 Comment(0)
K
0

Erenow Try disabling texture repeating for the sampler

uniform sampler2D heightmap: repeat_disable;
Kif answered 14/10, 2023 at 23:39 Comment(0)
E
0

Kif Thanks a lot, that worked. I no longer see the seams.

Erenow answered 15/10, 2023 at 7:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.