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

Overlapping transparent shader materials cancel out in GD 4 beta 10 but not 9 #70753

Closed
timshannon opened this issue Dec 30, 2022 · 2 comments
Closed

Comments

@timshannon
Copy link

Godot version

v4.0.beta10.mono.official [d0398f6]

System information

Ubuntu 22.04

Issue description

This may not be an issue, as I'm very new to shaders, but I had noticed that the behavior in two of my shaders has changed between betas 9 and 10.

I have a water shader, then a separate shader applied to a plane in front of the camera to add a water effect when the players camera goes underwater.

In beta 9, everything works as expected. You can see the warping effect of the screen overlay as well as back, non-culled face of the water surface. In beta 10, you can only see the screen overlay, and the water surface completely disappears.

Once again, this may be due to an issue in my shaders, so keep that in mind. Also it's important to note that this behavior only applies to the back face of water mesh. The behavior is the same (not blending the effects) for the front face in both betas.

Beta 9:
image

Beta 10:
image

Steps to reproduce

Simply open up the attached project and view the main.tscn scene from the camera. Half the camera is covered with the screen overlay, and half isn't. In beta 9, you can see both effects, in beta 10, you can only see one.

Minimal reproduction project

bug.zip

@clayjohn
Copy link
Member

I'm not sure if this is a bug. I think this is a change in behaviour introduced by #69998, but I am fairly certain the behaviour in beta 9 was a bug. If you take a look at the scene in beta 9 you will see that the overlay you have added only effects the portion of the screen not covered by the "water" block.

So in Beta 9 what is happening is the overlay is drawn first, then the water is drawn second which draws over the overlay (i.e. the overlay does not affect the water block). Although from some angles the water is properly drawn first which causes the overlay to flicker in and out.

Beta 9
Screenshot from 2023-01-10 11-56-35

In Beta 10 and above, the overlay appears to be properly sorted so that it always draws after the "water" block. This causes it not to display the water as its entire color comes from the SCREEN_TEXTURE which only captures opaque objects.

To illustrate what is going on I modified the shader code for the overlay to tint it yellow. Here is how it looks in Beta 9:

Screenshot from 2023-01-10 12-01-24

And in Beta 10/11:

Screenshot from 2023-01-10 12-02-03

Note how in Beta 9 the water is drawn overtop of the overlay and in Beta 10/11 the overlay is properly drawn on top

@clayjohn clayjohn closed this as not planned Won't fix, can't repro, duplicate, stale Jan 10, 2023
@clayjohn clayjohn removed this from the 4.0 milestone Jan 10, 2023
@timshannon
Copy link
Author

I was suspecting something along those lines. Thanks for looking into it.

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

4 participants