Cycles: Direct multi light sampling in the Branched Path Integrator is optional now.
authorThomas Dinges <blender@dingto.org>
Sat, 15 Mar 2014 16:36:44 +0000 (17:36 +0100)
committerThomas Dinges <blender@dingto.org>
Sat, 15 Mar 2014 16:37:43 +0000 (17:37 +0100)
Disabling this can improve performance, when we need a lot of AA Samples anyway, to clear up the render.

Simple example .blend: http://www.pasteall.org/blend/27582

Differential Revision: https://developer.blender.org/D392

intern/cycles/blender/addon/properties.py
intern/cycles/blender/addon/ui.py
intern/cycles/blender/blender_sync.cpp
intern/cycles/kernel/kernel_path.h
intern/cycles/kernel/kernel_types.h
intern/cycles/render/integrator.cpp
intern/cycles/render/integrator.h

index 875f9d36d6393949cac29d9f241f7fbf7b49431e..1d56824732772a345476026b00670dbda2d9a9b4 100644 (file)
@@ -252,10 +252,17 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
                 items=enum_use_layer_samples,
                 default='USE',
                 )
+
+        cls.sample_all_lights_direct = BoolProperty(
+                name="Sample All Direct Lights",
+                description="Sample all lights (for direct samples), rather than randomly picking one",
+                default=True,
+                )
+
         cls.sample_all_lights_indirect = BoolProperty(
-                name="Sample All Lights",
+                name="Sample All Indirect Lights",
                 description="Sample all lights (for indirect samples), rather than randomly picking one",
-                default=False,
+                default=True,
                 )
 
         cls.no_caustics = BoolProperty(
index 7f0a22d2af5de67d1ad9b9330891cb2b14c09f06..70368c25435ddb2fe4b3ec938dd8458a733aa43b 100644 (file)
@@ -134,6 +134,7 @@ class CyclesRender_PT_sampling(CyclesButtonsPanel, Panel):
             sub.prop(cscene, "aa_samples", text="Render")
             sub.prop(cscene, "preview_aa_samples", text="Preview")
             sub.separator()
+            sub.prop(cscene, "sample_all_lights_direct")
             sub.prop(cscene, "sample_all_lights_indirect")
 
             col = split.column()
index 202eff48d534baff6b5a2a534349a0c2e59992bf..1f5e32a1123e9be72842eac639523ea679f32c81 100644 (file)
@@ -197,7 +197,8 @@ void BlenderSync::sync_integrator()
 #endif
 
        integrator->method = (Integrator::Method)get_enum(cscene, "progressive");
-       
+
+       integrator->sample_all_lights_direct = get_boolean(cscene, "sample_all_lights_direct");
        integrator->sample_all_lights_indirect = get_boolean(cscene, "sample_all_lights_indirect");
 
        int diffuse_samples = get_int(cscene, "diffuse_samples");
index 000b241f544fea9fcf44ab2cd8eff4e2d5338308..81b61a54a6ada553d6bc844f57d74055fe5c3311 100644 (file)
@@ -957,7 +957,8 @@ ccl_device_noinline void kernel_branched_path_integrate_lighting(KernelGlobals *
        PathState *state, PathRadiance *L, ccl_global float *buffer)
 {
 #ifdef __EMISSION__
-       kernel_branched_path_integrate_direct_lighting(kg, rng, sd, state, throughput, num_samples_adjust, L, true);
+       bool all = kernel_data.integrator.sample_all_lights_direct;
+       kernel_branched_path_integrate_direct_lighting(kg, rng, sd, state, throughput, num_samples_adjust, L, all);
 #endif
 
        for(int i = 0; i< sd->num_closure; i++) {
index 551c2dd596e13519865d3d22f698599b3c772840..512e7ab15b3e1b3a19aac8be40cd6cf7b47bf9d9 100644 (file)
@@ -836,8 +836,9 @@ typedef struct KernelIntegrator {
        int ao_samples;
        int mesh_light_samples;
        int subsurface_samples;
+       int sample_all_lights_direct;
        int sample_all_lights_indirect;
-       
+
        /* mis */
        int use_lamp_mis;
 
@@ -850,7 +851,6 @@ typedef struct KernelIntegrator {
        int volume_max_steps;
        float volume_step_size;
        int volume_samples;
-       int pad1;
 } KernelIntegrator;
 
 typedef struct KernelBVH {
index 849157d9e91ed2b348f505ec66686b7534255a34..c81e7e3bbd7c334e206a7e085ae0bfdfe1371438 100644 (file)
@@ -130,6 +130,7 @@ void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene
        kintegrator->mesh_light_samples = mesh_light_samples;
        kintegrator->subsurface_samples = subsurface_samples;
        kintegrator->volume_samples = volume_samples;
+       kintegrator->sample_all_lights_direct = sample_all_lights_direct;
        kintegrator->sample_all_lights_indirect = sample_all_lights_indirect;
 
        kintegrator->sampling_pattern = sampling_pattern;
@@ -199,6 +200,7 @@ bool Integrator::modified(const Integrator& integrator)
                volume_samples == integrator.volume_samples &&
                motion_blur == integrator.motion_blur &&
                sampling_pattern == integrator.sampling_pattern &&
+               sample_all_lights_direct == integrator.sample_all_lights_direct &&
                sample_all_lights_indirect == integrator.sample_all_lights_indirect);
 }
 
index 587968dc1e4efc11f2cf1a77775b5235e68d64eb..2570b13808cc28e960de11c091e5dfd36f2cda87 100644 (file)
@@ -63,6 +63,7 @@ public:
        int mesh_light_samples;
        int subsurface_samples;
        int volume_samples;
+       bool sample_all_lights_direct;
        bool sample_all_lights_indirect;
 
        enum Method {