diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-04-16 20:18:14 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-04-16 20:18:14 +0400 |
commit | c9fc3874d68630c3a4ebeca0c7ae964e5c9a901f (patch) | |
tree | 7b05c3a409c61228b7b93a2d83a9e9558d0eafe4 | |
parent | c1276960e8714828645899391e924f44d13d1043 (diff) |
Cycles: when render layers have per layer number of samples set, the Sampling
panel now has an option to specify how to use them. There's three options:
* Use: render layer samples override scene samples
* Bounded: bound render layer samples by scene samples
* Ignore: ignore render layer sample settings
-rw-r--r-- | intern/cycles/blender/addon/properties.py | 13 | ||||
-rw-r--r-- | intern/cycles/blender/addon/ui.py | 6 | ||||
-rw-r--r-- | intern/cycles/blender/blender_session.cpp | 9 | ||||
-rw-r--r-- | intern/cycles/blender/blender_sync.cpp | 10 | ||||
-rw-r--r-- | intern/cycles/blender/blender_sync.h | 4 |
5 files changed, 36 insertions, 6 deletions
diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py index 5fce5d13a60..a94178f1b42 100644 --- a/intern/cycles/blender/addon/properties.py +++ b/intern/cycles/blender/addon/properties.py @@ -108,6 +108,12 @@ enum_tile_order = ( ('BOTTOM_TO_TOP', "Bottom to Top", "Render from bottom to top"), ) +enum_use_layer_samples = ( + ('USE', "Use", "Per render layer number of samples override scene samples"), + ('BOUNDED', "Bounded", "Bound per render layer number of samples by global samples"), + ('IGNORE', "Ignore", "Ignore per render layer number of samples"), + ) + class CyclesRenderSettings(bpy.types.PropertyGroup): @classmethod @@ -213,6 +219,13 @@ class CyclesRenderSettings(bpy.types.PropertyGroup): default=1, ) + cls.use_layer_samples = EnumProperty( + name="Layer Samples", + description="How to use per render layer sample settings", + items=enum_use_layer_samples, + default='USE', + ) + cls.no_caustics = BoolProperty( name="No Caustics", description="Leave out caustics, resulting in a darker image with less noise", diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index 92e9c622201..e1cd928cc4c 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -85,6 +85,12 @@ class CyclesRender_PT_sampling(CyclesButtonsPanel, Panel): sub.prop(cscene, "mesh_light_samples", text="Mesh Light") sub.prop(cscene, "subsurface_samples", text="Subsurface") + for rl in scene.render.layers: + if rl.samples > 0: + layout.separator() + layout.row().prop(cscene, "use_layer_samples") + break + class CyclesRender_PT_light_paths(CyclesButtonsPanel, Panel): bl_label = "Light Paths" diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp index f4f9ec548a4..f60da169bb1 100644 --- a/intern/cycles/blender/blender_session.cpp +++ b/intern/cycles/blender/blender_session.cpp @@ -362,9 +362,14 @@ void BlenderSession::render() /* update scene */ sync->sync_data(b_v3d, b_engine.camera_override(), b_rlay_name.c_str()); - /* update session */ + /* update number of samples per layer */ int samples = sync->get_layer_samples(); - session->reset(buffer_params, (samples == 0)? session_params.samples: samples); + bool bound_samples = sync->get_layer_bound_samples(); + + if(samples != 0 && (!bound_samples || (samples < session_params.samples))) + session->reset(buffer_params, samples); + else + session->reset(buffer_params, session_params.samples); /* render */ session->start(); diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp index 721eaeefc08..501c7648731 100644 --- a/intern/cycles/blender/blender_sync.cpp +++ b/intern/cycles/blender/blender_sync.cpp @@ -224,12 +224,11 @@ void BlenderSync::sync_film() void BlenderSync::sync_render_layers(BL::SpaceView3D b_v3d, const char *layer) { + PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles"); string layername; /* 3d view */ if(b_v3d) { - PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles"); - if(RNA_boolean_get(&cscene, "preview_active_layer")) { BL::RenderLayers layers(b_scene.render().ptr); layername = layers.active().name(); @@ -245,6 +244,7 @@ void BlenderSync::sync_render_layers(BL::SpaceView3D b_v3d, const char *layer) render_layer.use_background = true; render_layer.use_viewport_visibility = true; render_layer.samples = 0; + render_layer.bound_samples = false; return; } } @@ -252,6 +252,7 @@ void BlenderSync::sync_render_layers(BL::SpaceView3D b_v3d, const char *layer) /* render layer */ BL::RenderSettings r = b_scene.render(); BL::RenderSettings::layers_iterator b_rlay; + int use_layer_samples = RNA_enum_get(&cscene, "use_layer_samples"); bool first_layer = true; for(r.layers.begin(b_rlay); b_rlay != r.layers.end(); ++b_rlay) { @@ -271,7 +272,10 @@ void BlenderSync::sync_render_layers(BL::SpaceView3D b_v3d, const char *layer) render_layer.use_background = b_rlay->use_sky(); render_layer.use_viewport_visibility = false; render_layer.use_localview = false; - render_layer.samples = b_rlay->samples(); + + render_layer.bound_samples = (use_layer_samples == 1); + if(use_layer_samples != 2) + render_layer.samples = b_rlay->samples(); } first_layer = false; diff --git a/intern/cycles/blender/blender_sync.h b/intern/cycles/blender/blender_sync.h index 43073ed9dee..43c8906c799 100644 --- a/intern/cycles/blender/blender_sync.h +++ b/intern/cycles/blender/blender_sync.h @@ -59,6 +59,7 @@ public: void sync_camera(BL::RenderSettings b_render, BL::Object b_override, int width, int height); void sync_view(BL::SpaceView3D b_v3d, BL::RegionView3D b_rv3d, int width, int height); int get_layer_samples() { return render_layer.samples; } + int get_layer_bound_samples() { return render_layer.bound_samples; } /* get parameters */ static SceneParams get_scene_params(BL::Scene b_scene, bool background); @@ -124,7 +125,7 @@ private: material_override(PointerRNA_NULL), use_background(true), use_viewport_visibility(false), - samples(0) + samples(0), bound_samples(false) {} string name; @@ -137,6 +138,7 @@ private: bool use_viewport_visibility; bool use_localview; int samples; + bool bound_samples; } render_layer; Progress &progress; |