Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/integrator/shade_volume.h
| Show First 20 Lines • Show All 691 Lines • ▼ Show 20 Lines | ccl_device_forceinline bool integrate_volume_sample_light( | ||||
| /* Test if there is a light or BSDF that needs direct light. */ | /* Test if there is a light or BSDF that needs direct light. */ | ||||
| if (!kernel_data.integrator.use_direct_light) { | if (!kernel_data.integrator.use_direct_light) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| /* Sample position on a light. */ | /* Sample position on a light. */ | ||||
| const uint32_t path_flag = INTEGRATOR_STATE(state, path, flag); | const uint32_t path_flag = INTEGRATOR_STATE(state, path, flag); | ||||
| const uint bounce = INTEGRATOR_STATE(state, path, bounce); | const uint bounce = INTEGRATOR_STATE(state, path, bounce); | ||||
| const float2 rand_light = path_state_rng_2D(kg, rng_state, PRNG_VOLUME_SEGMENT_LIGHT); | float2 rand_light = path_state_rng_2D(kg, rng_state, PRNG_VOLUME_SEGMENT_LIGHT); | ||||
| if (!light_sample_from_volume_segment(kg, | if (!light_sample_from_volume_segment(kg, | ||||
| rng_state, | rng_state, | ||||
| rand_light.x, | rand_light.x, | ||||
| rand_light.y, | rand_light.y, | ||||
| sd->time, | sd->time, | ||||
| sd->P, | sd->P, | ||||
| ray->D, | ray->D, | ||||
| Show All 26 Lines | ccl_device_forceinline void integrate_volume_direct_light( | ||||
| PROFILING_INIT(kg, PROFILING_SHADE_VOLUME_DIRECT_LIGHT); | PROFILING_INIT(kg, PROFILING_SHADE_VOLUME_DIRECT_LIGHT); | ||||
| if (!kernel_data.integrator.use_direct_light) { | if (!kernel_data.integrator.use_direct_light) { | ||||
| return; | return; | ||||
| } | } | ||||
| /* Sample position on the same light again, now from the shading point where we scattered. | /* Sample position on the same light again, now from the shading point where we scattered. | ||||
| * | * | ||||
| * Note that this means we sample the light three twice when equiangular sampling is used. | * Note that this means we sample the light tree twice when equiangular sampling is used. | ||||
| * We could consider sampling the light tree just once and use the same light position again. | * We could consider sampling the light tree just once and use the same light position again. | ||||
| * | * | ||||
| * This would make the PDFs for MIS weights more complicated due to having to account for | * This would make the PDFs for MIS weights more complicated due to having to account for | ||||
| * both distance/equiangular and direct/indirect light sampling, but could be more accurate. | * both distance/equiangular and direct/indirect light sampling, but could be more accurate. | ||||
| * Additionally we could end up behind the light or outside a spot light cone, which might | * Additionally we could end up behind the light or outside a spot light cone, which might | ||||
| * waste a sample. Though on the other hand it would be possible to prevent that with | * waste a sample. Though on the other hand it would be possible to prevent that with | ||||
| * equiangular sampling restricted to a smaller sub-segment where the light has influence. */ | * equiangular sampling restricted to a smaller sub-segment where the light has influence. */ | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 418 Lines • Show Last 20 Lines | |||||