diff options
Diffstat (limited to 'intern/cycles/kernel/light')
-rw-r--r-- | intern/cycles/kernel/light/light.h | 14 | ||||
-rw-r--r-- | intern/cycles/kernel/light/sample.h | 33 |
2 files changed, 34 insertions, 13 deletions
diff --git a/intern/cycles/kernel/light/light.h b/intern/cycles/kernel/light/light.h index 97dca936552..e0a9f1c57f5 100644 --- a/intern/cycles/kernel/light/light.h +++ b/intern/cycles/kernel/light/light.h @@ -676,19 +676,7 @@ ccl_device_forceinline void triangle_light_sample(KernelGlobals kg, ls->D = z * B + safe_sqrtf(1.0f - z * z) * safe_normalize(C_ - dot(C_, B) * B); /* calculate intersection with the planar triangle */ - if (!ray_triangle_intersect(P, - ls->D, - FLT_MAX, -#if defined(__KERNEL_SSE2__) && defined(__KERNEL_SSE__) - (ssef *)V, -#else - V[0], - V[1], - V[2], -#endif - &ls->u, - &ls->v, - &ls->t)) { + if (!ray_triangle_intersect(P, ls->D, FLT_MAX, V[0], V[1], V[2], &ls->u, &ls->v, &ls->t)) { ls->pdf = 0.0f; return; } 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 |