Hi,
I've just started working with shaders and wanted to start with something simple. A Button.
But I ran into a problem that the text of the button has very weird (random?) UV values, which makes it very hard for me to actually make something useful.
Here's a visualization of the button UV:
My Question:
Is this something that can be solved in Godot 4.1? I saw a couple of posts regarding this, but the post were old and referred to Godot 3.x
(https://github.com/godotengine/godot/issues/19736)
Edit:
More information for clarification:
Thanks to Burge I realized that this might be more than just a plain UV issue.
I created the picture using the following code:
Edit:
More information for clarification:
void fragment() {
COLOR.rgba = vec4(UV.x, UV.y, 0.0, 1.0);
}
The adjustments and Ideas in the replies worked for simply colouring the button. Is there also a nice hack for changing the vertex?
In this example I used the following code to enlarge the button:
uniform float amplitude = 5.0;
void vertex() {
if(UV.x < 0.5) {
VERTEX.x = VERTEX.x - amplitude;
}
else {
VERTEX.x = VERTEX.x + amplitude;
}
if (UV.y < 0.5) {
VERTEX.y = VERTEX.y - amplitude;
}
else {
VERTEX.y = VERTEX.y + amplitude;
}
}
As you can see the UV of the text is messing with the vertex as well.
Thanks in advance,
Daweed