Cycles: Fix wrong original ray used for SSS baking
Also de-duplicated some code by moving to an utility function.
This commit is contained in:
@@ -65,8 +65,8 @@ ccl_device void compute_light_pass(KernelGlobals *kg, ShaderData *sd, PathRadian
|
|||||||
if((is_combined || is_sss_sample) && (sd->flag & SD_BSSRDF)) {
|
if((is_combined || is_sss_sample) && (sd->flag & SD_BSSRDF)) {
|
||||||
/* when mixing BSSRDF and BSDF closures we should skip BSDF lighting if scattering was successful */
|
/* when mixing BSSRDF and BSDF closures we should skip BSDF lighting if scattering was successful */
|
||||||
SubsurfaceIndirectRays ss_indirect;
|
SubsurfaceIndirectRays ss_indirect;
|
||||||
ss_indirect.tracing = false;
|
Ray orig_ray = ray;
|
||||||
ss_indirect.num_rays = 0;
|
kernel_path_subsurface_init_indirect(&ss_indirect);
|
||||||
if(kernel_path_subsurface_scatter(kg,
|
if(kernel_path_subsurface_scatter(kg,
|
||||||
sd,
|
sd,
|
||||||
&L_sample,
|
&L_sample,
|
||||||
@@ -79,7 +79,7 @@ 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,
|
||||||
&ray,
|
&orig_ray,
|
||||||
&state,
|
&state,
|
||||||
&ray,
|
&ray,
|
||||||
&L_sample,
|
&L_sample,
|
||||||
|
@@ -522,6 +522,13 @@ ccl_device bool kernel_path_subsurface_scatter(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ccl_device_inline void kernel_path_subsurface_init_indirect(
|
||||||
|
SubsurfaceIndirectRays *ss_indirect)
|
||||||
|
{
|
||||||
|
ss_indirect->tracing = false;
|
||||||
|
ss_indirect->num_rays = 0;
|
||||||
|
}
|
||||||
|
|
||||||
ccl_device void kernel_path_subsurface_accum_indirect(
|
ccl_device void kernel_path_subsurface_accum_indirect(
|
||||||
SubsurfaceIndirectRays *ss_indirect,
|
SubsurfaceIndirectRays *ss_indirect,
|
||||||
PathRadiance *L)
|
PathRadiance *L)
|
||||||
@@ -598,8 +605,7 @@ ccl_device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int sample,
|
|||||||
|
|
||||||
#ifdef __SUBSURFACE__
|
#ifdef __SUBSURFACE__
|
||||||
SubsurfaceIndirectRays ss_indirect;
|
SubsurfaceIndirectRays ss_indirect;
|
||||||
ss_indirect.tracing = false;
|
kernel_path_subsurface_init_indirect(&ss_indirect);
|
||||||
ss_indirect.num_rays = 0;
|
|
||||||
|
|
||||||
/* TODO(sergey): Avoid having explicit copy of the pre-subsurface scatter
|
/* TODO(sergey): Avoid having explicit copy of the pre-subsurface scatter
|
||||||
* ray by storing an updated version of state in the ss_indirect which will
|
* ray by storing an updated version of state in the ss_indirect which will
|
||||||
|
Reference in New Issue
Block a user