diff options
author | sfan5 <sfan5@live.de> | 2021-09-10 21:59:29 +0200 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2021-09-17 18:13:50 +0200 |
commit | ea250ff5c57301b6ea3e529c811484c743c1fde1 (patch) | |
tree | ad42a856641992b7a32cc799a1cda155f6bbe715 /client/shaders/nodes_shader | |
parent | d1e0f73b770165fbd889b8298dec79c83107862e (diff) | |
download | minetest-ea250ff5c57301b6ea3e529c811484c743c1fde1.tar.gz minetest-ea250ff5c57301b6ea3e529c811484c743c1fde1.tar.bz2 minetest-ea250ff5c57301b6ea3e529c811484c743c1fde1.zip |
Fix GLES2 discard behaviour (texture transparency)
Diffstat (limited to 'client/shaders/nodes_shader')
-rw-r--r-- | client/shaders/nodes_shader/opengl_fragment.glsl | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/client/shaders/nodes_shader/opengl_fragment.glsl b/client/shaders/nodes_shader/opengl_fragment.glsl index f85ca7b48..87ef9af7d 100644 --- a/client/shaders/nodes_shader/opengl_fragment.glsl +++ b/client/shaders/nodes_shader/opengl_fragment.glsl @@ -463,13 +463,16 @@ void main(void) vec2 uv = varTexCoord.st; vec4 base = texture2D(baseTexture, uv).rgba; -#ifdef USE_DISCARD // If alpha is zero, we can just discard the pixel. This fixes transparency // on GPUs like GC7000L, where GL_ALPHA_TEST is not implemented in mesa, // and also on GLES 2, where GL_ALPHA_TEST is missing entirely. - if (base.a == 0.0) { +#ifdef USE_DISCARD + if (base.a == 0.0) + discard; +#endif +#ifdef USE_DISCARD_REF + if (base.a < 0.5) discard; - } #endif color = base.rgb; |