fix T40322: Glitch in baking a mixed SSS shader
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
ccl_device void compute_light_pass(KernelGlobals *kg, ShaderData *sd, PathRadiance *L, RNG rng,
|
||||
bool is_combined, bool is_ao, bool is_sss)
|
||||
const bool is_combined, const bool is_ao, const bool is_sss)
|
||||
{
|
||||
int samples = kernel_data.integrator.aa_samples;
|
||||
|
||||
@@ -31,6 +31,7 @@ ccl_device void compute_light_pass(KernelGlobals *kg, ShaderData *sd, PathRadian
|
||||
PathState state;
|
||||
Ray ray;
|
||||
float3 throughput = make_float3(1.0f, 1.0f, 1.0f);
|
||||
bool is_sss_sample = is_sss;
|
||||
|
||||
/* init radiance */
|
||||
path_radiance_init(&L_sample, kernel_data.film.use_light_pass);
|
||||
@@ -57,15 +58,15 @@ ccl_device void compute_light_pass(KernelGlobals *kg, ShaderData *sd, PathRadian
|
||||
|
||||
#ifdef __SUBSURFACE__
|
||||
/* sample subsurface scattering */
|
||||
if((is_combined || is_sss) && (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 */
|
||||
if (kernel_path_subsurface_scatter(kg, sd, &L_sample, &state, &rng, &ray, &throughput))
|
||||
is_sss = true;
|
||||
is_sss_sample = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* sample light and BSDF */
|
||||
if((!is_sss) && (!is_ao)) {
|
||||
if((!is_sss_sample) && (!is_ao)) {
|
||||
|
||||
if(sd->flag & SD_EMISSION) {
|
||||
float3 emission = indirect_primitive_emission(kg, sd, 0.0f, state.flag, state.ray_pdf);
|
||||
@@ -96,14 +97,14 @@ ccl_device void compute_light_pass(KernelGlobals *kg, ShaderData *sd, PathRadian
|
||||
|
||||
#ifdef __SUBSURFACE__
|
||||
/* sample subsurface scattering */
|
||||
if((is_combined || is_sss) && (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 */
|
||||
kernel_branched_path_subsurface_scatter(kg, sd, &L_sample, &state, &rng, throughput);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* sample light and BSDF */
|
||||
if((!is_sss) && (!is_ao)) {
|
||||
if((!is_sss_sample) && (!is_ao)) {
|
||||
|
||||
if(sd->flag & SD_EMISSION) {
|
||||
float3 emission = indirect_primitive_emission(kg, sd, 0.0f, state.flag, state.ray_pdf);
|
||||
|
Reference in New Issue
Block a user