diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2016-05-18 02:50:35 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2016-05-18 02:51:30 +0300 |
commit | 6f29dbd0451d5d681cc475b704b0911d0ba10e86 (patch) | |
tree | 20c4ac271bf4bf0ac557fba305110e9724cc7f65 /intern/cycles/render/light.cpp | |
parent | 9dc5367c89f467e516620b6ff15e2eb35b26fdee (diff) |
Fix issue in with multiple importance sampling in recent code refactor.
Diffstat (limited to 'intern/cycles/render/light.cpp')
-rw-r--r-- | intern/cycles/render/light.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp index 4564b935de4..91a9f22276f 100644 --- a/intern/cycles/render/light.cpp +++ b/intern/cycles/render/light.cpp @@ -233,7 +233,9 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen /* count triangles */ if(have_emission) { for(size_t i = 0; i < mesh->triangles.size(); i++) { - Shader *shader = scene->shaders[mesh->shader[i]]; + int shader_index = mesh->shader[i]; + Shader *shader = (shader_index < mesh->used_shaders.size()) ? + mesh->used_shaders[shader_index] : scene->default_surface; if(shader->use_mis && shader->has_surface_emission) num_triangles++; @@ -303,7 +305,9 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen } for(size_t i = 0; i < mesh->triangles.size(); i++) { - Shader *shader = scene->shaders[mesh->shader[i]]; + int shader_index = mesh->shader[i]; + Shader *shader = (shader_index < mesh->used_shaders.size()) ? + mesh->used_shaders[shader_index] : scene->default_surface; if(shader->use_mis && shader->has_surface_emission) { distribution[offset].x = totarea; |