diff options
author | Juan Linietsky <reduzio@gmail.com> | 2019-01-25 11:40:56 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2019-01-25 11:41:25 -0300 |
commit | 677d4400de9ae73713be9f33600f59a10a079c19 (patch) | |
tree | 5b2c244201c3ee8b222b9d5ce1ab88b8e3984446 | |
parent | 1d50a6edb4d40451f94053b4b880436eebc06f5e (diff) |
Ensure contact shadows are only used when lights use them.
-rw-r--r-- | drivers/gles3/rasterizer_scene_gles3.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index f4b09e71bf..82fce918ea 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -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 |