Fix T48790: Cycles render bug with zero strength lights.

This commit is contained in:
Brecht Van Lommel 2016-07-27 23:09:38 +02:00
parent c05363e889
commit b645e7081d
Notes: blender-bot 2023-02-14 07:46:47 +01:00
Referenced by issue #48790, Wrong render with HDRi when there Sun lamp with strength=0
1 changed files with 14 additions and 4 deletions

View File

@ -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) {