diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-07-28 13:37:44 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-07-28 13:37:44 +0300 |
commit | df0052964860ad98d1147400d256029d519a313b (patch) | |
tree | 2f9bc1fdd5a504aaf5695827cb99e7f7951043eb /intern | |
parent | 9f18e3acd6bffb15a268e4375394328d9869ac38 (diff) |
Cycles: Fix missing mesh flags update when tweaking shaders
This is a bit weak, but better than tagging whole mesh manager for update.
Maybe we'll solve such dual-look up in the future.
This commit finally solves T48963: Noise when changing Diffuse node to Emission node
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/render/light.cpp | 12 | ||||
-rw-r--r-- | intern/cycles/render/mesh.cpp | 5 | ||||
-rw-r--r-- | intern/cycles/render/mesh.h | 1 |
3 files changed, 9 insertions, 9 deletions
diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp index d97c1aefc89..ae6042cef34 100644 --- a/intern/cycles/render/light.cpp +++ b/intern/cycles/render/light.cpp @@ -220,10 +220,16 @@ bool LightManager::object_usable_as_light(Object *object) { return false; } /* Skip if we have no emission shaders. */ - if(!mesh->has_mis_emission) { - return false; + /* TODO(sergey): Ideally we want to avoid such duplicated loop, since it'll + * iterate all mesh shaders twice (when counting and when calculating + * triangle area. + */ + foreach(const Shader *shader, mesh->used_shaders) { + if(shader->use_mis && shader->has_surface_emission) { + return true; + } } - return true; + return false; } void LightManager::device_update_distribution(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress) diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp index 74880f5c192..8b0ed9f77b2 100644 --- a/intern/cycles/render/mesh.cpp +++ b/intern/cycles/render/mesh.cpp @@ -156,7 +156,6 @@ Mesh::Mesh() geometry_flags = GEOMETRY_NONE; has_volume = false; - has_mis_emission = false; has_surface_bssrdf = false; } @@ -1290,14 +1289,10 @@ void MeshManager::device_update_flags(Device * /*device*/, /* update flags */ foreach(Mesh *mesh, scene->meshes) { mesh->has_volume = false; - mesh->has_mis_emission = false; foreach(const Shader *shader, mesh->used_shaders) { if(shader->has_volume) { mesh->has_volume = true; } - if(shader->use_mis && shader->has_surface_emission) { - mesh->has_mis_emission = true; - } if(shader->has_surface_bssrdf) { mesh->has_surface_bssrdf = true; } diff --git a/intern/cycles/render/mesh.h b/intern/cycles/render/mesh.h index 8225463214d..0aea55544f2 100644 --- a/intern/cycles/render/mesh.h +++ b/intern/cycles/render/mesh.h @@ -122,7 +122,6 @@ public: array<bool> forms_quad; /* used to tell if triangle is part of a quad patch */ bool has_volume; /* Set in the device_update_flags(). */ - bool has_mis_emission; /* Set in the device_update_flags(). */ bool has_surface_bssrdf; /* Set in the device_update_flags(). */ array<float3> curve_keys; |