diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2016-05-18 02:50:35 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2016-06-08 22:45:40 +0300 |
commit | c14b0f3f7a623d2d437e478a1a4e5413a939bebe (patch) | |
tree | bfef326708c05d07e1c202f3897f2ea1e018ae29 | |
parent | 8fb974d7ce6f2cafda224590588e14df3fd2dd65 (diff) |
Fix issue in with multiple importance sampling in recent code refactor.
-rw-r--r-- | intern/cycles/render/light.cpp | 8 | ||||
-rw-r--r-- | intern/cycles/render/mesh_displace.cpp | 8 |
2 files changed, 12 insertions, 4 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; diff --git a/intern/cycles/render/mesh_displace.cpp b/intern/cycles/render/mesh_displace.cpp index df8be4cbe2f..d19bf2084d7 100644 --- a/intern/cycles/render/mesh_displace.cpp +++ b/intern/cycles/render/mesh_displace.cpp @@ -62,7 +62,9 @@ bool MeshManager::displace(Device *device, DeviceScene *dscene, Scene *scene, Me for(size_t i = 0; i < mesh->triangles.size(); i++) { Mesh::Triangle t = mesh->triangles[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->has_displacement) continue; @@ -146,7 +148,9 @@ bool MeshManager::displace(Device *device, DeviceScene *dscene, Scene *scene, Me Attribute *attr_mP = mesh->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION); for(size_t i = 0; i < mesh->triangles.size(); i++) { Mesh::Triangle t = mesh->triangles[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->has_displacement) continue; |