diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2016-07-28 00:09:38 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2016-07-28 00:09:38 +0300 |
commit | b645e7081d2bcc92108d4f6b3a97f84b20855650 (patch) | |
tree | 912ac0aeac3d807cdd91ed62e7b8f6cf10b57786 /intern/cycles/render/light.cpp | |
parent | c05363e8895a8cd6daa2241706d357c47ed4a83e (diff) |
Fix T48790: Cycles render bug with zero strength lights.
Diffstat (limited to 'intern/cycles/render/light.cpp')
-rw-r--r-- | intern/cycles/render/light.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp index 9ef35820254..6a1437fefb9 100644 --- a/intern/cycles/render/light.cpp +++ b/intern/cycles/render/light.cpp @@ -443,9 +443,9 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen device->tex_alloc("__light_distribution", dscene->light_distribution); /* Portals */ - if(num_background_lights > 0 && light_index != scene->lights.size()) { + if(num_background_lights > 0 && light_index != num_lights) { kintegrator->portal_offset = light_index; - kintegrator->num_portals = scene->lights.size() - light_index; + kintegrator->num_portals = num_lights - light_index; kintegrator->portal_pdf = background_mis? 0.5f: 1.0f; } else { @@ -609,10 +609,20 @@ void LightManager::device_update_points(Device *device, Scene *scene) { int num_scene_lights = scene->lights.size(); - if(num_scene_lights == 0) + int num_lights = 0; + + foreach(Light *light, scene->lights) { + if(light->is_enabled) { + num_lights++; + } + } + + + float4 *light_data = dscene->light_data.resize(num_lights*LIGHT_SIZE); + + if(num_lights == 0) return; - float4 *light_data = dscene->light_data.resize(num_scene_lights*LIGHT_SIZE); int light_index = 0; foreach(Light *light, scene->lights) { |