Skip to content
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

Incorrect depth sorting for materials using Depth Prepass and materials using blend modes like Add. (Still affects Godot 4) #49389

Closed
EzraT opened this issue Jun 7, 2021 · 8 comments

Comments

@EzraT
Copy link

EzraT commented Jun 7, 2021

Godot version:
3.3.2.stable

OS/device including version:
Both Rendering backends
OS: Linux Mint 20.1 x86_64
GPU: NVIDIA GeForce GTX 1060 6GB - Driver version: 460.80

Issue description:

https://user-images.githubusercontent.com/781121/121025186-33f29800-c7a5-11eb-9b49-4f4638db550a.mp4
https://user-images.githubusercontent.com/781121/121025398-69978100-c7a5-11eb-95bd-0119a6260588.mp4

I'm working on a scene with trees, for the trees I need to use a material that has "depth_draw_alpha_prepass" enabled, to have the transparent leaves texture cast shadows.
I also use materials for particle systems and effects with the "Add" blend mode enabled, as shown in the videos.

Godot for some reason does not sort these correctly when the tree leaves material has "depth_draw_alpha_prepass" enabled.
As soon as I turn that off, the sorting behaves like it should again, but then my leaves do not cast shadows anymore, and don't render correctly anymore either.

Is this working as intended? Am I expecting too much of the engine here?
(I ask this because I know depth sorting with transparent materials is hard to get right on most engines), or is there actually something going wrong here?

Thanks in advance.

Steps to reproduce:

  1. Open the MRP.
  2. Move the camera in the editor so that the tree displays behind the sphere.
  3. Move the camera backwards away from the sphere to reproduce.

Minimal reproduction project:
mrp.zip

@clayjohn
Copy link
Member

clayjohn commented Jun 7, 2021

Can you test this in a more recent release? There were some fixes to the depth prepass and transparency sorting that came in 3.3.

For reference, current stable is 3.3.2 https://godotengine.org/download

Also, is this GLES2 or GLES3?

@clayjohn clayjohn added this to the 3.3 milestone Jun 7, 2021
@EzraT
Copy link
Author

EzraT commented Jun 7, 2021

@clayjohn Apologies, I typo'd when writing down the Godot version number, I meant to type 3.3.2 when I created this issue.
This is in GLES3.

@clayjohn
Copy link
Member

clayjohn commented Jun 7, 2021

Do you have the same issue when switching to GLES2?

@EzraT
Copy link
Author

EzraT commented Jun 7, 2021

@clayjohn Yes, here's a video of the MRP in GLES2.

video-2021-06-07_18.56.00.mp4

@EzraT
Copy link
Author

EzraT commented Jul 22, 2021

@clayjohn
I tested this again in v3.4.beta.custom_build d3f500c, and it looks like this is fixed now.
Likely thanks to this PR: #50721.
Thanks again!

@akien-mga
Copy link
Member

Fixed by #50721.

@EzraT EzraT changed the title Incorrect depth sorting for materials using Depth Prepass and materials using blend modes like Add. Incorrect depth sorting for materials using Depth Prepass and materials using blend modes like Add. (Also affects Godot 4) Nov 16, 2022
@EzraT
Copy link
Author

EzraT commented Nov 16, 2022

I'm guessing developers are probably already aware of this, but just in case, this issue is still present in the latest Godot 4 beta. (Beta5 as of writing)
Video: https://streamable.com/ni92le

@EzraT EzraT changed the title Incorrect depth sorting for materials using Depth Prepass and materials using blend modes like Add. (Also affects Godot 4) Incorrect depth sorting for materials using Depth Prepass and materials using blend modes like Add. (Still affects Godot 4) Nov 16, 2022
@clayjohn
Copy link
Member

@EzraT Yes, this is being tracked here: #63675

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants