Cycles: Add "Max Bounce" control for lamps
With this setting, we can limit the influence of a lamp to a certain amount of bounces. 0 = Only direct light contribution 1 = 1 light bounce ... Differential revision: https://developer.blender.org/D860 You can find an example render in the release logs: http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.73/Cycles
This commit is contained in:
@@ -40,7 +40,7 @@ ccl_device void kernel_path_volume_connect_light(KernelGlobals *kg, RNG *rng,
|
||||
light_ray.time = sd->time;
|
||||
#endif
|
||||
|
||||
light_sample(kg, light_t, light_u, light_v, sd->time, sd->P, &ls);
|
||||
light_sample(kg, light_t, light_u, light_v, sd->time, sd->P, state->bounce, &ls);
|
||||
if(ls.pdf == 0.0f)
|
||||
return;
|
||||
|
||||
@@ -124,6 +124,9 @@ ccl_device void kernel_branched_path_volume_connect_light(KernelGlobals *kg, RNG
|
||||
if(sample_all_lights) {
|
||||
/* lamp sampling */
|
||||
for(int i = 0; i < kernel_data.integrator.num_all_lights; i++) {
|
||||
if(UNLIKELY(light_select_reached_max_bounces(kg, i, state->bounce)))
|
||||
continue;
|
||||
|
||||
int num_samples = ceil_to_int(num_samples_adjust*light_select_num_samples(kg, i));
|
||||
float num_samples_inv = num_samples_adjust/(num_samples*kernel_data.integrator.num_all_lights);
|
||||
RNG lamp_rng = cmj_hash(*rng, i);
|
||||
@@ -188,7 +191,7 @@ ccl_device void kernel_branched_path_volume_connect_light(KernelGlobals *kg, RNG
|
||||
light_t = 0.5f*light_t;
|
||||
|
||||
LightSample ls;
|
||||
light_sample(kg, light_t, light_u, light_v, sd->time, ray->P, &ls);
|
||||
light_sample(kg, light_t, light_u, light_v, sd->time, ray->P, state->bounce, &ls);
|
||||
|
||||
float3 tp = throughput;
|
||||
|
||||
@@ -203,7 +206,7 @@ ccl_device void kernel_branched_path_volume_connect_light(KernelGlobals *kg, RNG
|
||||
kernel_assert(result == VOLUME_PATH_SCATTERED);
|
||||
|
||||
/* todo: split up light_sample so we don't have to call it again with new position */
|
||||
light_sample(kg, light_t, light_u, light_v, sd->time, sd->P, &ls);
|
||||
light_sample(kg, light_t, light_u, light_v, sd->time, sd->P, state->bounce, &ls);
|
||||
|
||||
if(ls.pdf == 0.0f)
|
||||
continue;
|
||||
@@ -227,7 +230,7 @@ ccl_device void kernel_branched_path_volume_connect_light(KernelGlobals *kg, RNG
|
||||
path_state_rng_2D(kg, rng, state, PRNG_LIGHT_U, &light_u, &light_v);
|
||||
|
||||
LightSample ls;
|
||||
light_sample(kg, light_t, light_u, light_v, sd->time, ray->P, &ls);
|
||||
light_sample(kg, light_t, light_u, light_v, sd->time, ray->P, state->bounce, &ls);
|
||||
|
||||
float3 tp = throughput;
|
||||
|
||||
@@ -242,7 +245,7 @@ ccl_device void kernel_branched_path_volume_connect_light(KernelGlobals *kg, RNG
|
||||
kernel_assert(result == VOLUME_PATH_SCATTERED);
|
||||
|
||||
/* todo: split up light_sample so we don't have to call it again with new position */
|
||||
light_sample(kg, light_t, light_u, light_v, sd->time, sd->P, &ls);
|
||||
light_sample(kg, light_t, light_u, light_v, sd->time, sd->P, state->bounce, &ls);
|
||||
|
||||
if(ls.pdf == 0.0f)
|
||||
return;
|
||||
|
Reference in New Issue
Block a user