Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | renderfix |
I have got a plane mesh of size 2 by 2, subdivided 32 times as in: Vertex displacement with shaders — Godot Engine (3.0) documentation in English
I am applying a heightmap texture on it as:
shader_type spatial;
uniform sampler2D htmap;
void vertex() {
float height = texture(htmap, VERTEX.xz).x;
VERTEX.y += height;
}
Since the x & z co-ordinates go from -1 to +1, my heightmap gets repeated in the 4 quadrants:
I can pass the mesh size to prevent this(2.0 in this case as its a square mesh). But whats the usual way to avoid this?