diff options
Diffstat (limited to 'intern/cycles/render')
-rw-r--r-- | intern/cycles/render/light.cpp | 5 | ||||
-rw-r--r-- | intern/cycles/render/shader.cpp | 31 |
2 files changed, 26 insertions, 10 deletions
diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp index a5854f022cd..755b941717e 100644 --- a/intern/cycles/render/light.cpp +++ b/intern/cycles/render/light.cpp @@ -185,7 +185,7 @@ LightManager::~LightManager() bool LightManager::has_background_light(Scene *scene) { foreach(Light *light, scene->lights) { - if(light->type == LIGHT_BACKGROUND) { + if(light->type == LIGHT_BACKGROUND && light->is_enabled) { return true; } } @@ -211,8 +211,7 @@ void LightManager::disable_ineffective_light(Device *device, Scene *scene) * - If we don't need it (no HDRs etc.) */ Shader *shader = (scene->background->shader) ? scene->background->shader : scene->default_background; - bool disable_mis = !(has_portal || shader->has_surface_spatial_varying) || - !(device->info.advanced_shading); + bool disable_mis = !(has_portal || shader->has_surface_spatial_varying); if(disable_mis) { VLOG(1) << "Background MIS has been disabled.\n"; foreach(Light *light, scene->lights) { diff --git a/intern/cycles/render/shader.cpp b/intern/cycles/render/shader.cpp index 21bac460255..3c94f2dfb59 100644 --- a/intern/cycles/render/shader.cpp +++ b/intern/cycles/render/shader.cpp @@ -220,20 +220,37 @@ bool Shader::is_constant_emission(float3 *emission) { ShaderInput *surf = graph->output()->input("Surface"); - if(!surf->link || surf->link->parent->type != EmissionNode::node_type) { + if(surf->link == NULL) { return false; } - EmissionNode *node = (EmissionNode*) surf->link->parent; + if(surf->link->parent->type == EmissionNode::node_type) { + EmissionNode *node = (EmissionNode*) surf->link->parent; - assert(node->input("Color")); - assert(node->input("Strength")); + assert(node->input("Color")); + assert(node->input("Strength")); - if(node->input("Color")->link || node->input("Strength")->link) { - return false; + if(node->input("Color")->link || node->input("Strength")->link) { + return false; + } + + *emission = node->color*node->strength; } + else if(surf->link->parent->type == BackgroundNode::node_type) { + BackgroundNode *node = (BackgroundNode*) surf->link->parent; - *emission = node->color*node->strength; + assert(node->input("Color")); + assert(node->input("Strength")); + + if(node->input("Color")->link || node->input("Strength")->link) { + return false; + } + + *emission = node->color*node->strength; + } + else { + return false; + } return true; } |