diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-11-24 11:21:40 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-11-24 11:21:40 +0300 |
commit | fa6bdfd622999fa5f0550f879716a904991b33a6 (patch) | |
tree | 697008759db5918e54e82e77c32009ed9c398afa /intern/cycles | |
parent | 31cc60e76bfa81783e61a7b01586de9547de0174 (diff) |
Cycles: Support per-render layer world AO settings
This is sort of extension of existing Use Environment option which now allows to
disable AO on the render layer basis.
Useful in cases like disabling AO for the background because it might make it
too flat and so.
Reviewers: juicyfruit, dingto, brecht
Reviewed By: brecht
Subscribers: eyecandy, venomgfx
Differential Revision: https://developer.blender.org/D1633
Diffstat (limited to 'intern/cycles')
-rw-r--r-- | intern/cycles/blender/addon/ui.py | 1 | ||||
-rw-r--r-- | intern/cycles/blender/blender_shader.cpp | 3 | ||||
-rw-r--r-- | intern/cycles/blender/blender_sync.cpp | 6 | ||||
-rw-r--r-- | intern/cycles/blender/blender_sync.h | 6 | ||||
-rw-r--r-- | intern/cycles/render/background.cpp | 18 | ||||
-rw-r--r-- | intern/cycles/render/background.h | 3 |
6 files changed, 26 insertions, 11 deletions
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index 3678391ccd5..e2aa266d53b 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -387,6 +387,7 @@ class CyclesRender_PT_layer_options(CyclesButtonsPanel, Panel): col = split.column() col.prop(rl, "use_sky", "Use Environment") + col.prop(rl, "use_ao", "Use AO") col.prop(rl, "use_solid", "Use Surfaces") col.prop(rl, "use_strand", "Use Hair") diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp index 81204aaa13a..5bbdeb6061b 100644 --- a/intern/cycles/blender/blender_shader.cpp +++ b/intern/cycles/blender/blender_shader.cpp @@ -1188,7 +1188,8 @@ void BlenderSync::sync_world(bool update_all) else background->transparent = b_scene.render().alpha_mode() == BL::RenderSettings::alpha_mode_TRANSPARENT; - background->use = render_layer.use_background; + background->use_shader = render_layer.use_background_shader; + background->use_ao = render_layer.use_background_ao; if(background->modified(prevbackground)) background->tag_update(scene); diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp index 986e90c59f7..4b2fa61e01c 100644 --- a/intern/cycles/blender/blender_sync.cpp +++ b/intern/cycles/blender/blender_sync.cpp @@ -327,7 +327,8 @@ void BlenderSync::sync_render_layers(BL::SpaceView3D b_v3d, const char *layer) render_layer.exclude_layer = 0; render_layer.holdout_layer = 0; render_layer.material_override = PointerRNA_NULL; - render_layer.use_background = true; + render_layer.use_background_shader = true; + render_layer.use_background_ao = true; render_layer.use_hair = true; render_layer.use_surfaces = true; render_layer.use_viewport_visibility = true; @@ -359,7 +360,8 @@ void BlenderSync::sync_render_layers(BL::SpaceView3D b_v3d, const char *layer) render_layer.layer |= render_layer.holdout_layer; render_layer.material_override = b_rlay->material_override(); - render_layer.use_background = b_rlay->use_sky(); + render_layer.use_background_shader = b_rlay->use_sky(); + render_layer.use_background_ao = b_rlay->use_ao(); render_layer.use_surfaces = b_rlay->use_solid(); render_layer.use_hair = b_rlay->use_strand(); render_layer.use_viewport_visibility = false; diff --git a/intern/cycles/blender/blender_sync.h b/intern/cycles/blender/blender_sync.h index efc6ae94542..2eb153a6f74 100644 --- a/intern/cycles/blender/blender_sync.h +++ b/intern/cycles/blender/blender_sync.h @@ -150,7 +150,8 @@ private: : scene_layer(0), layer(0), holdout_layer(0), exclude_layer(0), material_override(PointerRNA_NULL), - use_background(true), + use_background_shader(true), + use_background_ao(true), use_surfaces(true), use_hair(true), use_viewport_visibility(false), @@ -164,7 +165,8 @@ private: uint holdout_layer; uint exclude_layer; BL::Material material_override; - bool use_background; + bool use_background_shader; + bool use_background_ao; bool use_surfaces; bool use_hair; bool use_viewport_visibility; diff --git a/intern/cycles/render/background.cpp b/intern/cycles/render/background.cpp index 5fd7bd8f16f..0cd164dc03e 100644 --- a/intern/cycles/render/background.cpp +++ b/intern/cycles/render/background.cpp @@ -33,7 +33,8 @@ Background::Background() ao_factor = 0.0f; ao_distance = FLT_MAX; - use = true; + use_shader = true; + use_ao = false; visibility = PATH_RAY_ALL_VISIBILITY; shader = 0; @@ -53,7 +54,7 @@ void Background::device_update(Device *device, DeviceScene *dscene, Scene *scene device_free(device, dscene); - if(use) + if(use_shader) shader = scene->default_background; else shader = scene->default_empty; @@ -61,8 +62,14 @@ void Background::device_update(Device *device, DeviceScene *dscene, Scene *scene /* set shader index and transparent option */ KernelBackground *kbackground = &dscene->data.background; - kbackground->ao_factor = ao_factor; - kbackground->ao_distance = ao_distance; + if(use_ao) { + kbackground->ao_factor = ao_factor; + kbackground->ao_distance = ao_distance; + } + else { + kbackground->ao_factor = 0.0f; + kbackground->ao_distance = FLT_MAX; + } kbackground->transparent = transparent; kbackground->surface_shader = scene->shader_manager->get_shader_id(shader); @@ -100,7 +107,8 @@ void Background::device_free(Device * /*device*/, DeviceScene * /*dscene*/) bool Background::modified(const Background& background) { return !(transparent == background.transparent && - use == background.use && + use_shader == background.use_shader && + use_ao == background.use_ao && ao_factor == background.ao_factor && ao_distance == background.ao_distance && visibility == background.visibility); diff --git a/intern/cycles/render/background.h b/intern/cycles/render/background.h index 26a727291ee..8bf97f5d6f7 100644 --- a/intern/cycles/render/background.h +++ b/intern/cycles/render/background.h @@ -30,7 +30,8 @@ public: float ao_factor; float ao_distance; - bool use; + bool use_shader; + bool use_ao; uint visibility; uint shader; |