Fix Cycles rectangular area light in volume segment sampled by ellipse
This commit is contained in:
parent
baf8b3bb88
commit
d17858cb37
|
@ -255,8 +255,9 @@ ccl_device_inline bool area_light_sample(const ccl_global KernelLight *klight,
|
|||
float3 inplane;
|
||||
|
||||
if (in_volume_segment) {
|
||||
/* FIXME: handle rectangular light. */
|
||||
inplane = ellipse_sample(axis_u * len_u * 0.5f, axis_v * len_v * 0.5f, randu, randv);
|
||||
inplane = sample_rectangle ?
|
||||
rectangle_sample(axis_u * len_u * 0.5f, axis_v * len_v * 0.5f, randu, randv) :
|
||||
ellipse_sample(axis_u * len_u * 0.5f, axis_v * len_v * 0.5f, randu, randv);
|
||||
ls->P += inplane;
|
||||
ls->pdf = invarea;
|
||||
}
|
||||
|
|
|
@ -34,6 +34,11 @@ ccl_device_inline float3 ellipse_sample(float3 ru, float3 rv, float randu, float
|
|||
return ru * randu + rv * randv;
|
||||
}
|
||||
|
||||
ccl_device_inline float3 rectangle_sample(float3 ru, float3 rv, float randu, float randv)
|
||||
{
|
||||
return ru * (2.0f * randu - 1.0f) + rv * (2.0f * randv - 1.0f);
|
||||
}
|
||||
|
||||
ccl_device float3 disk_light_sample(float3 v, float randu, float randv)
|
||||
{
|
||||
float3 ru, rv;
|
||||
|
|
Loading…
Reference in New Issue