forked from bartvdbraak/blender
Fix T45447: Area light importance sampling improvement
Turning on importance sampling on area lights increases noise on diffuse surfaces. This was caused by PDF calculated for an intersected point on light instead of original light position. Patch by Stefan with some own modifications.
This commit is contained in:
parent
b00c49838a
commit
51385f6fe8
@ -728,15 +728,15 @@ ccl_device bool lamp_light_eval(KernelGlobals *kg, int lamp, float3 P, float3 D,
|
||||
if(dot(D, Ng) >= 0.0f)
|
||||
return false;
|
||||
|
||||
ls->P = make_float3(data0.y, data0.z, data0.w);
|
||||
float3 light_P = make_float3(data0.y, data0.z, data0.w);
|
||||
|
||||
if(!ray_quad_intersect(P, D, t,
|
||||
ls->P, axisu, axisv, &ls->P, &ls->t))
|
||||
light_P, axisu, axisv, &ls->P, &ls->t))
|
||||
return false;
|
||||
|
||||
ls->D = D;
|
||||
ls->Ng = Ng;
|
||||
ls->pdf = area_light_sample(P, &ls->P, axisu, axisv, 0, 0, false);
|
||||
ls->pdf = area_light_sample(P, &light_P, axisu, axisv, 0, 0, false);
|
||||
ls->eval_fac = 0.25f*invarea;
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user