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
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2013-02-13 20:46:18 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2013-02-13 20:46:18 +0400
commit909d64079a228dfa9cccf8ed718efc322a038e7e (patch)
treed903b43413599f43395e1d7383340557427fc6ec /intern/cycles/render/light.cpp
parent8a20930c71dee32337cd15f3d36fa3574c6c9eea (diff)
Fix #34226: cycles shadow pass got incorrectly influenced by world multiple
importance sampleing.
Diffstat (limited to 'intern/cycles/render/light.cpp')
-rw-r--r--intern/cycles/render/light.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp
index e7fb9514371..ccc6c5142bd 100644
--- a/intern/cycles/render/light.cpp
+++ b/intern/cycles/render/light.cpp
@@ -143,6 +143,7 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen
/* count */
size_t num_lights = scene->lights.size();
+ size_t num_background_lights = 0;
size_t num_triangles = 0;
size_t num_curve_segments = 0;
@@ -306,6 +307,8 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen
if(light->size > 0.0f && light->use_mis)
use_lamp_mis = true;
+ if(light->type == LIGHT_BACKGROUND)
+ num_background_lights++;
}
/* normalize cumulative distribution functions */
@@ -324,6 +327,7 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen
/* update device */
KernelIntegrator *kintegrator = &dscene->data.integrator;
+ KernelFilm *kfilm = &dscene->data.film;
kintegrator->use_direct_light = (totarea > 0.0f);
if(kintegrator->use_direct_light) {
@@ -354,6 +358,16 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen
kintegrator->use_lamp_mis = use_lamp_mis;
+ /* bit of an ugly hack to compensate for emitting triangles influencing
+ * amount of samples we get for this pass */
+ if(scene->integrator->progressive && kintegrator->pdf_triangles != 0.0f)
+ kfilm->pass_shadow_scale = 0.5f;
+ else
+ kfilm->pass_shadow_scale = 1.0f;
+
+ if(num_background_lights < num_lights)
+ kfilm->pass_shadow_scale *= (float)(num_lights - num_background_lights)/(float)num_lights;
+
/* CDF */
device->tex_alloc("__light_distribution", dscene->light_distribution);
}
@@ -366,6 +380,7 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen
kintegrator->pdf_lights = 0.0f;
kintegrator->inv_pdf_lights = 0.0f;
kintegrator->use_lamp_mis = false;
+ kfilm->pass_shadow_scale = 1.0f;
}
}