Ensure contact shadows are only used when lights use them.

This commit is contained in:
Juan Linietsky 2019-01-25 11:40:56 -03:00
parent 1d50a6edb4
commit 677d4400de
1 changed files with 11 additions and 1 deletions

View File

@ -4132,7 +4132,17 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
glDepthFunc(GL_LEQUAL);
state.used_contact_shadows = true;
state.used_contact_shadows = false;
for (int i = 0; i < p_light_cull_count; i++) {
ERR_BREAK(i >= RenderList::MAX_LIGHTS);
LightInstance *li = light_instance_owner.getptr(p_light_cull_result[i]);
if (li->light_ptr->param[VS::LIGHT_PARAM_CONTACT_SHADOW_SIZE] > CMP_EPSILON) {
state.used_contact_shadows = true;
}
}
if (!storage->config.no_depth_prepass && storage->frame.current_rt && state.debug_draw != VS::VIEWPORT_DEBUG_DRAW_OVERDRAW) { //detect with state.used_contact_shadows too
//pre z pass