Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/kernel_path_volume.h
| Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | #ifdef __EMISSION__ | ||||
| /* connect to light from given point where shader has been evaluated */ | /* connect to light from given point where shader has been evaluated */ | ||||
| # ifdef __OBJECT_MOTION__ | # ifdef __OBJECT_MOTION__ | ||||
| light_ray.time = sd->time; | light_ray.time = sd->time; | ||||
| # endif | # endif | ||||
| if(light_sample(kg, light_t, light_u, light_v, sd->time, sd->P, state->bounce, &ls)) | if(light_sample(kg, light_t, light_u, light_v, sd->time, sd->P, state->bounce, &ls)) | ||||
| { | { | ||||
| if(direct_emission(kg, sd, emission_sd, &ls, state, &light_ray, &L_light, &is_lamp)) { | float terminate = path_state_rng_light_termination(kg, rng, state); | ||||
| if(direct_emission(kg, sd, emission_sd, &ls, state, &light_ray, &L_light, &is_lamp, terminate)) { | |||||
| /* trace shadow ray */ | /* trace shadow ray */ | ||||
| float3 shadow; | float3 shadow; | ||||
| if(!shadow_blocked(kg, emission_sd, state, &light_ray, &shadow)) { | if(!shadow_blocked(kg, emission_sd, state, &light_ray, &shadow)) { | ||||
| /* accumulate */ | /* accumulate */ | ||||
| path_radiance_accum_light(L, throughput, &L_light, shadow, 1.0f, state->bounce, is_lamp); | path_radiance_accum_light(L, throughput, &L_light, shadow, 1.0f, state->bounce, is_lamp); | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 96 Lines • ▼ Show 20 Lines | for(int i = 0; i < kernel_data.integrator.num_all_lights; i++) { | ||||
| (void)result; | (void)result; | ||||
| kernel_assert(result == VOLUME_PATH_SCATTERED); | kernel_assert(result == VOLUME_PATH_SCATTERED); | ||||
| /* todo: split up light_sample so we don't have to call it again with new position */ | /* todo: split up light_sample so we don't have to call it again with new position */ | ||||
| if(lamp_light_sample(kg, i, light_u, light_v, sd->P, &ls)) { | if(lamp_light_sample(kg, i, light_u, light_v, sd->P, &ls)) { | ||||
| if(kernel_data.integrator.pdf_triangles != 0.0f) | if(kernel_data.integrator.pdf_triangles != 0.0f) | ||||
| ls.pdf *= 2.0f; | ls.pdf *= 2.0f; | ||||
| if(direct_emission(kg, sd, emission_sd, &ls, state, &light_ray, &L_light, &is_lamp)) { | float terminate = path_branched_rng_light_termination(kg, rng, state, j, num_samples); | ||||
| if(direct_emission(kg, sd, emission_sd, &ls, state, &light_ray, &L_light, &is_lamp, terminate)) { | |||||
| /* trace shadow ray */ | /* trace shadow ray */ | ||||
| float3 shadow; | float3 shadow; | ||||
| if(!shadow_blocked(kg, emission_sd, state, &light_ray, &shadow)) { | if(!shadow_blocked(kg, emission_sd, state, &light_ray, &shadow)) { | ||||
| /* accumulate */ | /* accumulate */ | ||||
| path_radiance_accum_light(L, tp*num_samples_inv, &L_light, shadow, num_samples_inv, state->bounce, is_lamp); | path_radiance_accum_light(L, tp*num_samples_inv, &L_light, shadow, num_samples_inv, state->bounce, is_lamp); | ||||
| } | } | ||||
| } | } | ||||
| Show All 31 Lines | if(kernel_data.integrator.pdf_triangles != 0.0f) { | ||||
| (void)result; | (void)result; | ||||
| kernel_assert(result == VOLUME_PATH_SCATTERED); | kernel_assert(result == VOLUME_PATH_SCATTERED); | ||||
| /* todo: split up light_sample so we don't have to call it again with new position */ | /* todo: split up light_sample so we don't have to call it again with new position */ | ||||
| if(light_sample(kg, light_t, light_u, light_v, sd->time, sd->P, state->bounce, &ls)) { | if(light_sample(kg, light_t, light_u, light_v, sd->time, sd->P, state->bounce, &ls)) { | ||||
| if(kernel_data.integrator.num_all_lights) | if(kernel_data.integrator.num_all_lights) | ||||
| ls.pdf *= 2.0f; | ls.pdf *= 2.0f; | ||||
| if(direct_emission(kg, sd, emission_sd, &ls, state, &light_ray, &L_light, &is_lamp)) { | float terminate = path_branched_rng_light_termination(kg, rng, state, j, num_samples); | ||||
| if(direct_emission(kg, sd, emission_sd, &ls, state, &light_ray, &L_light, &is_lamp, terminate)) { | |||||
| /* trace shadow ray */ | /* trace shadow ray */ | ||||
| float3 shadow; | float3 shadow; | ||||
| if(!shadow_blocked(kg, emission_sd, state, &light_ray, &shadow)) { | if(!shadow_blocked(kg, emission_sd, state, &light_ray, &shadow)) { | ||||
| /* accumulate */ | /* accumulate */ | ||||
| path_radiance_accum_light(L, tp*num_samples_inv, &L_light, shadow, num_samples_inv, state->bounce, is_lamp); | path_radiance_accum_light(L, tp*num_samples_inv, &L_light, shadow, num_samples_inv, state->bounce, is_lamp); | ||||
| } | } | ||||
| } | } | ||||
| Show All 20 Lines | VolumeIntegrateResult result = kernel_volume_decoupled_scatter(kg, | ||||
| state, ray, sd, &tp, rphase, rscatter, segment, (ls.t != FLT_MAX)? &ls.P: NULL, false); | state, ray, sd, &tp, rphase, rscatter, segment, (ls.t != FLT_MAX)? &ls.P: NULL, false); | ||||
| (void)result; | (void)result; | ||||
| kernel_assert(result == VOLUME_PATH_SCATTERED); | kernel_assert(result == VOLUME_PATH_SCATTERED); | ||||
| /* todo: split up light_sample so we don't have to call it again with new position */ | /* todo: split up light_sample so we don't have to call it again with new position */ | ||||
| if(light_sample(kg, light_t, light_u, light_v, sd->time, sd->P, state->bounce, &ls)) { | if(light_sample(kg, light_t, light_u, light_v, sd->time, sd->P, state->bounce, &ls)) { | ||||
| /* sample random light */ | /* sample random light */ | ||||
| if(direct_emission(kg, sd, emission_sd, &ls, state, &light_ray, &L_light, &is_lamp)) { | float terminate = path_state_rng_light_termination(kg, rng, state); | ||||
| if(direct_emission(kg, sd, emission_sd, &ls, state, &light_ray, &L_light, &is_lamp, terminate)) { | |||||
| /* trace shadow ray */ | /* trace shadow ray */ | ||||
| float3 shadow; | float3 shadow; | ||||
| if(!shadow_blocked(kg, emission_sd, state, &light_ray, &shadow)) { | if(!shadow_blocked(kg, emission_sd, state, &light_ray, &shadow)) { | ||||
| /* accumulate */ | /* accumulate */ | ||||
| path_radiance_accum_light(L, tp, &L_light, shadow, 1.0f, state->bounce, is_lamp); | path_radiance_accum_light(L, tp, &L_light, shadow, 1.0f, state->bounce, is_lamp); | ||||
| } | } | ||||
| } | } | ||||
| Show All 9 Lines | |||||