mirror of
https://github.com/godotengine/godot.git
synced 2024-11-21 03:18:37 +08:00
fix gles2 shadow transparency bug
This commit is contained in:
parent
4379395892
commit
150487e728
@ -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) {
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user