-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Materials set to "Transparent" have strange layering (ex: background on foreground) #21050
Comments
Did you try DEPTH_DRAW_ALPHA_OPAQUE_PREPASS ? See https://godot.readthedocs.io/en/3.0/tutorials/3d/spatial_material.html#depth-draw-mode |
@fire That works, how come it's not enabled by default? Perhaps it should detect if "Transparent" is enabled and automatically use that setting if so. |
Sounds like transparency sorting to me. (transparent objects are sorted back to front based on their origin). There is no perfect fix for this. Using 1 bit alpha (alpha testing, not sure what the name is in godot) is one way but you'll have to put up with sharp borders and aliasing. |
So... an update on this issue. My brother and I recently updated our main project to Godot 3.2 alpha, and we can confirm that this issue is still present. However, I will note that a) It can be worked around if we fiddle with it, and b) It doesn't ever occur on GLES 2, so it's possibly a GLES 3 specific issue. Since GLES 3 isn't being worked on anymore due to being removed in the future, I suggest bumping this to the 4.0 milestone. |
Im not sure this should be an open issue. The solution is to use DEPTH_DRAW_ALPHA_OPAQUE_PREPASS Otherwise it's just a limitation of 3d rendering. We aren't going to do a prepass on all transparent objects because it is expensive and usually unnecessary. |
I think this issue is back in 3.2. In this reproducer I have two transparent Sprite3Ds set up with DEPTH_DRAW_ALPHA_OPAQUE_PREPASS. In the foreground is a blue one, set to not cast shadows, and in the background is a red one that does cast a shadow. The blue sprite is positioned to occlude the red sprite. When you run the project in 3.2, you can see the red sprite through the blue sprite. You can also see this in the editor by lining up the camera. Strangely, it only does this for certain angles of directional light? 3.1.1 was unaffected. I think this is related to #30764, the fix for #30673. It has a pretty major impact on my project. |
I can confirm this is happening on the latest 3.2 stable. |
@tcoxon Can you run it again in 3.2.2? I can't reproduce the issue. edit Nevermind, I can reproduce it now. I will make a fix shortly. |
This is a limitation shared by most real-time renderers out there: https://docs.godotengine.org/en/latest/tutorials/3d/3d_rendering_limitations.html#transparency-sorting Using opaque pre-pass usually solves this, but there are known bugs like #43253. I'll close this issue in favor of other reports that are specifically about opaque pre-pass. |
Godot version: 3.1-dev with Mono, including latest c627f3a and others such as 80a8636 (I've been having this problem for awhile it's not new)
OS/device including version: Linux Xubuntu 18.04.1 64-bit, Mono 5.14
Issue description: For some reason, if I enable the "transparent" property of a texture, the background sometimes appears over the foreground. It's a really strange effect.
If I disable "Transparent", then the mesh renders correctly, however, anything with transparency in it (like if I wanted to make a glass block) appears white instead.
Steps to reproduce: Have a mesh with textures overlaying and enable the transparent property of the material. In my case I have a code-generated Mesh via SurfaceTool.
The text was updated successfully, but these errors were encountered: