[Bf-blender-cvs] [b399a6d] master: Fix T49180: Cycles MIS Map for Animated Environment Texture Movie Doesn't Update on Frame Change

Sergey Sharybin noreply at git.blender.org
Fri Sep 2 09:59:26 CEST 2016


Commit: b399a6d33f9b133a26d38fd0e1e5321cbef0693b
Author: Sergey Sharybin
Date:   Fri Sep 2 09:58:41 2016 +0200
Branches: master
https://developer.blender.org/rBb399a6d33f9b133a26d38fd0e1e5321cbef0693b

Fix T49180: Cycles MIS Map for Animated Environment Texture Movie Doesn't Update on Frame Change

Not really ideal fix at all, but we are at RC today, so better to play really safe.

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

M	intern/cycles/render/light.cpp
M	intern/cycles/render/light.h
M	intern/cycles/render/shader.cpp

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

diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp
index 4cd77f8..787e5cf 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 745caa9..040a672 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 165a316..10c3507 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 */




More information about the Bf-blender-cvs mailing list