From 65cbcde831d4dcefcc92abdc63d9fe785e6cff4c Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 2 Jul 2013 21:03:16 +0000 Subject: Fix cycles world ray visibility not working correct with multiple importance sampling. --- intern/cycles/render/light.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'intern') diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp index 5ac21ed5996..276647e6b2f 100644 --- a/intern/cycles/render/light.cpp +++ b/intern/cycles/render/light.cpp @@ -16,6 +16,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include "background.h" #include "device.h" #include "integrator.h" #include "film.h" @@ -568,9 +569,24 @@ void LightManager::device_update_points(Device *device, DeviceScene *dscene, Sce light_data[i*LIGHT_SIZE + 3] = make_float4(samples, 0.0f, 0.0f, 0.0f); } else if(light->type == LIGHT_BACKGROUND) { + uint visibility = scene->background->visibility; + shader_id &= ~SHADER_AREA_LIGHT; shader_id |= SHADER_USE_MIS; + if(!(visibility & PATH_RAY_DIFFUSE)) { + shader_id |= SHADER_EXCLUDE_DIFFUSE; + use_light_visibility = true; + } + if(!(visibility & PATH_RAY_GLOSSY)) { + shader_id |= SHADER_EXCLUDE_GLOSSY; + use_light_visibility = true; + } + if(!(visibility & PATH_RAY_TRANSMIT)) { + shader_id |= SHADER_EXCLUDE_TRANSMIT; + use_light_visibility = true; + } + light_data[i*LIGHT_SIZE + 0] = make_float4(__int_as_float(light->type), 0.0f, 0.0f, 0.0f); light_data[i*LIGHT_SIZE + 1] = make_float4(__int_as_float(shader_id), 0.0f, 0.0f, 0.0f); light_data[i*LIGHT_SIZE + 2] = make_float4(0.0f, 0.0f, 0.0f, 0.0f); -- cgit v1.2.3