Fix: Cycles NEE not excluding self intersection
which resulted in bias when self intersection is excluded in forward scattering. Below is a comparison using principled BSDF with emission. NEE and MIS were much brighter. Pull Request: https://projects.blender.org/blender/blender/pulls/119440
This commit is contained in:
parent
161881322e
commit
8cbc386152
|
@ -280,6 +280,16 @@ ccl_device
|
|||
|
||||
kernel_assert(ls.pdf != 0.0f);
|
||||
|
||||
const bool is_transmission = dot(ls.D, sd->N) < 0.0f;
|
||||
|
||||
if (ls.prim != PRIM_NONE && ls.prim == sd->prim && ls.object == sd->object) {
|
||||
/* Skip self intersection if light direction lies in the same hemisphere as the geometric
|
||||
* normal. */
|
||||
if (dot(ls.D, is_transmission ? -sd->Ng : sd->Ng) > 0.0f) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Evaluate light shader.
|
||||
*
|
||||
* TODO: can we reuse sd memory? In theory we can move this after
|
||||
|
@ -292,8 +302,6 @@ ccl_device
|
|||
Ray ray ccl_optional_struct_init;
|
||||
BsdfEval bsdf_eval ccl_optional_struct_init;
|
||||
|
||||
const bool is_transmission = dot(ls.D, sd->N) < 0.0f;
|
||||
|
||||
int mnee_vertex_count = 0;
|
||||
#ifdef __MNEE__
|
||||
IF_KERNEL_FEATURE(MNEE)
|
||||
|
|
Loading…
Reference in New Issue