diff options
Diffstat (limited to 'intern/cycles/kernel/light/sample.h')
-rw-r--r-- | intern/cycles/kernel/light/sample.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/intern/cycles/kernel/light/sample.h b/intern/cycles/kernel/light/sample.h index 6b643a95250..ff5d43ed8cd 100644 --- a/intern/cycles/kernel/light/sample.h +++ b/intern/cycles/kernel/light/sample.h @@ -22,6 +22,7 @@ #include "kernel/light/light.h" #include "kernel/sample/mapping.h" +#include "kernel/sample/mis.h" CCL_NAMESPACE_BEGIN @@ -268,4 +269,36 @@ ccl_device_inline void light_sample_to_volume_shadow_ray( shadow_ray_setup(sd, ls, P, ray); } +ccl_device_inline float light_sample_mis_weight_forward(KernelGlobals kg, + const float forward_pdf, + const float nee_pdf) +{ +#ifdef WITH_CYCLES_DEBUG + if (kernel_data.integrator.direct_light_sampling_type == DIRECT_LIGHT_SAMPLING_FORWARD) { + return 1.0f; + } + else if (kernel_data.integrator.direct_light_sampling_type == DIRECT_LIGHT_SAMPLING_NEE) { + return 0.0f; + } + else +#endif + return power_heuristic(forward_pdf, nee_pdf); +} + +ccl_device_inline float light_sample_mis_weight_nee(KernelGlobals kg, + const float nee_pdf, + const float forward_pdf) +{ +#ifdef WITH_CYCLES_DEBUG + if (kernel_data.integrator.direct_light_sampling_type == DIRECT_LIGHT_SAMPLING_FORWARD) { + return 0.0f; + } + else if (kernel_data.integrator.direct_light_sampling_type == DIRECT_LIGHT_SAMPLING_NEE) { + return 1.0f; + } + else +#endif + return power_heuristic(nee_pdf, forward_pdf); +} + CCL_NAMESPACE_END |