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:
authorDalai Felinto <dfelinto@gmail.com>2016-01-15 18:00:56 +0300
committerDalai Felinto <dfelinto@gmail.com>2016-01-15 18:00:56 +0300
commit9a76354585e2cd2011267e79bd99ca59a06588f8 (patch)
treee775e7c44dc210ef9978b483930ade6a9b4d6fc5 /intern/cycles/render/bake.cpp
parent9137a4401440d3f3206e989f49f3539079d685b8 (diff)
Cycles-Bake: Custom Baking passes
The combined pass is built with the contributions the user finds fit. It is useful for lightmap baking, as well as non-view dependent effects baking. The manual will be updated once we get closer to the 2.77 release. Meanwhile the new page can be found here: http://dalaifelinto.com/blender-manual/render/cycles/baking.html Reviewers: sergey, brecht Differential Revision: https://developer.blender.org/D1674
Diffstat (limited to 'intern/cycles/render/bake.cpp')
-rw-r--r--intern/cycles/render/bake.cpp30
1 files changed, 19 insertions, 11 deletions
diff --git a/intern/cycles/render/bake.cpp b/intern/cycles/render/bake.cpp
index 4bbac0f91d1..6a3adcabeb1 100644
--- a/intern/cycles/render/bake.cpp
+++ b/intern/cycles/render/bake.cpp
@@ -131,7 +131,7 @@ void BakeManager::set_shader_limit(const size_t x, const size_t y)
m_shader_limit = (size_t)pow(2, ceil(log(m_shader_limit)/log(2)));
}
-bool BakeManager::bake(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress, ShaderEvalType shader_type, BakeData *bake_data, float result[])
+bool BakeManager::bake(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress, ShaderEvalType shader_type, const int pass_filter, BakeData *bake_data, float result[])
{
size_t num_pixels = bake_data->size();
@@ -183,6 +183,7 @@ bool BakeManager::bake(Device *device, DeviceScene *dscene, Scene *scene, Progre
task.shader_input = d_input.device_pointer;
task.shader_output = d_output.device_pointer;
task.shader_eval_type = shader_type;
+ task.shader_filter = pass_filter;
task.shader_x = 0;
task.offset = shader_offset;
task.shader_w = d_output.size();
@@ -254,21 +255,28 @@ bool BakeManager::is_aa_pass(ShaderEvalType type)
}
}
-bool BakeManager::is_light_pass(ShaderEvalType type)
+/* Keep it synced with kernel_bake.h::is_light_pass. */
+bool BakeManager::is_light_pass(ShaderEvalType type, const int pass_filter)
{
switch(type) {
case SHADER_EVAL_AO:
- case SHADER_EVAL_COMBINED:
case SHADER_EVAL_SHADOW:
- case SHADER_EVAL_DIFFUSE_DIRECT:
- case SHADER_EVAL_GLOSSY_DIRECT:
- case SHADER_EVAL_TRANSMISSION_DIRECT:
- case SHADER_EVAL_SUBSURFACE_DIRECT:
- case SHADER_EVAL_DIFFUSE_INDIRECT:
- case SHADER_EVAL_GLOSSY_INDIRECT:
- case SHADER_EVAL_TRANSMISSION_INDIRECT:
- case SHADER_EVAL_SUBSURFACE_INDIRECT:
return true;
+ case SHADER_EVAL_DIFFUSE:
+ case SHADER_EVAL_GLOSSY:
+ case SHADER_EVAL_TRANSMISSION:
+ case SHADER_EVAL_SUBSURFACE:
+ return ((pass_filter & BAKE_FILTER_DIRECT) != 0) ||
+ ((pass_filter & BAKE_FILTER_INDIRECT) != 0);
+ 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)));
default:
return false;
}