Cycles / Sampling UI:
authorThomas Dinges <blender@dingto.org>
Thu, 22 Aug 2013 19:57:56 +0000 (19:57 +0000)
committerThomas Dinges <blender@dingto.org>
Thu, 22 Aug 2013 19:57:56 +0000 (19:57 +0000)
* Add a "Total Samples" info at the bottom of the panel.
This makes understanding the Non-Progressive integrator easier, as it displays how many samples are used for the different ray types.

* Rename Squared Samples to Square samples, to indicate that the action is not already done. The new Total Samples info should make this easier to understand now as well. Also added back for Progressive integrator, for consistency.

Screenshot:
http://www.pasteall.org/pic/show.php?id=57980

intern/cycles/blender/addon/presets.py
intern/cycles/blender/addon/properties.py
intern/cycles/blender/addon/ui.py
intern/cycles/blender/blender_object.cpp
intern/cycles/blender/blender_sync.cpp
release/scripts/presets/cycles/sampling/final.py
release/scripts/presets/cycles/sampling/preview.py

index 9be01c209a90628e27e170d849aad3ebb5bb5494..66ec3a3a47a8657eb0ccf7a7d4cafb53f5d3696b 100644 (file)
@@ -67,7 +67,7 @@ class AddPresetSampling(AddPresetBase, Operator):
         "cycles.subsurface_samples",
         "cycles.no_caustics",
         "cycles.blur_glossy",
-        "cycles.squared_samples",
+        "cycles.use_square_samples",
         "cycles.progressive"
     ]
 
index 5476f1b39e5bc82954dc0fcdcbe1544a7e8d7c36..41fb9afbc4e974226f8b1bdb72d169201603c1e6 100644 (file)
@@ -128,8 +128,8 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
                 description="Use progressive sampling of lighting",
                 default=True,
                 )
-        cls.squared_samples = BoolProperty(
-                name="Squared Samples",
+        cls.use_square_samples = BoolProperty(
+                name="Square Samples",
                 description="Square sampling values for easier artist control",
                 default=False,
                 )
index 533d79d520daa7c5d6da97994cf41306ebaf34d1..267bb680823a3a7af12daef81e3d03a35bf27ec4 100644 (file)
@@ -48,6 +48,43 @@ class CyclesButtonsPanel():
         return rd.engine == 'CYCLES'
 
 
+def draw_samples_info(layout, cscene):
+    # Calculate sample values
+    if cscene.progressive:
+        aa = cscene.samples
+        if cscene.use_square_samples:
+            aa = aa*aa
+    else:
+        aa = cscene.aa_samples
+        d = cscene.diffuse_samples
+        g = cscene.glossy_samples
+        t = cscene.transmission_samples
+        ao = cscene.ao_samples
+        ml = cscene.mesh_light_samples
+        sss = cscene.subsurface_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
+            
+    # Draw interface
+    col = layout.column(align=True)
+    col.scale_y = 0.6
+    col.label("Total Samples:")
+    col.separator()
+    if cscene.progressive:
+        col.label("%s AA" % aa)
+    else:
+        col.label("%s AA, %s Diffuse, %s Glossy, %s Transmission" % (aa, d*aa, g*aa, t*aa))
+        col.separator()
+        col.label("%s AO, %s Mesh Light, %s Subsurface" % (ao*aa, ml*aa, sss*aa))
+
+
 class CyclesRender_PT_sampling(CyclesButtonsPanel, Panel):
     bl_label = "Sampling"
     bl_options = {'DEFAULT_CLOSED'}
@@ -63,12 +100,10 @@ class CyclesRender_PT_sampling(CyclesButtonsPanel, Panel):
         row.menu("CYCLES_MT_sampling_presets", text=bpy.types.CYCLES_MT_sampling_presets.bl_label)
         row.operator("render.cycles_sampling_preset_add", text="", icon="ZOOMIN")
         row.operator("render.cycles_sampling_preset_add", text="", icon="ZOOMOUT").remove_active = True
-
+        
         row = layout.row()
         row.prop(cscene, "progressive")
-        
-        if not cscene.progressive:
-            row.prop(cscene, "squared_samples")
+        row.prop(cscene, "use_square_samples")
         
         split = layout.split()
         
@@ -107,6 +142,8 @@ class CyclesRender_PT_sampling(CyclesButtonsPanel, Panel):
                 layout.separator()
                 layout.row().prop(cscene, "use_layer_samples")
                 break
+                
+        draw_samples_info(layout, cscene)
 
 
 class CyclesRender_PT_light_paths(CyclesButtonsPanel, Panel):
index b80ab7f8d946b185e3bf50ae4f86df980044d6b8..461e897efe17e00e52044b447d92110d958b7ae8 100644 (file)
@@ -158,7 +158,7 @@ void BlenderSync::sync_light(BL::Object b_parent, int persistent_id[OBJECT_PERSI
        light->use_mis = get_boolean(clamp, "use_multiple_importance_sampling");
        
        int samples = get_int(clamp, "samples");
-       if(get_boolean(cscene, "squared_samples"))
+       if(get_boolean(cscene, "use_square_samples"))
                light->samples = samples * samples;
        else
                light->samples = samples;
@@ -196,7 +196,7 @@ void BlenderSync::sync_background_light()
                                light->shader = scene->default_background;
                                
                                int samples = get_int(cworld, "samples");
-                               if(get_boolean(cscene, "squared_samples"))
+                               if(get_boolean(cscene, "use_square_samples"))
                                        light->samples = samples * samples;
                                else
                                        light->samples = samples;
index 8ba2e3fa11a869aec68f6ba230b0999ec21e5e0b..15bce22f1a06eb5eea8b8e4e1d2034bed6adf914 100644 (file)
@@ -198,7 +198,7 @@ void BlenderSync::sync_integrator()
        int mesh_light_samples = get_int(cscene, "mesh_light_samples");
        int subsurface_samples = get_int(cscene, "subsurface_samples");
 
-       if(get_boolean(cscene, "squared_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;
@@ -319,7 +319,7 @@ 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) {
                                int samples = b_rlay->samples();
-                               if(get_boolean(cscene, "squared_samples") && !(get_boolean(cscene, "progressive")))
+                               if(get_boolean(cscene, "use_square_samples"))
                                        render_layer.samples = samples * samples;
                                else
                                        render_layer.samples = samples;
@@ -412,10 +412,12 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine b_engine, BL::Use
        int preview_samples = get_int(cscene, "preview_samples");
        int preview_aa_samples = get_int(cscene, "preview_aa_samples");
        
-       /* Squared samples for Non-Progressive only */
-       if(get_boolean(cscene, "squared_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_boolean(cscene, "progressive") == 0) {
index a76fa352178be9513ebe5ab65bc55bcfc4de12b4..2ee429188bec9cd03548cf0b7c3c9d90bd681b07 100644 (file)
@@ -1,13 +1,13 @@
 import bpy
 cycles = bpy.context.scene.cycles
 
-cycles.squared_samples = True
+cycles.use_square_samples = True
 
 # Progressive
-cycles.samples = 500
-cycles.preview_samples = 100
+cycles.samples = 24
+cycles.preview_samples = 12
 
-# Non-Progressive (squared)
+# Non-Progressive
 cycles.aa_samples = 8
 cycles.preview_aa_samples = 4
 
index 3f565ccff8cb758ef0c6615d1edeee5cfdf17d60..c7af6c837772f42c7d25b4cf61d5e3bb374e949b 100644 (file)
@@ -1,13 +1,13 @@
 import bpy
 cycles = bpy.context.scene.cycles
 
-cycles.squared_samples = True
+cycles.use_square_samples = True
 
 # Progressive
-cycles.samples = 100
-cycles.preview_samples = 10
+cycles.samples = 12
+cycles.preview_samples = 6
 
-# Non-Progressive (squared)
+# Non-Progressive
 cycles.aa_samples = 4
 cycles.preview_aa_samples = 2