New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parts of slime entity model are not rendered anymore when shaders are turned on (regression from 5.4.1) #11852
Comments
Mineclonia bug report: https://git.minetest.land/Mineclonia/Mineclonia/issues/211 |
Do you have link to the model file and entity definition in Lua? |
I cannot reproduce this by assigning the model to an entity individually. Testing in Mineclonia was not possible for me because it crashes instantly on startup with not one but two errors. This makes your claim that you reproduced this bug with "Minetest commit 76aa610" appear dubious. |
@sfan5 which errors does Mineclonia crash with? |
@sfan5 just in case Mineclonia crashes due to #11828 then … a) you introduced that bug – after I told you it would break stuff to not use proper boundaries for the check. b) you can disable the Anyways, please provide an error message instead of just writing “it crashes”. I promise I will try to fix it so you can look at the slime. |
Important new information: The bug only happens if shaders are turned on. |
Regardless, the slime model renders and is textured perfectly fine for me. |
For me it does not. I also found out that it vanishes behind nodes with transparency (a different bug). Screenshot as proof: https://mister-muffin.de/p/XAo_.png |
Can you answer my question?
|
Oh sorry, yes. The screenshot https://mister-muffin.de/p/XAo_.png was taken with commit 76aa610. I have built it completely anew to exclude any possibility of build system bugs being involved. |
Okay thanks. I just remembered that I have my renderer set to |
I have an explanation. The mesh is not just a cube, it is actually 5 cubes. An outer cube, inner cube, two eyes, and an off-center mouth. The three fully-transparent cubes protruding from the front need to be discarded (not rendered) by the shader, or else they prevent the main cube from rendering under them (due to depth testing, presumably). When GLES is enabled, there is an explicit discard at the beginning of the fragment shader: minetest/client/shaders/object_shader/opengl_fragment.glsl Lines 453 to 459 in e9e6710
This is why GLES is unaffected. Removing this discard causes the misrendering effect on GLES. According to the comments, it is expected that GL_ALPHA_TEST will be used to do the discard on OpenGL. That is indeed what is done for the built-in renderer for EMT_TRANSPARENT_ALPHA_CHANNEL: However, for custom shaders based on EMT_TRANSPARENT_ALPHA_CHANNEL, the driver sets the blending function, but doesn't set an alpha test: This seems like a simple mistake. Pull request incoming soon. |
Why does the slime have those meshes if they are just transparent anyway? Not that the bug should be ignored or not fixed, but it seems silly to add extra geometry if it's not used. Probably not a question to ask here I suppose. |
@NathanSalapat Agreed, the mesh would be better off as one cube. I figure since non-shader rendering and other drivers already have the "correct" behavior of discarding alpha=0 faces, it makes sense for the OpenGL driver to do the same. |
FYI, I found this document which describes this exact issue and possible solutions. |
Minetest version
Minetest commit 80d12db
Minetest commit 76aa610
OS / Hardware
Operating system: Debian GNU/Linux
CPU: Intel Core i7-8565U
GPU model: Intel UHD Graphics 620 (Whiskey Lake) rev 02
OpenGL version: 3.0 Mesa 18.3.6
Summary
Eyes, interior and backside of slime entity from Mineclonia are not rendered.
This entity model works in both 5.4.1 and on my Thinkpad T60 with OpenGL 1.4.
Steps to reproduce
Screenshot
https://mister-muffin.de/p/xShz.jpg
The text was updated successfully, but these errors were encountered: