gl4es icon indicating copy to clipboard operation
gl4es copied to clipboard

Minetest visual artifacts with use_shaders = true

Open jdonald opened this issue 7 years ago • 7 comments

Spinning this off from #66 :

In Minetest, all the terrain appears very red by default. If I disable shaders things look normal again, but it would be nice to have shaders.

@jdonald: Minetest: with Shaders enabled, it shows no shader errors in the output even with LIBGL_LOGSHADERERROR=1. The terrain just appears very red and the player's weapon in hand comes with a black billboard.

To toggle shaders on/off, ~edit ~/.minetest/minetest.conf~ use the Shaders checkbox in the GUI

This has been observed on a Raspberry PI 3B+ (LIBGL_FB=1, configure for minimum 128 MB GPU memory) but may affect other platforms the same.

jdonald avatar Dec 27 '18 16:12 jdonald

I've just tested on my Pandora, and while I noticed an issue with the transparency issues (weapon in hand, but also some flowers), I have witnessed any red-ish issue with landscape. It all feels normal.

minetest01 I activated all shaders in the GUI.

minetest02 (it's almost night-time in the screenshot) I'll look at the transparent issue, but the red-issue will be more difficult to track.

ptitSeb avatar Dec 28 '18 02:12 ptitSeb

I tried with latest gl4es (1.1.2) and didn't reproduced any bugs on my side (it was a quick test). Also, just to note, implementation of VBO in gl4es halped speedup a bit minetest.

Can I close the issue?

ptitSeb avatar Sep 29 '19 06:09 ptitSeb

Just pulled out a Pi 3B+ (4B doesn't support legacy GLES), used Raspbian Buster, built and ran v1.1.2 (0f5345f). The red terrain issue is gone, but the blacked out weapon in hand / flowers problem (the one you could reproduce even on Pandora in December) is still there:

image

If I disable shaders it renders fine. I'd be surprised if you managed to fix the black boxes on Pandora without fixing on the Pi at the same time. Is it possible your recent test had shaders disabled?

Note I'm toggling Shaders via the GUI, because for whatever reason it doesn't stick when I edit minetest.conf anymore.

jdonald avatar Sep 29 '19 15:09 jdonald

Ah damn, right. I haven't looked at the right thing when testing!

I still need to investigate this one.

ptitSeb avatar Sep 29 '19 17:09 ptitSeb

Is this still an issue now?

AbduSharif avatar Jun 08 '22 21:06 AbduSharif

Yes, seems to behave roughly the same as before.

Minetest 0.4.17.1 (the one that conveniently comes with sudo apt install minetest on Raspberry Pi OS Buster): image Notice the transparent portions of leaves becoming opaque black, and the in-hand item becoming opaque white.

Stdout has such errors:

glGetError 0x500
2022-07-04 21:53:00: ERROR[Main]: Irrlicht: Vertex shader compilation failed at position 585:
Invalid token
2022-07-04 21:53:00: ERROR[Main]: Irrlicht: Pixel shader compilation failed at position 580:
Invalid value (implicit param?)
2022-07-04 21:53:00: ERROR[Main]: Irrlicht: Vertex shader compilation failed at position 605:
Invalid token
2022-07-04 21:53:00: ERROR[Main]: Irrlicht: Pixel shader compilation failed at position 586:
Invalid value (implicit param?)

Compared to the scene properly rendered in GL fake KMS mode without gl4es (shaders still enabled): image

Alternatively, when shaders are disabled, legacy mode + gl4es also renders the scene reasonably.

Minetest 5.6.0-dev-213d3562b (built from source): it's more playable, but shaders are still not working. Here is some desert scene: image Shader effects are not working. Easiest ones to see are waving leaves/plants and dynamic shadows. They are clearly working in fake KMS without gl4es, but no such effects are visible when running legacy + gl4es. Probably due to shader generation failing with a few more details in stdout:

2022-07-04 21:28:52: ERROR[Main]: Irrlicht: GLSL (> 2.x) shader program failed to link
2022-07-04 21:28:52: ERROR[Main]: Irrlicht: ERROR:SEMANTIC-4 (vertex shader, line 252) Operator not supported for operand types
2022-07-04 21:28:52: ERROR[Main]: generate_shader(): failed to generate "nodes_shader", addHighLevelShaderMaterial failed.

Apparently the "Color format not supported: R32F" errors appear regardless of whether shaders are enabled.

Repro notes:

  • Requires Raspberry Pi 3B+ or older
  • Use Raspberry Pi OS Buster. As of Bullseye, the legacy graphics stack including the hello_pi examples seem to no longer run
  • Set GPU memory to 128 MB or higher (sudo raspi-config --> Performance Options --> GPU Memory). At the default 64 MB, Minetest will segfault with or without shaders enabled
  • Compile gl4es with -DBCMHOST=1, run with LD_LIBRARY_PATH=path/to/gl4es/lib LIBGL_FB=1 LIBGL_LOGSHADERERROR=1 minetest, tested above with gl4es v1.1.4 / 566e4bf
  • Checking and unchecking the Shaders box is sufficient to control the setting, not sure what was going on back in 2018 when I needed to manually edit minetest.conf
  • If Minetest 5.6 on fake KMS without gl4es runs into a GLXBadFBConfig error, workaround that via export MESA_GL_VERSION_OVERRIDE=4.5

jdonald avatar Jul 05 '22 05:07 jdonald

Thank you very much for the detailed response.

AbduSharif avatar Jul 17 '22 05:07 AbduSharif