Cycles: Fix wrong SSS with regular path tracing and clamping enabled

Radiance sum and reset was happening in different order after 26f1c51.

This is a quick fix to unlock Caminandes team, perhaps we can avoid having
separate variable to detect when radiance is to be sum.
This commit is contained in:
Sergey Sharybin
2015-11-26 16:11:41 +05:00
parent c8a041f489
commit bf9e88bfbe
2 changed files with 15 additions and 10 deletions

View File

@@ -77,7 +77,6 @@ ccl_device void compute_light_pass(KernelGlobals *kg, ShaderData *sd, PathRadian
while(ss_indirect.num_rays) { while(ss_indirect.num_rays) {
kernel_path_subsurface_setup_indirect(kg, kernel_path_subsurface_setup_indirect(kg,
&ss_indirect, &ss_indirect,
&L_sample,
&state, &state,
&ray, &ray,
&ray, &ray,
@@ -89,6 +88,12 @@ ccl_device void compute_light_pass(KernelGlobals *kg, ShaderData *sd, PathRadian
state.num_samples, state.num_samples,
&state, &state,
&L_sample); &L_sample);
/* For render passes, sum and reset indirect light pass variables
* for the next samples.
*/
path_radiance_sum_indirect(&L_sample);
path_radiance_reset_indirect(&L_sample);
} }
is_sss_sample = true; is_sss_sample = true;
} }

View File

@@ -519,7 +519,6 @@ ccl_device bool kernel_path_subsurface_scatter(
ccl_device void kernel_path_subsurface_setup_indirect( ccl_device void kernel_path_subsurface_setup_indirect(
KernelGlobals *kg, KernelGlobals *kg,
SubsurfaceIndirectRays *ss_indirect, SubsurfaceIndirectRays *ss_indirect,
PathRadiance *L,
PathState *state, PathState *state,
Ray *orig_ray, Ray *orig_ray,
Ray *ray, Ray *ray,
@@ -548,12 +547,6 @@ ccl_device void kernel_path_subsurface_setup_indirect(
#endif #endif
*ray = *indirect_ray; *ray = *indirect_ray;
/* For render passes, sum and reset indirect light pass variables
* for the next samples.
*/
path_radiance_sum_indirect(L);
path_radiance_reset_indirect(L);
} }
#endif #endif
@@ -584,7 +577,7 @@ ccl_device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int sample,
*/ */
Ray ss_orig_ray; Ray ss_orig_ray;
for(;;) { for(int ss_indirect_iter = 0; ; ss_indirect_iter++) {
#endif #endif
/* path iteration */ /* path iteration */
@@ -848,13 +841,20 @@ ccl_device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int sample,
} }
#ifdef __SUBSURFACE__ #ifdef __SUBSURFACE__
if(ss_indirect_iter != 0) {
/* For render passes, sum and reset indirect light pass variables
* for the next samples.
*/
path_radiance_sum_indirect(&L);
path_radiance_reset_indirect(&L);
}
/* Trace indirect subsurface rays by restarting the loop. this uses less /* Trace indirect subsurface rays by restarting the loop. this uses less
* stack memory than invoking kernel_path_indirect. * stack memory than invoking kernel_path_indirect.
*/ */
if(ss_indirect.num_rays) { if(ss_indirect.num_rays) {
kernel_path_subsurface_setup_indirect(kg, kernel_path_subsurface_setup_indirect(kg,
&ss_indirect, &ss_indirect,
&L,
&state, &state,
&ss_orig_ray, &ss_orig_ray,
&ray, &ray,