Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2017-11-07 05:28:10 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2017-11-08 00:35:12 +0300
commite74b2293422b91f8c8de8d76fcbb5241caaa7a6b (patch)
tree6666a088d7f62d48cfe741f335b56127178c57e7 /intern/cycles/kernel/kernel_light.h
parent5f2be40658a29b44f66db6369409ac4460d2ea9e (diff)
Fix incorrect MIS weights in Cycles with multiple lights.
This causes some difference in the classroom scene, where ray visibility tricks are used and break the MIS balance. Otherwise there doesn't seem to be much effect, but better to use the right formulas. Problem originally identified by Lukas.
Diffstat (limited to 'intern/cycles/kernel/kernel_light.h')
-rw-r--r--intern/cycles/kernel/kernel_light.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/intern/cycles/kernel/kernel_light.h b/intern/cycles/kernel/kernel_light.h
index c806deee8e7..dfa3150dc92 100644
--- a/intern/cycles/kernel/kernel_light.h
+++ b/intern/cycles/kernel/kernel_light.h
@@ -547,7 +547,7 @@ ccl_device_inline bool lamp_light_sample(KernelGlobals *kg,
float costheta = dot(lightD, D);
ls->pdf = invarea/(costheta*costheta*costheta);
- ls->eval_fac = ls->pdf*kernel_data.integrator.inv_pdf_lights;
+ ls->eval_fac = ls->pdf;
}
#ifdef __BACKGROUND_MIS__
else if(type == LIGHT_BACKGROUND) {
@@ -559,7 +559,6 @@ ccl_device_inline bool lamp_light_sample(KernelGlobals *kg,
ls->D = -D;
ls->t = FLT_MAX;
ls->eval_fac = 1.0f;
- ls->pdf *= kernel_data.integrator.pdf_lights;
}
#endif
else {
@@ -622,10 +621,10 @@ ccl_device_inline bool lamp_light_sample(KernelGlobals *kg,
float invarea = data2.x;
ls->eval_fac = 0.25f*invarea;
}
-
- ls->eval_fac *= kernel_data.integrator.inv_pdf_lights;
}
+ ls->pdf *= kernel_data.integrator.pdf_lights;
+
return (ls->pdf > 0.0f);
}
@@ -757,8 +756,11 @@ ccl_device bool lamp_light_eval(KernelGlobals *kg, int lamp, float3 P, float3 D,
ls->pdf = area_light_sample(P, &light_P, axisu, axisv, 0, 0, false);
ls->eval_fac = 0.25f*invarea;
}
- else
+ else {
return false;
+ }
+
+ ls->pdf *= kernel_data.integrator.pdf_lights;
return true;
}