[Bf-blender-cvs] [b645e70] master: Fix T48790: Cycles render bug with zero strength lights.

Brecht Van Lommel noreply at git.blender.org
Wed Jul 27 23:13:36 CEST 2016


Commit: b645e7081d2bcc92108d4f6b3a97f84b20855650
Author: Brecht Van Lommel
Date:   Wed Jul 27 23:09:38 2016 +0200
Branches: master
https://developer.blender.org/rBb645e7081d2bcc92108d4f6b3a97f84b20855650

Fix T48790: Cycles render bug with zero strength lights.

===================================================================

M	intern/cycles/render/light.cpp

===================================================================

diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp
index 9ef3582..6a1437f 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) {




More information about the Bf-blender-cvs mailing list