diff options
Diffstat (limited to 'intern/cycles/render/mesh_displace.cpp')
-rw-r--r-- | intern/cycles/render/mesh_displace.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
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; |