diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp index 4cd77f8c6e1..787e5cf07b2 100644 --- a/intern/cycles/render/light.cpp +++ b/intern/cycles/render/light.cpp @@ -177,6 +177,16 @@ LightManager::~LightManager() { } +bool LightManager::has_background_light(Scene *scene) +{ + foreach(Light *light, scene->lights) { + if(light->type == LIGHT_BACKGROUND) { + return true; + } + } + return false; +} + void LightManager::disable_ineffective_light(Device *device, Scene *scene) { /* Make all lights enabled by default, and perform some preliminary checks diff --git a/intern/cycles/render/light.h b/intern/cycles/render/light.h index 745caa96159..040a672937d 100644 --- a/intern/cycles/render/light.h +++ b/intern/cycles/render/light.h @@ -91,6 +91,9 @@ public: void tag_update(Scene *scene); + /* Check whether there is a background light. */ + bool has_background_light(Scene *scene); + protected: /* Optimization: disable light which is either unsupported or * which doesn't contribute to the scene or which is only used for MIS diff --git a/intern/cycles/render/shader.cpp b/intern/cycles/render/shader.cpp index 165a316ea76..10c3507e3f4 100644 --- a/intern/cycles/render/shader.cpp +++ b/intern/cycles/render/shader.cpp @@ -221,6 +221,16 @@ void Shader::tag_update(Scene *scene) if(use_mis && has_surface_emission) scene->light_manager->need_update = true; + /* Special handle of background MIS light for now: for some reason it + * has use_mis set to false. We are quite close to release now, so + * better to be safe. + */ + if(this == scene->default_background && + scene->light_manager->has_background_light(scene)) + { + scene->light_manager->need_update = true; + } + /* quick detection of which kind of shaders we have to avoid loading * e.g. surface attributes when there is only a volume shader. this could * be more fine grained but it's better than nothing */