You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OS/device including version: Windows, 7, 32-bit, Intel HD graphics (coming with Lenovo L570).
Issue description: In 2D: added a ShaderMaterial to a button. The shader code is below. This creates a red rectangle on the left of the button. However, some characters in on the button text also had a red rectangle. Experimenting with different text strings I noticed it was always on the same characters. Changing to a different font I noticed it was on different characters. My best guess here is that the characters showing this effect had the required UV.x value, that is, they were locate on the left edge of the corresponding bitmap holding th characters.
/// code
shader_type canvas_item;
void fragment() {
vec4 c = texture(TEXTURE, UV);
if ((UV.x < 0.1)) {
COLOR.rgba = vec4(1.0, 0.0, 0.0, 1.0);
}
else {
COLOR = c;
}
}
expected behaviour
To the minimum: it should be possible to distinguish in the shader between the various layers that make up a gui element - in the sample project, I used a button with som text so the expected behaviour here would be to have the text on a different layer than the button geometry - so a z-value should be needed.
Better would be to allow for different shaders on gui elements. It makes sense to do this since you can then apply different effects on gui background and the gui front.
This is intended behaviour. I agree it is not ideal, I have been frustrated in the past trying to write a custom shader for text. But right now this is just a limitation of the engine.
The issue arises because we hijack UV1 to use for text, a better solution would be for text to have an optional TEXT_UV. I don't know how the 2D API has changed in 4.0. this may already be fixed, or it may be easy to fix.
Godot version: 3.0.3
OS/device including version: Windows, 7, 32-bit, Intel HD graphics (coming with Lenovo L570).
Issue description: In 2D: added a ShaderMaterial to a button. The shader code is below. This creates a red rectangle on the left of the button. However, some characters in on the button text also had a red rectangle. Experimenting with different text strings I noticed it was always on the same characters. Changing to a different font I noticed it was on different characters. My best guess here is that the characters showing this effect had the required UV.x value, that is, they were locate on the left edge of the corresponding bitmap holding th characters.
/// code
shader_type canvas_item;
void fragment() {
vec4 c = texture(TEXTURE, UV);
if ((UV.x < 0.1)) {
COLOR.rgba = vec4(1.0, 0.0, 0.0, 1.0);
}
else {
COLOR = c;
}
}
expected behaviour
To the minimum: it should be possible to distinguish in the shader between the various layers that make up a gui element - in the sample project, I used a button with som text so the expected behaviour here would be to have the text on a different layer than the button geometry - so a z-value should be needed.
Better would be to allow for different shaders on gui elements. It makes sense to do this since you can then apply different effects on gui background and the gui front.
Minimal reproduction project:
shadertest.zip
The text was updated successfully, but these errors were encountered: