[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47825] trunk/blender/intern/cycles: Cycles: first step for implementation of non-progressive sampler that handles

Brecht Van Lommel brechtvanlommel at pandora.be
Wed Jun 13 13:44:49 CEST 2012


Revision: 47825
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47825
Author:   blendix
Date:     2012-06-13 11:44:48 +0000 (Wed, 13 Jun 2012)
Log Message:
-----------
Cycles: first step for implementation of non-progressive sampler that handles
direct and indirect lighting differently. Rather than picking one light for each
point on the path, it now loops over all lights for direct lighting. For indirect
lighting it still picks a random light each time.

It gives control over the number of AA samples, and the number of Diffuse, Glossy,
Transmission, AO, Mesh Light, Background and Lamp samples for each AA sample.

This helps tuning render performance/noise and tends to give less noise for renders
dominated by direct lighting.

This sampling mode only works on the CPU, and still needs proper tile rendering
to show progress (will follow tommorrow or so), because each AA sample can be quite
slow now and so the delay between each update wil be too long.

Modified Paths:
--------------
    trunk/blender/intern/cycles/blender/addon/properties.py
    trunk/blender/intern/cycles/blender/addon/ui.py
    trunk/blender/intern/cycles/blender/blender_object.cpp
    trunk/blender/intern/cycles/blender/blender_sync.cpp
    trunk/blender/intern/cycles/kernel/kernel_emission.h
    trunk/blender/intern/cycles/kernel/kernel_light.h
    trunk/blender/intern/cycles/kernel/kernel_path.h
    trunk/blender/intern/cycles/kernel/kernel_shader.h
    trunk/blender/intern/cycles/kernel/kernel_types.h
    trunk/blender/intern/cycles/render/integrator.cpp
    trunk/blender/intern/cycles/render/integrator.h
    trunk/blender/intern/cycles/render/light.cpp
    trunk/blender/intern/cycles/render/light.h
    trunk/blender/intern/cycles/render/scene.cpp

Modified: trunk/blender/intern/cycles/blender/addon/properties.py
===================================================================
--- trunk/blender/intern/cycles/blender/addon/properties.py	2012-06-13 11:40:49 UTC (rev 47824)
+++ trunk/blender/intern/cycles/blender/addon/properties.py	2012-06-13 11:44:48 UTC (rev 47825)
@@ -57,6 +57,12 @@
                 default='GPU_COMPATIBLE',
                 )
 
+        cls.progressive = BoolProperty(
+                name="Progressive",
+                description="Use progressive sampling of lighting",
+                default=True,
+                )
+
         cls.samples = IntProperty(
                 name="Samples",
                 description="Number of samples to render for each pixel",
@@ -80,6 +86,49 @@
                 default=False,
                 )
 
+        cls.aa_samples = IntProperty(
+                name="AA Samples",
+                description="Number of antialiasing samples to render for each pixel",
+                min=1, max=10000,
+                default=4,
+                )
+        cls.preview_aa_samples = IntProperty(
+                name="AA Samples",
+                description="Number of antialiasing samples to in viewport, unlimited if 0",
+                min=1, max=10000,
+                default=4,
+                )
+        cls.diffuse_samples = IntProperty(
+                name="Diffuse Samples",
+                description="Number of diffuse bounce samples to render for each AA sample",
+                min=1, max=10000,
+                default=1,
+                )
+        cls.glossy_samples = IntProperty(
+                name="Glossy Samples",
+                description="Number of glossy bounce samples to render for each AA sample",
+                min=1, max=10000,
+                default=1,
+                )
+        cls.transmission_samples = IntProperty(
+                name="Transmission Samples",
+                description="Number of transmission bounce samples to render for each AA sample",
+                min=1, max=10000,
+                default=1,
+                )
+        cls.ao_samples = IntProperty(
+                name="Ambient Occlusion Samples",
+                description="Number of ambient occlusion samples to render for each AA sample",
+                min=1, max=10000,
+                default=1,
+                )
+        cls.mesh_light_samples = IntProperty(
+                name="Mesh Light Samples",
+                description="Number of mesh emission light samples to render for each AA sample",
+                min=1, max=10000,
+                default=1,
+                )
+
         cls.no_caustics = BoolProperty(
                 name="No Caustics",
                 description="Leave out caustics, resulting in a darker image with less noise",
@@ -340,6 +389,12 @@
                 description="Lamp casts shadows",
                 default=True,
                 )
+        cls.samples = IntProperty(
+                name="Samples",
+                description="Number of light samples to render for each AA sample",
+                min=1, max=10000,
+                default=1,
+                )
 
     @classmethod
     def unregister(cls):
@@ -365,6 +420,12 @@
                 min=4, max=8096,
                 default=256,
                 )
+        cls.samples = IntProperty(
+                name="Samples",
+                description="Number of light samples to render for each AA sample",
+                min=1, max=10000,
+                default=4,
+                )
 
     @classmethod
     def unregister(cls):

Modified: trunk/blender/intern/cycles/blender/addon/ui.py
===================================================================
--- trunk/blender/intern/cycles/blender/addon/ui.py	2012-06-13 11:40:49 UTC (rev 47824)
+++ trunk/blender/intern/cycles/blender/addon/ui.py	2012-06-13 11:44:48 UTC (rev 47825)
@@ -44,8 +44,8 @@
         return rd.engine == 'CYCLES'
 
 
-class CyclesRender_PT_integrator(CyclesButtonsPanel, Panel):
-    bl_label = "Integrator"
+class CyclesRender_PT_sampling(CyclesButtonsPanel, Panel):
+    bl_label = "Sampling"
     bl_options = {'DEFAULT_CLOSED'}
 
     def draw(self, context):
@@ -54,6 +54,46 @@
         scene = context.scene
         cscene = scene.cycles
 
+        split = layout.split()
+
+        col = split.column()
+        sub = col.column(align=True)
+        sub.active = cscene.device == 'CPU'
+        sub.prop(cscene, "progressive")
+
+        sub = col.column(align=True)
+        sub.prop(cscene, "seed")
+        sub.prop(cscene, "sample_clamp")
+
+        if cscene.progressive or cscene.device != 'CPU':
+            col = split.column(align=True)
+            col.label(text="Samples:")
+            col.prop(cscene, "samples", text="Render")
+            col.prop(cscene, "preview_samples", text="Preview")
+        else:
+            sub = col.column(align=True)
+            sub.label(text="AA Samples:")
+            sub.prop(cscene, "aa_samples", text="Render")
+            sub.prop(cscene, "preview_aa_samples", text="Preview")
+
+            col = split.column(align=True)
+            col.label(text="Samples:")
+            col.prop(cscene, "diffuse_samples", text="Diffuse")
+            col.prop(cscene, "glossy_samples", text="Glossy")
+            col.prop(cscene, "transmission_samples", text="Transmission")
+            col.prop(cscene, "ao_samples", text="AO")
+            col.prop(cscene, "mesh_light_samples", text="Mesh Light")
+
+class CyclesRender_PT_light_paths(CyclesButtonsPanel, Panel):
+    bl_label = "Light Paths"
+    bl_options = {'DEFAULT_CLOSED'}
+
+    def draw(self, context):
+        layout = self.layout
+
+        scene = context.scene
+        cscene = scene.cycles
+
         row = layout.row(align=True)
         row.menu("CYCLES_MT_integrator_presets", text=bpy.types.CYCLES_MT_integrator_presets.bl_label)
         row.operator("render.cycles_integrator_preset_add", text="", icon="ZOOMIN")
@@ -62,12 +102,6 @@
         split = layout.split()
 
         col = split.column()
-        sub = col.column(align=True)
-        sub.label(text="Samples:")
-        sub.prop(cscene, "samples", text="Render")
-        sub.prop(cscene, "preview_samples", text="Preview")
-        sub.prop(cscene, "seed")
-        sub.prop(cscene, "sample_clamp")
 
         sub = col.column(align=True)
         sub.label("Transparency:")
@@ -75,6 +109,11 @@
         sub.prop(cscene, "transparent_min_bounces", text="Min")
         sub.prop(cscene, "use_transparent_shadows", text="Shadows")
 
+        col.separator()
+
+        col.prop(cscene, "no_caustics")
+        col.prop(cscene, "blur_glossy")
+
         col = split.column()
 
         sub = col.column(align=True)
@@ -83,17 +122,11 @@
         sub.prop(cscene, "min_bounces", text="Min")
 
         sub = col.column(align=True)
-        sub.label(text="Light Paths:")
         sub.prop(cscene, "diffuse_bounces", text="Diffuse")
         sub.prop(cscene, "glossy_bounces", text="Glossy")
         sub.prop(cscene, "transmission_bounces", text="Transmission")
 
-        col.separator()
 
-        col.prop(cscene, "no_caustics")
-        col.prop(cscene, "blur_glossy")
-
-
 class CyclesRender_PT_motion_blur(CyclesButtonsPanel, Panel):
     bl_label = "Motion Blur"
     bl_options = {'DEFAULT_CLOSED'}
@@ -467,6 +500,7 @@
 
         lamp = context.lamp
         clamp = lamp.cycles
+        cscene = context.scene.cycles
 
         layout.prop(lamp, "type", expand=True)
 
@@ -485,6 +519,9 @@
                 sub.prop(lamp, "size", text="Size X")
                 sub.prop(lamp, "size_y", text="Size Y")
 
+        if not cscene.progressive and cscene.device == 'CPU':
+            col.prop(clamp, "samples")
+
         col = split.column()
         col.prop(clamp, "cast_shadow")
 
@@ -604,13 +641,16 @@
 
         world = context.world
         cworld = world.cycles
+        cscene = context.scene.cycles
 
         col = layout.column()
 
         col.prop(cworld, "sample_as_light")
-        row = col.row()
-        row.active = cworld.sample_as_light
-        row.prop(cworld, "sample_map_resolution")
+        sub = col.row(align=True)
+        sub.active = cworld.sample_as_light
+        sub.prop(cworld, "sample_map_resolution")
+        if not cscene.progressive and cscene.device == 'CPU':
+            sub.prop(cworld, "samples")
 
 
 class CyclesMaterial_PT_surface(CyclesButtonsPanel, Panel):

Modified: trunk/blender/intern/cycles/blender/blender_object.cpp
===================================================================
--- trunk/blender/intern/cycles/blender/blender_object.cpp	2012-06-13 11:40:49 UTC (rev 47824)
+++ trunk/blender/intern/cycles/blender/blender_object.cpp	2012-06-13 11:44:48 UTC (rev 47825)
@@ -154,6 +154,7 @@
 	/* shadow */
 	PointerRNA clamp = RNA_pointer_get(&b_lamp.ptr, "cycles");
 	light->cast_shadow = get_boolean(clamp, "cast_shadow");
+	light->samples = get_int(clamp, "samples");
 
 	/* tag */
 	light->tag_update(scene);
@@ -178,6 +179,7 @@
 			{
 				light->type = LIGHT_BACKGROUND;
 				light->map_resolution  = get_int(cworld, "sample_map_resolution");
+				light->samples  = get_int(cworld, "samples");
 				light->shader = scene->default_background;
 
 				light->tag_update(scene);

Modified: trunk/blender/intern/cycles/blender/blender_sync.cpp
===================================================================
--- trunk/blender/intern/cycles/blender/blender_sync.cpp	2012-06-13 11:40:49 UTC (rev 47824)
+++ trunk/blender/intern/cycles/blender/blender_sync.cpp	2012-06-13 11:44:48 UTC (rev 47825)
@@ -168,6 +168,13 @@
 	integrator->motion_blur = (!preview && r.use_motion_blur());
 #endif
 
+	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->progressive = get_boolean(cscene, "progressive");
+
 	if(integrator->modified(previntegrator))
 		integrator->tag_update(scene);
 }
@@ -308,15 +315,27 @@
 
 	/* Background */
 	params.background = background;
-			
+
 	/* samples */
-	if(background) {
-		params.samples = get_int(cscene, "samples");
+	if(get_boolean(cscene, "progressive")) {
+		if(background) {
+			params.samples = get_int(cscene, "samples");
+		}
+		else {

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list