diff options
Diffstat (limited to 'intern/cycles/scene/scene.cpp')
-rw-r--r-- | intern/cycles/scene/scene.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/intern/cycles/scene/scene.cpp b/intern/cycles/scene/scene.cpp index 2199b2351d0..359e2d8e2c3 100644 --- a/intern/cycles/scene/scene.cpp +++ b/intern/cycles/scene/scene.cpp @@ -489,7 +489,21 @@ void Scene::update_kernel_features() if (use_motion && camera->use_motion()) { kernel_features |= KERNEL_FEATURE_CAMERA_MOTION; } + + /* Figure out whether the scene will use shader raytrace we need at least + * one caustic light, one caustic caster and one caustic receiver to use + * and enable the mnee code path. */ + bool has_caustics_receiver = false; + bool has_caustics_caster = false; + bool has_caustics_light = false; + foreach (Object *object, objects) { + if (object->get_is_caustics_caster()) { + has_caustics_caster = true; + } + else if (object->get_is_caustics_receiver()) { + has_caustics_receiver = true; + } Geometry *geom = object->get_geometry(); if (use_motion) { if (object->use_motion() || geom->get_use_motion_blur()) { @@ -518,6 +532,18 @@ void Scene::update_kernel_features() } } + foreach (Light *light, lights) { + if (light->get_use_caustics()) { + has_caustics_light = true; + } + } + + dscene.data.integrator.use_caustics = false; + if (has_caustics_caster && has_caustics_receiver && has_caustics_light) { + dscene.data.integrator.use_caustics = true; + kernel_features |= KERNEL_FEATURE_NODE_RAYTRACE; + } + if (bake_manager->get_baking()) { kernel_features |= KERNEL_FEATURE_BAKING; } |