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

There is still a transparency issue with setting ALPHA=1.0 in the shader script #92144

Open
jianliang-li opened this issue May 20, 2024 · 1 comment

Comments

@jianliang-li
Copy link

Tested versions

4.0.4, 4.2, 3.5

System information

macOS 14.4 (23E214) Godot 4.2, 4.0.4

Issue description

Setting ALPHA=1.0 in the shader script still has a transparent effect, just like setting the transparency of StandardMaterial3D to alpha or setting no depth test.
But if the rendering mode of the shadow script adds depth_draw-always, setting ALPHA=1.0 can display normally, but it cannot produce shadow effects.

Steps to reproduce

In the project I uploaded:
In the scene of node_3d_desk, the shader script has set ALPHA=1.0 and I do not want to see the tripod of the table.

Desk_normal has added StandardMaterial3D to the surfaceMaterialOverlay of Box024 without any changes.
image

Desk_alpha added StandardMaterial3D to the SurfaceMaterialOverrides of Box024 and changed transparency to alpha.
image

Desk_no_depth_test has been added to StandardMaterial3D and transparency has been changed to no_depth_test in the surface MaterialOverrides of Box 024.
image

Desk_shaded_alpha added ShaderMaterial in the surfaceMaterialOverride of Box024, with only ALPHA=1.0 set in the script.
image

In the scene of node_3d_sofa, there is also a similar problem. This problem occurs whenever the mesh has an irregular shape.
image
image
image
image

How can I set ALPHA=1.0 in the shader without expecting transparency or no_depth_test effects, and still display shadows normally.

When I add render_mode depth_draw_always in the shader script, it can display normally, but it cannot display shadows properly. If the following image is displayed:
Shadow display in normal mode:
image
Display shadows after setting ALPHA=1.0 and adding render_mode depth_draw_always:
image

Minimal reproduction project (MRP)

Test0520.zip

@Calinou
Copy link
Member

Calinou commented May 21, 2024

This is expected, as setting ALPHA anywhere in the shader will force the material to go through the transparent pipeline. This is the case even if you only use ALPHA = 1.0.

I don't think we should have a special case for ALPHA = 1.0 not making the material go through the transparent pipeline. Could you describe why you want to write to ALPHA in the first place? Perhaps you can achieve the desired effect another way.

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