diff options
Diffstat (limited to 'intern/cycles/render')
-rw-r--r-- | intern/cycles/render/film.cpp | 4 | ||||
-rw-r--r-- | intern/cycles/render/film.h | 2 | ||||
-rw-r--r-- | intern/cycles/render/light.cpp | 38 | ||||
-rw-r--r-- | intern/cycles/render/light.h | 3 |
4 files changed, 43 insertions, 4 deletions
diff --git a/intern/cycles/render/film.cpp b/intern/cycles/render/film.cpp index 1fe30376adc..43aef755ba3 100644 --- a/intern/cycles/render/film.cpp +++ b/intern/cycles/render/film.cpp @@ -259,6 +259,8 @@ Film::Film() mist_depth = 100.0f; mist_falloff = 1.0f; + use_light_visibility = false; + need_update = true; } @@ -279,7 +281,7 @@ void Film::device_update(Device *device, DeviceScene *dscene, Scene *scene) kfilm->exposure = exposure; kfilm->pass_flag = 0; kfilm->pass_stride = 0; - kfilm->use_light_pass = 0; + kfilm->use_light_pass = use_light_visibility; foreach(Pass& pass, passes) { kfilm->pass_flag |= pass.type; diff --git a/intern/cycles/render/film.h b/intern/cycles/render/film.h index 1df0e95a48a..0147306c1e3 100644 --- a/intern/cycles/render/film.h +++ b/intern/cycles/render/film.h @@ -61,6 +61,8 @@ public: float mist_depth; float mist_falloff; + bool use_light_visibility; + bool need_update; Film(); diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp index 1d2acf79b6c..71e1f57eb36 100644 --- a/intern/cycles/render/light.cpp +++ b/intern/cycles/render/light.cpp @@ -18,6 +18,7 @@ #include "device.h" #include "integrator.h" +#include "film.h" #include "light.h" #include "mesh.h" #include "object.h" @@ -116,6 +117,9 @@ Light::Light() cast_shadow = true; use_mis = false; + use_diffuse = true; + use_glossy = true; + use_transmission = true; shader = 0; samples = 1; @@ -221,17 +225,31 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen bool transform_applied = mesh->transform_applied; Transform tfm = object->tfm; int object_id = j; + int shader_id = SHADER_MASK; if(transform_applied) object_id = ~object_id; + if(!(object->visibility & PATH_RAY_DIFFUSE)) { + shader_id |= SHADER_EXCLUDE_DIFFUSE; + scene->film->use_light_visibility = true; + } + if(!(object->visibility & PATH_RAY_GLOSSY)) { + shader_id |= SHADER_EXCLUDE_GLOSSY; + scene->film->use_light_visibility = true; + } + if(!(object->visibility & PATH_RAY_TRANSMIT)) { + shader_id |= SHADER_EXCLUDE_TRANSMIT; + scene->film->use_light_visibility = true; + } + for(size_t i = 0; i < mesh->triangles.size(); i++) { Shader *shader = scene->shaders[mesh->shader[i]]; if(shader->sample_as_light && shader->has_surface_emission) { distribution[offset].x = totarea; distribution[offset].y = __int_as_float(i + mesh->tri_offset); - distribution[offset].z = __int_as_float(~0); + distribution[offset].z = __int_as_float(shader_id); distribution[offset].w = __int_as_float(object_id); offset++; @@ -250,7 +268,7 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen } } - /*sample as light disabled for strands*/ + /* sample as light disabled for strands */ #if 0 size_t i = 0; @@ -262,7 +280,7 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen for(int j = 0; j < curve.num_segments(); j++) { distribution[offset].x = totarea; distribution[offset].y = __int_as_float(i + mesh->curve_offset); // XXX fix kernel code - distribution[offset].z = __int_as_float(j); + distribution[offset].z = __int_as_float(j) & SHADER_MASK; distribution[offset].w = __int_as_float(object_id); offset++; @@ -493,6 +511,7 @@ void LightManager::device_update_points(Device *device, DeviceScene *dscene, Sce } } } + scene->film->use_light_visibility = false; for(size_t i = 0; i < scene->lights.size(); i++) { Light *light = scene->lights[i]; @@ -504,6 +523,19 @@ void LightManager::device_update_points(Device *device, DeviceScene *dscene, Sce if(!light->cast_shadow) shader_id &= ~SHADER_CAST_SHADOW; + if(!light->use_diffuse) { + shader_id |= SHADER_EXCLUDE_DIFFUSE; + scene->film->use_light_visibility = true; + } + if(!light->use_glossy) { + shader_id |= SHADER_EXCLUDE_GLOSSY; + scene->film->use_light_visibility = true; + } + if(!light->use_transmission) { + shader_id |= SHADER_EXCLUDE_TRANSMIT; + scene->film->use_light_visibility = true; + } + if(light->type == LIGHT_POINT) { shader_id &= ~SHADER_AREA_LIGHT; diff --git a/intern/cycles/render/light.h b/intern/cycles/render/light.h index acd1692a41f..0e833fdea1d 100644 --- a/intern/cycles/render/light.h +++ b/intern/cycles/render/light.h @@ -53,6 +53,9 @@ public: bool cast_shadow; bool use_mis; + bool use_diffuse; + bool use_glossy; + bool use_transmission; int shader; int samples; |