fix gles2 shadow transparency bug

This commit is contained in:
clayjohn 2019-07-21 23:42:51 -07:00
parent 4379395892
commit 150487e728
2 changed files with 15 additions and 15 deletions

View File

@ -2287,19 +2287,6 @@ void RasterizerSceneGLES2::_render_render_list(RenderList::Element **p_elements,
prev_unshaded = unshaded;
}
bool depth_prepass = false;
if (!p_alpha_pass && material->shader->spatial.depth_draw_mode == RasterizerStorageGLES2::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS) {
depth_prepass = true;
}
if (depth_prepass != prev_depth_prepass) {
state.scene_shader.set_conditional(SceneShaderGLES2::USE_DEPTH_PREPASS, depth_prepass);
prev_depth_prepass = depth_prepass;
rebind = true;
}
bool base_pass = !accum_pass && !unshaded; //conditions for a base pass
if (base_pass != prev_base_pass) {
@ -2434,6 +2421,19 @@ void RasterizerSceneGLES2::_render_render_list(RenderList::Element **p_elements,
}
}
bool depth_prepass = false;
if (!p_alpha_pass && material->shader->spatial.depth_draw_mode == RasterizerStorageGLES2::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS) {
depth_prepass = true;
}
if (depth_prepass != prev_depth_prepass) {
state.scene_shader.set_conditional(SceneShaderGLES2::USE_DEPTH_PREPASS, depth_prepass);
prev_depth_prepass = depth_prepass;
rebind = true;
}
bool instancing = e->instance->base_type == VS::INSTANCE_MULTIMESH;
if (instancing != prev_instancing) {

View File

@ -1549,7 +1549,7 @@ FRAGMENT_SHADER_CODE
#endif // ALPHA_SCISSOR_USED
#ifdef USE_DEPTH_PREPASS
if (alpha < 0.99) {
if (alpha < 0.1) {
discard;
}
#endif // USE_DEPTH_PREPASS
@ -2112,7 +2112,7 @@ FRAGMENT_SHADER_CODE
#endif // ALPHA_SCISSOR_USED
#ifdef USE_DEPTH_PREPASS
if (alpha < 0.99) {
if (alpha < 0.1) {
discard;
}
#endif // USE_DEPTH_PREPASS