diff options
author | Brecht Van Lommel <brecht@blender.org> | 2022-05-05 22:52:36 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2022-05-05 23:01:45 +0300 |
commit | 1b566b70c1636c9b95f55e2fc84ef4f714306d19 (patch) | |
tree | c81666fd49aa86143b199c32dfced9a927f78295 /intern/cycles | |
parent | e4931ab86dd1bf2918304bbccd0175da394607ef (diff) |
Fix T95308, T93913: Cycles mist pass wrong with SSS shader
It was wrongly writing passes twice, for both the surface entry and exit points.
We can skip code for filtering closures, emission and holdout also, as these do
nothing with only a subsurface diffuse closure present.
Diffstat (limited to 'intern/cycles')
-rw-r--r-- | intern/cycles/kernel/integrator/shade_surface.h | 55 |
1 files changed, 29 insertions, 26 deletions
diff --git a/intern/cycles/kernel/integrator/shade_surface.h b/intern/cycles/kernel/integrator/shade_surface.h index 86c8d1c1f4c..859c314b088 100644 --- a/intern/cycles/kernel/integrator/shade_surface.h +++ b/intern/cycles/kernel/integrator/shade_surface.h @@ -525,47 +525,50 @@ ccl_device bool integrate_surface(KernelGlobals kg, subsurface_shader_data_setup(kg, state, &sd, path_flag); INTEGRATOR_STATE_WRITE(state, path, flag) &= ~PATH_RAY_SUBSURFACE; } + else #endif - - shader_prepare_surface_closures(kg, state, &sd, path_flag); + { + /* Filter closures. */ + shader_prepare_surface_closures(kg, state, &sd, path_flag); #ifdef __HOLDOUT__ - /* Evaluate holdout. */ - if (!integrate_surface_holdout(kg, state, &sd, render_buffer)) { - return false; - } + /* Evaluate holdout. */ + if (!integrate_surface_holdout(kg, state, &sd, render_buffer)) { + return false; + } #endif #ifdef __EMISSION__ - /* Write emission. */ - if (sd.flag & SD_EMISSION) { - integrate_surface_emission(kg, state, &sd, render_buffer); - } + /* Write emission. */ + if (sd.flag & SD_EMISSION) { + integrate_surface_emission(kg, state, &sd, render_buffer); + } #endif + /* Perform path termination. Most paths have already been terminated in + * the intersect_closest kernel, this is just for emission and for dividing + * throughput by the probability at the right moment. + * + * Also ensure we don't do it twice for SSS at both the entry and exit point. */ + if (integrate_surface_terminate(state, path_flag)) { + return false; + } + + /* Write render passes. */ #ifdef __PASSES__ - /* Write render passes. */ - PROFILING_EVENT(PROFILING_SHADE_SURFACE_PASSES); - kernel_write_data_passes(kg, state, &sd, render_buffer); + PROFILING_EVENT(PROFILING_SHADE_SURFACE_PASSES); + kernel_write_data_passes(kg, state, &sd, render_buffer); #endif +#ifdef __DENOISING_FEATURES__ + kernel_write_denoising_features_surface(kg, state, &sd, render_buffer); +#endif + } + /* Load random number state. */ RNGState rng_state; path_state_rng_load(state, &rng_state); - /* Perform path termination. Most paths have already been terminated in - * the intersect_closest kernel, this is just for emission and for dividing - * throughput by the probability at the right moment. - * - * Also ensure we don't do it twice for SSS at both the entry and exit point. */ - if (!(path_flag & PATH_RAY_SUBSURFACE) && integrate_surface_terminate(state, path_flag)) { - return false; - } - -#ifdef __DENOISING_FEATURES__ - kernel_write_denoising_features_surface(kg, state, &sd, render_buffer); -#endif - /* Direct light. */ PROFILING_EVENT(PROFILING_SHADE_SURFACE_DIRECT_LIGHT); integrate_surface_direct_light<node_feature_mask>(kg, state, &sd, &rng_state); |