summaryrefslogtreecommitdiff
path: root/drivers/gles3
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2022-06-10 11:09:17 +0200
committerHugo Locurcio <hugo.locurcio@hugo.pro>2022-06-10 11:14:04 +0200
commit5d9e996f682e4d6c54c0cdce06d68abb2fb4193f (patch)
treef4e77be1a36c53e8e006efe714323dea69079370 /drivers/gles3
parentefcf0d88e47f6c0dc18746da46bba70b3bfa1f2c (diff)
Use opaque rendering pipeline for alpha hash materials
This has several benefits: - Transparency sorting issues inherent to alpha blending no longer occur. - Alpha hash materials can now cast shadows (also works with GeometryInstance3D Transparency's property for alpha hash materials). - Higher performance.
Diffstat (limited to 'drivers/gles3')
-rw-r--r--drivers/gles3/storage/material_storage.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/gles3/storage/material_storage.cpp b/drivers/gles3/storage/material_storage.cpp
index fd50bdedbd..8799db6bc6 100644
--- a/drivers/gles3/storage/material_storage.cpp
+++ b/drivers/gles3/storage/material_storage.cpp
@@ -3234,6 +3234,9 @@ void SceneShaderData::set_code(const String &p_code) {
actions.usage_flag_pointers["ALPHA"] = &uses_alpha;
actions.usage_flag_pointers["ALPHA_SCISSOR_THRESHOLD"] = &uses_alpha_clip;
+ // Use alpha clip pipeline for alpha hash/dither.
+ // This prevents sorting issues inherent to alpha blending and allows such materials to cast shadows.
+ actions.usage_flag_pointers["ALPHA_HASH_SCALE"] = &uses_alpha_clip;
actions.render_mode_flags["depth_prepass_alpha"] = &uses_depth_pre_pass;
actions.usage_flag_pointers["SSS_STRENGTH"] = &uses_sss;