diff options
author | Hristo Gueorguiev <prem.nirved@gmail.com> | 2017-03-21 14:27:12 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-03-27 11:46:59 +0300 |
commit | e07ffcbd1cd527a21f61b42f92aa3b8296ddd941 (patch) | |
tree | b5c16f6a1df7c5053dc103f15cff7d6c1eb3d78c /intern/cycles/kernel/split/kernel_direct_lighting.h | |
parent | 8ada7f73971a9c5232daddf0c6c76262cae4d905 (diff) |
Cycles: Add OpenCL support for shadow catcher feature
The title says it all actually.
Diffstat (limited to 'intern/cycles/kernel/split/kernel_direct_lighting.h')
-rw-r--r-- | intern/cycles/kernel/split/kernel_direct_lighting.h | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/intern/cycles/kernel/split/kernel_direct_lighting.h b/intern/cycles/kernel/split/kernel_direct_lighting.h index 0a0733b9a9f..bdbf7387b95 100644 --- a/intern/cycles/kernel/split/kernel_direct_lighting.h +++ b/intern/cycles/kernel/split/kernel_direct_lighting.h @@ -79,16 +79,32 @@ ccl_device void kernel_direct_lighting(KernelGlobals *kg, /* direct lighting */ #ifdef __EMISSION__ - if((kernel_data.integrator.use_direct_light && - (sd->flag & SD_BSDF_HAS_EVAL))) - { + RNG rng = kernel_split_state.rng[ray_index]; + bool flag = (kernel_data.integrator.use_direct_light && + (sd->flag & SD_BSDF_HAS_EVAL)); +# ifdef __SHADOW_TRICKS__ + if(flag && state->flag & PATH_RAY_SHADOW_CATCHER) { + flag = false; + ShaderData *emission_sd = &kernel_split_state.sd_DL_shadow[ray_index]; + float3 throughput = kernel_split_state.throughput[ray_index]; + PathRadiance *L = &kernel_split_state.path_radiance[ray_index]; + kernel_branched_path_surface_connect_light(kg, + &rng, + sd, + emission_sd, + state, + throughput, + 1.0f, + L, + 1); + } +# endif /* __SHADOW_TRICKS__ */ + if(flag) { /* Sample illumination from lights to find path contribution. */ - RNG rng = kernel_split_state.rng[ray_index]; float light_t = path_state_rng_1D(kg, &rng, state, PRNG_LIGHT); float light_u, light_v; path_state_rng_2D(kg, &rng, state, PRNG_LIGHT_U, &light_u, &light_v); float terminate = path_state_rng_light_termination(kg, &rng, state); - kernel_split_state.rng[ray_index] = rng; LightSample ls; if(light_sample(kg, @@ -99,9 +115,9 @@ ccl_device void kernel_direct_lighting(KernelGlobals *kg, &ls)) { Ray light_ray; -#ifdef __OBJECT_MOTION__ +# ifdef __OBJECT_MOTION__ light_ray.time = sd->time; -#endif +# endif BsdfEval L_light; bool is_lamp; @@ -118,6 +134,7 @@ ccl_device void kernel_direct_lighting(KernelGlobals *kg, } } } + kernel_split_state.rng[ray_index] = rng; #endif /* __EMISSION__ */ } |