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

Shadows don’t work when using Vertex Alpha and Alpha Test #5115

Closed
animech-sijo opened this issue Mar 1, 2023 · 0 comments · Fixed by #5126
Closed

Shadows don’t work when using Vertex Alpha and Alpha Test #5115

animech-sijo opened this issue Mar 1, 2023 · 0 comments · Fixed by #5126
Labels
area: graphics Graphics related issue bug

Comments

@animech-sijo
Copy link

animech-sijo commented Mar 1, 2023

Forum post: https://forum.playcanvas.com/t/shadows-dont-work-when-using-vertex-alpha-and-alpha-test/29932

We’ve run into a case where we need to use Alpha Test to “cut” a model. Our model has a Vertex Alpha gradient, 0-1, from left to right. On the material, under opacity, we enable Vertex Color (which uses the Vertex Alpha channel), and then set a Alpha Test value. We noticed that realtime shadows don’t respect this value when using Vertex Alpha. When using textures instead of Vertex Alpha though, shadows do respect the Alpha Test value.

The following image is an example of a running application. The top row uses Alpha Test and a gradient texture. The bottom row uses Alpha Test and a Vertex Alpha gradient:
AlphaTestShadows

In the editor, shadows often freak out when using Vertex Alpha and Alpha test. Shadows flicker on and off depending on if you hover the mouse over the viewport or not, and the Alpha Test value that the light “sees” and uses for casting shadows depends on what object you have selected.

Also, using an Alpha Test value of 1 with Vertex Alpha seems to confuse the shader, creating an interference pattern. I’d expect a value of 1 would hide the entire object.

Here’s a test PlayCanvas project. Please take a look and see if this is something that can be fixed:
https://playcanvas.com/project/1044631/overview/alpha-test-shadows

Related Forum thread:
https://forum.playcanvas.com/t/shadows-dont-work-when-using-vertex-alpha-and-alpha-test/29932

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: graphics Graphics related issue bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants