Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2016-02-06 22:35:36 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2016-02-06 23:02:02 +0300
commit7faa9d1304bc500185684a41f8bd65fb4893b8bb (patch)
tree02e6351c2be5955373bb9797a1b87f8d661e9599 /intern/cycles/render/bake.cpp
parentc502114ee11dcd2e737452944b652205517b5682 (diff)
Fix T46550: Cycles combined baking black in some cases.
Now pass_filter is modified to have exactly the flags for the light components that need to be baked, based on the shader type. This simplifies the logic.
Diffstat (limited to 'intern/cycles/render/bake.cpp')
-rw-r--r--intern/cycles/render/bake.cpp26
1 files changed, 12 insertions, 14 deletions
diff --git a/intern/cycles/render/bake.cpp b/intern/cycles/render/bake.cpp
index 6a3adcabeb1..5bf5e5113ef 100644
--- a/intern/cycles/render/bake.cpp
+++ b/intern/cycles/render/bake.cpp
@@ -255,30 +255,28 @@ bool BakeManager::is_aa_pass(ShaderEvalType type)
}
}
-/* Keep it synced with kernel_bake.h::is_light_pass. */
-bool BakeManager::is_light_pass(ShaderEvalType type, const int pass_filter)
+/* Keep it synced with kernel_bake.h logic */
+int BakeManager::shader_type_to_pass_filter(ShaderEvalType type, const int pass_filter)
{
+ const int component_flags = pass_filter & (BAKE_FILTER_DIRECT | BAKE_FILTER_INDIRECT | BAKE_FILTER_COLOR);
+
switch(type) {
case SHADER_EVAL_AO:
+ return BAKE_FILTER_AO;
case SHADER_EVAL_SHADOW:
- return true;
+ return BAKE_FILTER_DIRECT;
case SHADER_EVAL_DIFFUSE:
+ return BAKE_FILTER_DIFFUSE | component_flags;
case SHADER_EVAL_GLOSSY:
+ return BAKE_FILTER_GLOSSY | component_flags;
case SHADER_EVAL_TRANSMISSION:
+ return BAKE_FILTER_TRANSMISSION | component_flags;
case SHADER_EVAL_SUBSURFACE:
- return ((pass_filter & BAKE_FILTER_DIRECT) != 0) ||
- ((pass_filter & BAKE_FILTER_INDIRECT) != 0);
+ return BAKE_FILTER_SUBSURFACE | component_flags;
case SHADER_EVAL_COMBINED:
- return ((pass_filter & BAKE_FILTER_AO) != 0) ||
- ((pass_filter & BAKE_FILTER_EMISSION) != 0) ||
- ((((pass_filter & BAKE_FILTER_DIRECT) != 0) ||
- ((pass_filter & BAKE_FILTER_INDIRECT) != 0)) &&
- (((pass_filter & BAKE_FILTER_DIFFUSE) != 0) ||
- ((pass_filter & BAKE_FILTER_GLOSSY) != 0) ||
- ((pass_filter & BAKE_FILTER_TRANSMISSION) != 0) ||
- ((pass_filter & BAKE_FILTER_SUBSURFACE) != 0)));
+ return pass_filter;
default:
- return false;
+ return 0;
}
}