diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-05-19 17:14:43 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-05-19 17:14:43 +0400 |
commit | db2d900f74b5e7e127999faedd1b1e6f2d9db363 (patch) | |
tree | 2f74480c9a3439a8c6ddc58b5b3302a039b6b2c0 /intern/cycles/kernel/kernel_bake.h | |
parent | 6252f7502578a8c89faf0da9a85674a51b877164 (diff) |
Fix T40135: cycles baking did not support branched path settings yet.
Diffstat (limited to 'intern/cycles/kernel/kernel_bake.h')
-rw-r--r-- | intern/cycles/kernel/kernel_bake.h | 68 |
1 files changed, 49 insertions, 19 deletions
diff --git a/intern/cycles/kernel/kernel_bake.h b/intern/cycles/kernel/kernel_bake.h index b8c64af658f..abe356996ab 100644 --- a/intern/cycles/kernel/kernel_bake.h +++ b/intern/cycles/kernel/kernel_bake.h @@ -45,33 +45,63 @@ ccl_device void compute_light_pass(KernelGlobals *kg, ShaderData *sd, PathRadian /* TODO, disable the closures we won't need */ - /* sample ambient occlusion */ - if(is_combined || is_ao) { - kernel_path_ao(kg, sd, &L_sample, &state, &rng, throughput); - } +#ifdef __BRANCHED_PATH__ + if(!kernel_data.integrator.branched) { + /* regular path tracer */ +#endif + + /* sample ambient occlusion */ + if(is_combined || is_ao) { + kernel_path_ao(kg, sd, &L_sample, &state, &rng, throughput); + } - /* sample subsurface scattering */ - if((is_combined || is_sss) && (sd->flag & SD_BSSRDF)) { #ifdef __SUBSURFACE__ - /* 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; + /* sample subsurface scattering */ + if((is_combined || is_sss) && (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; + } #endif - } - /* sample light and BSDF */ - if((!is_sss) && (!is_ao)) { - if(kernel_path_integrate_lighting(kg, &rng, sd, &throughput, &state, &L_sample, &ray)) { + /* sample light and BSDF */ + if((!is_sss) && (!is_ao)) { + if(kernel_path_integrate_lighting(kg, &rng, sd, &throughput, &state, &L_sample, &ray)) { #ifdef __LAMP_MIS__ - state.ray_t = 0.0f; + state.ray_t = 0.0f; +#endif + /* compute indirect light */ + kernel_path_indirect(kg, &rng, ray, throughput, state.num_samples, state, &L_sample); + + /* sum and reset indirect light pass variables for the next samples */ + path_radiance_sum_indirect(&L_sample); + path_radiance_reset_indirect(&L_sample); + } + } +#ifdef __BRANCHED_PATH__ + } + else { + /* branched path tracer */ + + /* sample ambient occlusion */ + if(is_combined || is_ao) { + kernel_branched_path_ao(kg, sd, &L_sample, &state, &rng, throughput); + } + +#ifdef __SUBSURFACE__ + /* sample subsurface scattering */ + if((is_combined || is_sss) && (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 - /* compute indirect light */ - kernel_path_indirect(kg, &rng, ray, throughput, state.num_samples, state, &L_sample); - /* sum and reset indirect light pass variables for the next samples */ - path_radiance_sum_indirect(&L_sample); - path_radiance_reset_indirect(&L_sample); + /* sample light and BSDF */ + if((!is_sss) && (!is_ao)) { + kernel_branched_path_integrate_lighting(kg, &rng, + sd, throughput, 1.0f, &state, &L_sample); } +#endif } /* accumulate into master L */ |