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

Vulkan: StandardMaterial3D with any transparency does not cast shadows #61730

Closed
Tracked by #56333
jasonallen opened this issue Jun 5, 2022 · 6 comments
Closed
Tracked by #56333

Comments

@jasonallen
Copy link

Godot version

v4.0.alpha8.official [917fd65]

System information

Mac OSX 12.4, M1 Pro

Issue description

I'm unable to get a material to render a shadow when I set any transparency other than "Disabled":

image

This seems related to #50344 but that seems fixed.

Steps to reproduce

  1. Create a scene with a directional light and flat terrain that accepts shadows
  2. Create a Mesh3D with a quad, give it a StandardMaterial3D and a texture with alpha in it.
  3. Position it so you can see the shadow casted on the flat terrain.
  4. Now set the material "Transparency" to anything other than "Disabled"

==! The shadow disappears.

Minimal reproduction project

shadow_test.zip

@TokisanGames
Copy link
Contributor

On GD4 Alpha13 Win10/64, I can get a shadow using depth prepass mode or alphascissors. Not with Alpha hash or alpha.

image

@TokisanGames
Copy link
Contributor

TokisanGames commented Jul 31, 2022

Also ProximityFade (part of the transparency pipeline) has no shadow, only self-shadows. No PF on the right. The rock looks weird because of #63675.

image

@Calinou Can this be added to the gd4 roadmap and material tracker #56333?

@Calinou
Copy link
Member

Calinou commented Jul 31, 2022

Also ProximityFade (part of the transparency pipeline) has no shadow, only self-shadows.

Alpha blending is used for materials with proximity fade enabled, so this is expected. Using proximity fade with alpha scissor probably wouldn't make much sense (except with dithering/alpha hash, I guess).

It might be possible to set the depth draw mode to Opaque prepass to improve sorting and make it cast shadows again, but this may come at a performance cost.

@TokisanGames
Copy link
Contributor

@Calinou Can this be added to the gd4 roadmap and material tracker #56333?

@Calinou
Copy link
Member

Calinou commented Aug 9, 2022

I can't reproduce the original issue anymore on 4.0.alpha13 (Linux, NVIDIA 515.57):

image

The alpha hash issue is already tracked in #61882.

Please continue the discussion about the proximity fade issue in #63675.

@Calinou Calinou closed this as completed Aug 9, 2022
@mournguard
Copy link

The other proximity fade issue (#63675) is about z-ordering, and this issue is about shadows on different transparency modes, but this still leaves the fact that proximity fade doesn't have shadows at all, even though it can properly be used to fade with modes that have shadows such as alpha scissor.

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

No branches or pull requests

4 participants