diff options
-rw-r--r-- | intern/cycles/blender/addon/presets.py | 1 | ||||
-rw-r--r-- | intern/cycles/blender/addon/properties.py | 6 | ||||
-rw-r--r-- | intern/cycles/blender/addon/ui.py | 16 | ||||
-rw-r--r-- | intern/cycles/blender/addon/version_update.py | 20 | ||||
-rw-r--r-- | intern/cycles/blender/blender_object.cpp | 14 | ||||
-rw-r--r-- | intern/cycles/blender/blender_sync.cpp | 47 |
6 files changed, 72 insertions, 32 deletions
diff --git a/intern/cycles/blender/addon/presets.py b/intern/cycles/blender/addon/presets.py index dd4e8e60a42..17efb00abdb 100644 --- a/intern/cycles/blender/addon/presets.py +++ b/intern/cycles/blender/addon/presets.py @@ -67,6 +67,7 @@ class AddPresetSampling(AddPresetBase, Operator): "cycles.mesh_light_samples", "cycles.subsurface_samples", "cycles.volume_samples", + "cycles.use_square_samples", "cycles.progressive", "cycles.seed", "cycles.sample_clamp_direct", diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py index cb95bfb5b2a..7b16ef1d543 100644 --- a/intern/cycles/blender/addon/properties.py +++ b/intern/cycles/blender/addon/properties.py @@ -172,6 +172,12 @@ class CyclesRenderSettings(bpy.types.PropertyGroup): default='PATH', ) + cls.use_square_samples = BoolProperty( + name="Square Samples", + description="Square sampling values for easier artist control", + default=False, + ) + cls.samples = IntProperty( name="Samples", description="Number of samples to render for each pixel", diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index d8c2bde0b02..23425ab265a 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -100,6 +100,8 @@ def draw_samples_info(layout, context): # Calculate sample values if integrator == 'PATH': aa = cscene.samples + if cscene.use_square_samples: + aa = aa * aa else: aa = cscene.aa_samples d = cscene.diffuse_samples @@ -110,9 +112,19 @@ def draw_samples_info(layout, context): sss = cscene.subsurface_samples vol = cscene.volume_samples + if cscene.use_square_samples: + aa = aa * aa + d = d * d + g = g * g + t = t * t + ao = ao * ao + ml = ml * ml + sss = sss * sss + vol = vol * vol + # Draw interface # Do not draw for progressive, when Square Samples are disabled - if use_branched_path(context): + if use_branched_path(context) or (cscene.use_square_samples and integrator == 'PATH'): col = layout.column(align=True) col.scale_y = 0.6 col.label("Total Samples:") @@ -145,7 +157,7 @@ class CyclesRender_PT_sampling(CyclesButtonsPanel, Panel): row = layout.row() sub = row.row() sub.prop(cscene, "progressive", text="") - sub.label() + row.prop(cscene, "use_square_samples") split = layout.split() diff --git a/intern/cycles/blender/addon/version_update.py b/intern/cycles/blender/addon/version_update.py index a37ac38c101..efd794461d6 100644 --- a/intern/cycles/blender/addon/version_update.py +++ b/intern/cycles/blender/addon/version_update.py @@ -315,23 +315,3 @@ def do_versions(self): cscene.blur_glossy = 0.0 if not cscene.is_property_set("sample_clamp_indirect"): cscene.sample_clamp_indirect = 0.0 - - # Remove and apply square samples - use_square_samples = cscene.get("use_square_samples", False) - if use_square_samples: - del cscene["use_square_samples"] - - cscene.samples *= cscene.samples - cscene.preview_samples *= cscene.preview_samples - cscene.aa_samples *= cscene.aa_samples - cscene.preview_aa_samples *= cscene.preview_aa_samples - cscene.diffuse_samples *= cscene.diffuse_samples - cscene.glossy_samples *= cscene.glossy_samples - cscene.transmission_samples *= cscene.transmission_samples - cscene.ao_samples *= cscene.ao_samples - cscene.mesh_light_samples *= cscene.mesh_light_samples - cscene.subsurface_samples *= cscene.subsurface_samples - cscene.volume_samples *= cscene.volume_samples - - for layer in scene.render.layers: - layer.samples *= layer.samples diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp index 82623d538b2..a930c439370 100644 --- a/intern/cycles/blender/blender_object.cpp +++ b/intern/cycles/blender/blender_object.cpp @@ -162,11 +162,16 @@ void BlenderSync::sync_light(BL::Object& b_parent, light->shader = used_shaders[0]; /* shadow */ + PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles"); PointerRNA clamp = RNA_pointer_get(&b_lamp.ptr, "cycles"); light->cast_shadow = get_boolean(clamp, "cast_shadow"); light->use_mis = get_boolean(clamp, "use_multiple_importance_sampling"); - light->samples = get_int(clamp, "samples"); + int samples = get_int(clamp, "samples"); + if(get_boolean(cscene, "use_square_samples")) + light->samples = samples * samples; + else + light->samples = samples; light->max_bounces = get_int(clamp, "max_bounces"); @@ -194,6 +199,7 @@ void BlenderSync::sync_background_light(bool use_portal) BL::World b_world = b_scene.world(); if(b_world) { + PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles"); PointerRNA cworld = RNA_pointer_get(&b_world.ptr, "cycles"); bool sample_as_light = get_boolean(cworld, "sample_as_light"); @@ -212,7 +218,11 @@ void BlenderSync::sync_background_light(bool use_portal) light->use_mis = sample_as_light; light->max_bounces = get_int(cworld, "max_bounces"); - light->samples = get_int(cworld, "samples"); + int samples = get_int(cworld, "samples"); + if(get_boolean(cscene, "use_square_samples")) + light->samples = samples * samples; + else + light->samples = samples; light->tag_update(scene); light_map.set_recalc(b_world); diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp index a858af253d4..2d5b151f256 100644 --- a/intern/cycles/blender/blender_sync.cpp +++ b/intern/cycles/blender/blender_sync.cpp @@ -291,13 +291,32 @@ void BlenderSync::sync_integrator() integrator->sample_all_lights_indirect = get_boolean(cscene, "sample_all_lights_indirect"); integrator->light_sampling_threshold = get_float(cscene, "light_sampling_threshold"); - integrator->diffuse_samples = get_int(cscene, "diffuse_samples"); - integrator->glossy_samples = get_int(cscene, "glossy_samples"); - integrator->transmission_samples = get_int(cscene, "transmission_samples"); - integrator->ao_samples = get_int(cscene, "ao_samples"); - integrator->mesh_light_samples = get_int(cscene, "mesh_light_samples"); - integrator->subsurface_samples = get_int(cscene, "subsurface_samples"); - integrator->volume_samples = get_int(cscene, "volume_samples"); + int diffuse_samples = get_int(cscene, "diffuse_samples"); + int glossy_samples = get_int(cscene, "glossy_samples"); + int transmission_samples = get_int(cscene, "transmission_samples"); + int ao_samples = get_int(cscene, "ao_samples"); + int mesh_light_samples = get_int(cscene, "mesh_light_samples"); + int subsurface_samples = get_int(cscene, "subsurface_samples"); + int volume_samples = get_int(cscene, "volume_samples"); + + if(get_boolean(cscene, "use_square_samples")) { + integrator->diffuse_samples = diffuse_samples * diffuse_samples; + integrator->glossy_samples = glossy_samples * glossy_samples; + integrator->transmission_samples = transmission_samples * transmission_samples; + integrator->ao_samples = ao_samples * ao_samples; + integrator->mesh_light_samples = mesh_light_samples * mesh_light_samples; + integrator->subsurface_samples = subsurface_samples * subsurface_samples; + integrator->volume_samples = volume_samples * volume_samples; + } + else { + integrator->diffuse_samples = diffuse_samples; + integrator->glossy_samples = glossy_samples; + integrator->transmission_samples = transmission_samples; + integrator->ao_samples = ao_samples; + integrator->mesh_light_samples = mesh_light_samples; + integrator->subsurface_samples = subsurface_samples; + integrator->volume_samples = volume_samples; + } if(b_scene.render().use_simplify()) { if(preview) { @@ -415,7 +434,11 @@ void BlenderSync::sync_render_layers(BL::SpaceView3D& b_v3d, const char *layer) render_layer.bound_samples = (use_layer_samples == 1); if(use_layer_samples != 2) { - render_layer.samples = b_rlay->samples(); + int samples = b_rlay->samples(); + if(get_boolean(cscene, "use_square_samples")) + render_layer.samples = samples * samples; + else + render_layer.samples = samples; } } @@ -730,6 +753,14 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine& b_engine, int preview_samples = get_int(cscene, "preview_samples"); int preview_aa_samples = get_int(cscene, "preview_aa_samples"); + if(get_boolean(cscene, "use_square_samples")) { + aa_samples = aa_samples * aa_samples; + preview_aa_samples = preview_aa_samples * preview_aa_samples; + + samples = samples * samples; + preview_samples = preview_samples * preview_samples; + } + if(get_enum(cscene, "progressive") == 0) { if(background) { params.samples = aa_samples; |