From ff55157d3f1f14673317af19142c0df7a01a4540 Mon Sep 17 00:00:00 2001 From: Firepal Date: Fri, 22 Jan 2021 20:33:27 +0100 Subject: [PATCH] Don't use prepass threshold with alpha scissor --- drivers/gles2/shaders/scene.glsl | 8 ++++++++ drivers/gles3/shaders/scene.glsl | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/drivers/gles2/shaders/scene.glsl b/drivers/gles2/shaders/scene.glsl index b09d9fe7abab..f9a127cb7348 100644 --- a/drivers/gles2/shaders/scene.glsl +++ b/drivers/gles2/shaders/scene.glsl @@ -1695,9 +1695,13 @@ FRAGMENT_SHADER_CODE #endif // ALPHA_SCISSOR_USED #ifdef USE_DEPTH_PREPASS +#if !defined(ALPHA_SCISSOR_USED) + if (alpha < 0.1) { discard; } + +#endif // not ALPHA_SCISSOR_USED #endif // USE_DEPTH_PREPASS #endif // !USE_SHADOW_TO_OPACITY @@ -2255,9 +2259,13 @@ FRAGMENT_SHADER_CODE #endif // ALPHA_SCISSOR_USED #ifdef USE_DEPTH_PREPASS +#if !defined(ALPHA_SCISSOR_USED) + if (alpha < 0.1) { discard; } + +#endif // not ALPHA_SCISSOR_USED #endif // USE_DEPTH_PREPASS #endif // !USE_SHADOW_TO_OPACITY diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index 375b58800cdd..4faf87c27c4a 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -1902,11 +1902,13 @@ FRAGMENT_SHADER_CODE #endif // ALPHA_SCISSOR_USED #ifdef USE_OPAQUE_PREPASS //ubershader-runtime +#if !defined(ALPHA_SCISSOR_USED) if (alpha < opaque_prepass_threshold) { discard; } +#endif // not ALPHA_SCISSOR_USED #endif // USE_OPAQUE_PREPASS //ubershader-runtime #endif // !USE_SHADOW_TO_OPACITY @@ -2282,10 +2284,13 @@ FRAGMENT_SHADER_CODE #endif // ALPHA_SCISSOR_USED #ifdef USE_OPAQUE_PREPASS //ubershader-runtime +#if !defined(ALPHA_SCISSOR_USED) + if (alpha < opaque_prepass_threshold) { discard; } +#endif // not ALPHA_SCISSOR_USED #endif // USE_OPAQUE_PREPASS //ubershader-runtime #endif // USE_SHADOW_TO_OPACITY