From 5d9e996f682e4d6c54c0cdce06d68abb2fb4193f Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Fri, 10 Jun 2022 11:09:17 +0200 Subject: 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. --- drivers/gles3/storage/material_storage.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers') 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; -- cgit v1.2.3