Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/kernel_light.h
| Show First 20 Lines • Show All 104 Lines • ▼ Show 20 Lines | ccl_device float3 background_light_sample(KernelGlobals *kg, float randu, float randv, float *pdf) | ||||
| if(sin_theta == 0.0f || denom == 0.0f) | if(sin_theta == 0.0f || denom == 0.0f) | ||||
| *pdf = 0.0f; | *pdf = 0.0f; | ||||
| else | else | ||||
| *pdf = (cdf_u.x * cdf_v.x)/(M_2PI_F * M_PI_F * sin_theta * denom); | *pdf = (cdf_u.x * cdf_v.x)/(M_2PI_F * M_PI_F * sin_theta * denom); | ||||
| *pdf *= kernel_data.integrator.pdf_lights; | *pdf *= kernel_data.integrator.pdf_lights; | ||||
| /* compute direction */ | /* compute direction */ | ||||
| return -equirectangular_to_direction(u, v); | return -equirectangular_to_direction(u, v, FULL_RANGE); | ||||
| } | } | ||||
| ccl_device float background_light_pdf(KernelGlobals *kg, float3 direction) | ccl_device float background_light_pdf(KernelGlobals *kg, float3 direction) | ||||
| { | { | ||||
| float2 uv = direction_to_equirectangular(direction); | float2 uv = direction_to_equirectangular(direction, FULL_RANGE); | ||||
| int res = kernel_data.integrator.pdf_background_res; | int res = kernel_data.integrator.pdf_background_res; | ||||
| float sin_theta = sinf(uv.y * M_PI_F); | float sin_theta = sinf(uv.y * M_PI_F); | ||||
| if(sin_theta == 0.0f) | if(sin_theta == 0.0f) | ||||
| return 0.0f; | return 0.0f; | ||||
| int index_u = clamp(float_to_int(uv.x * res), 0, res - 1); | int index_u = clamp(float_to_int(uv.x * res), 0, res - 1); | ||||
| ▲ Show 20 Lines • Show All 573 Lines • Show Last 20 Lines | |||||