diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-06-13 15:44:48 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-06-13 15:44:48 +0400 |
commit | 4ba456d1754c29b488b8304c8546af45078e8536 (patch) | |
tree | 49649b7442d58aa835a7428043130f158613521d /intern/cycles/blender | |
parent | dcda234a3d93ed44189fac3716a694f4f75f366e (diff) |
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.
Diffstat (limited to 'intern/cycles/blender')
-rw-r--r-- | intern/cycles/blender/addon/properties.py | 61 | ||||
-rw-r--r-- | intern/cycles/blender/addon/ui.py | 74 | ||||
-rw-r--r-- | intern/cycles/blender/blender_object.cpp | 2 | ||||
-rw-r--r-- | intern/cycles/blender/blender_sync.cpp | 31 |
4 files changed, 145 insertions, 23 deletions
diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py index 3ade04c4658..7ce3b949bb1 100644 --- a/intern/cycles/blender/addon/properties.py +++ b/intern/cycles/blender/addon/properties.py @@ -57,6 +57,12 @@ class CyclesRenderSettings(bpy.types.PropertyGroup): 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 @@ class CyclesRenderSettings(bpy.types.PropertyGroup): 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 @@ class CyclesLampSettings(bpy.types.PropertyGroup): 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 @@ class CyclesWorldSettings(bpy.types.PropertyGroup): 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): diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index 3b906bb4bdf..6f2b33b2815 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -44,8 +44,48 @@ class CyclesButtonsPanel(): 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): + layout = self.layout + + 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): @@ -62,12 +102,6 @@ class CyclesRender_PT_integrator(CyclesButtonsPanel, Panel): 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 @@ class CyclesRender_PT_integrator(CyclesButtonsPanel, Panel): 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,16 +122,10 @@ class CyclesRender_PT_integrator(CyclesButtonsPanel, Panel): 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" @@ -467,6 +500,7 @@ class CyclesLamp_PT_lamp(CyclesButtonsPanel, Panel): lamp = context.lamp clamp = lamp.cycles + cscene = context.scene.cycles layout.prop(lamp, "type", expand=True) @@ -485,6 +519,9 @@ class CyclesLamp_PT_lamp(CyclesButtonsPanel, Panel): 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 @@ class CyclesWorld_PT_settings(CyclesButtonsPanel, Panel): 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): diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp index 9c98cacc9b8..d5b884cfccd 100644 --- a/intern/cycles/blender/blender_object.cpp +++ b/intern/cycles/blender/blender_object.cpp @@ -154,6 +154,7 @@ void BlenderSync::sync_light(BL::Object b_parent, int b_index, BL::Object b_ob, /* 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 @@ void BlenderSync::sync_background_light() { 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); diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp index 13040e551bd..5640a411fd7 100644 --- a/intern/cycles/blender/blender_sync.cpp +++ b/intern/cycles/blender/blender_sync.cpp @@ -168,6 +168,13 @@ void BlenderSync::sync_integrator() 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 @@ SessionParams BlenderSync::get_session_params(BL::UserPreferences b_userpref, BL /* 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 { + params.samples = get_int(cscene, "preview_samples"); + if(params.samples == 0) + params.samples = INT_MAX; + } } else { - params.samples = get_int(cscene, "preview_samples"); - if(params.samples == 0) - params.samples = INT_MAX; + if(background) { + params.samples = get_int(cscene, "aa_samples"); + } + else { + params.samples = get_int(cscene, "preview_aa_samples"); + if(params.samples == 0) + params.samples = INT_MAX; + } } /* other parameters */ |