Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/scene/background.cpp13
-rw-r--r--intern/cycles/scene/light.cpp5
2 files changed, 3 insertions, 15 deletions
diff --git a/intern/cycles/scene/background.cpp b/intern/cycles/scene/background.cpp
index 0779313e5ba..d29a4c02423 100644
--- a/intern/cycles/scene/background.cpp
+++ b/intern/cycles/scene/background.cpp
@@ -104,19 +104,6 @@ void Background::device_update(Device *device, DeviceScene *dscene, Scene *scene
kbackground->surface_shader |= SHADER_EXCLUDE_CAMERA;
}
- /* Find background index in lights. */
- int device_light_index = 0;
- int background_light_index = -1;
- foreach (Light *light, scene->lights) {
- if (light->get_is_enabled()) {
- if (light->get_light_type() == LIGHT_BACKGROUND) {
- background_light_index = device_light_index;
- }
- device_light_index++;
- }
- }
- kbackground->light_index = background_light_index;
-
/* Light group. */
auto it = scene->lightgroups.find(lightgroup);
if (it != scene->lightgroups.end()) {
diff --git a/intern/cycles/scene/light.cpp b/intern/cycles/scene/light.cpp
index 65d4c76fa8c..49a8e19c95a 100644
--- a/intern/cycles/scene/light.cpp
+++ b/intern/cycles/scene/light.cpp
@@ -811,8 +811,6 @@ void LightManager::device_update_background(Device *device,
progress.set_status("Updating Lights", "Importance map");
- assert(dscene->data.integrator.use_direct_light);
-
int2 environment_res = make_int2(0, 0);
Shader *shader = scene->background->get_shader(scene);
int num_suns = 0;
@@ -856,6 +854,7 @@ void LightManager::device_update_background(Device *device,
kbackground->sun = make_float4(
sun_direction.x, sun_direction.y, sun_direction.z, half_angle);
+ /* empirical value */
kbackground->sun_weight = 4.0f;
environment_res.x = max(environment_res.x, 512);
environment_res.y = max(environment_res.y, 256);
@@ -1040,6 +1039,8 @@ void LightManager::device_update_points(Device *, DeviceScene *dscene, Scene *sc
else if (light->light_type == LIGHT_BACKGROUND) {
uint visibility = scene->background->get_visibility();
+ dscene->data.background.light_index = light_index;
+
shader_id &= ~SHADER_AREA_LIGHT;
shader_id |= SHADER_USE_MIS;