diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-06-07 22:59:23 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-06-07 22:59:23 +0400 |
commit | 58a290234b0719ce48854e2f6744575b353bf7d3 (patch) | |
tree | 8891bc5663c9b8e19cdaa2a1d58ec0e39ff3f2f3 /intern/cycles/kernel/kernel_emission.h | |
parent | b20a7e01d046b95a79663da1a8072358709a5a8b (diff) |
Cycles: ray visibility options now work for lamps and mesh lights, with and without
multiple importance sampling, so you can disable them for diffuse/glossy/transmission.
The Light Path node here is still weak and does not give this info. To make that
work we'd need to evaluate the shader multiple times which is slow and we can't
detect well enough when it is actually needed.
Diffstat (limited to 'intern/cycles/kernel/kernel_emission.h')
-rw-r--r-- | intern/cycles/kernel/kernel_emission.h | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/intern/cycles/kernel/kernel_emission.h b/intern/cycles/kernel/kernel_emission.h index 74f768c899c..869c8539809 100644 --- a/intern/cycles/kernel/kernel_emission.h +++ b/intern/cycles/kernel/kernel_emission.h @@ -102,8 +102,6 @@ __device_noinline bool direct_emission(KernelGlobals *kg, ShaderData *sd, int li if(is_zero(light_eval)) return false; - /* todo: use visibility flag to skip lights */ - /* evaluate BSDF at shading point */ float bsdf_pdf; @@ -117,6 +115,18 @@ __device_noinline bool direct_emission(KernelGlobals *kg, ShaderData *sd, int li bsdf_eval_mul(eval, light_eval/ls.pdf); +#ifdef __PASSES__ + /* use visibility flag to skip lights */ + if(ls.shader & SHADER_EXCLUDE_ANY) { + if(ls.shader & SHADER_EXCLUDE_DIFFUSE) + eval->diffuse = make_float3(0.0f, 0.0f, 0.0f); + if(ls.shader & SHADER_EXCLUDE_GLOSSY) + eval->glossy = make_float3(0.0f, 0.0f, 0.0f); + if(ls.shader & SHADER_EXCLUDE_TRANSMIT) + eval->transmission = make_float3(0.0f, 0.0f, 0.0f); + } +#endif + if(bsdf_eval_is_zero(eval)) return false; @@ -185,7 +195,19 @@ __device_noinline bool indirect_lamp_emission(KernelGlobals *kg, Ray *ray, int p if(!lamp_light_eval(kg, lamp, ray->P, ray->D, ray->t, &ls)) return false; - + +#ifdef __PASSES__ + /* use visibility flag to skip lights */ + if(ls.shader & SHADER_EXCLUDE_ANY) { + if((ls.shader & SHADER_EXCLUDE_DIFFUSE) && (path_flag & PATH_RAY_DIFFUSE)) + return false; + if((ls.shader & SHADER_EXCLUDE_GLOSSY) && (path_flag & PATH_RAY_GLOSSY)) + return false; + if((ls.shader & SHADER_EXCLUDE_TRANSMIT) && (path_flag & PATH_RAY_TRANSMIT)) + return false; + } +#endif + /* todo: missing texture coordinates */ float u = 0.0f; float v = 0.0f; |