Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/kernel_emission.h
| Show All 24 Lines | ccl_device_noinline float3 direct_emissive_eval(KernelGlobals *kg, | ||||
| float t, | float t, | ||||
| float time) | float time) | ||||
| { | { | ||||
| /* setup shading at emitter */ | /* setup shading at emitter */ | ||||
| #ifdef __SPLIT_KERNEL__ | #ifdef __SPLIT_KERNEL__ | ||||
| ShaderData *sd = kg->sd_input; | ShaderData *sd = kg->sd_input; | ||||
| #else | #else | ||||
| ShaderData sd_object; | ShaderData sd_object; | ||||
| ShaderClosure sd_object_closure[MAX_EMISSION_CLOSURE]; | |||||
| sd_object.closure = sd_object_closure; | |||||
| sd_object.max_closure = MAX_EMISSION_CLOSURE; | |||||
| ShaderData *sd = &sd_object; | ShaderData *sd = &sd_object; | ||||
| #endif | #endif | ||||
| float3 eval; | float3 eval; | ||||
| #ifdef __BACKGROUND_MIS__ | #ifdef __BACKGROUND_MIS__ | ||||
| if(ls->type == LIGHT_BACKGROUND) { | if(ls->type == LIGHT_BACKGROUND) { | ||||
| Ray ray; | Ray ray; | ||||
| ray.D = ls->D; | ray.D = ls->D; | ||||
| ▲ Show 20 Lines • Show All 233 Lines • ▼ Show 20 Lines | if(((shader & SHADER_EXCLUDE_DIFFUSE) && (state->flag & PATH_RAY_DIFFUSE)) || | ||||
| ((shader & SHADER_EXCLUDE_TRANSMIT) && (state->flag & PATH_RAY_TRANSMIT)) || | ((shader & SHADER_EXCLUDE_TRANSMIT) && (state->flag & PATH_RAY_TRANSMIT)) || | ||||
| ((shader & SHADER_EXCLUDE_CAMERA) && (state->flag & PATH_RAY_CAMERA)) || | ((shader & SHADER_EXCLUDE_CAMERA) && (state->flag & PATH_RAY_CAMERA)) || | ||||
| ((shader & SHADER_EXCLUDE_SCATTER) && (state->flag & PATH_RAY_VOLUME_SCATTER))) | ((shader & SHADER_EXCLUDE_SCATTER) && (state->flag & PATH_RAY_VOLUME_SCATTER))) | ||||
| return make_float3(0.0f, 0.0f, 0.0f); | return make_float3(0.0f, 0.0f, 0.0f); | ||||
| } | } | ||||
| /* evaluate background closure */ | /* evaluate background closure */ | ||||
| # ifdef __SPLIT_KERNEL__ | # ifdef __SPLIT_KERNEL__ | ||||
| ShaderData *sd = kg->sd_input; | |||||
| Ray priv_ray = *ray; | Ray priv_ray = *ray; | ||||
| shader_setup_from_background(kg, kg->sd_input, &priv_ray); | shader_setup_from_background(kg, sd, &priv_ray); | ||||
| path_state_modify_bounce(state, true); | |||||
| float3 L = shader_eval_background(kg, kg->sd_input, state, state->flag, SHADER_CONTEXT_EMISSION); | |||||
| path_state_modify_bounce(state, false); | |||||
| # else | # else | ||||
| ShaderData sd; | ShaderData emission_sd; | ||||
| shader_setup_from_background(kg, &sd, ray); | ShaderClosure emission_sd_closure[MAX_EMISSION_CLOSURE]; | ||||
| emission_sd.closure = emission_sd_closure; | |||||
| emission_sd.max_closure = MAX_EMISSION_CLOSURE; | |||||
| ShaderData *sd = &emission_sd; | |||||
| shader_setup_from_background(kg, sd, ray); | |||||
| # endif | |||||
| path_state_modify_bounce(state, true); | path_state_modify_bounce(state, true); | ||||
| float3 L = shader_eval_background(kg, &sd, state, state->flag, SHADER_CONTEXT_EMISSION); | float3 L = shader_eval_background(kg, sd, state, state->flag, SHADER_CONTEXT_EMISSION); | ||||
| path_state_modify_bounce(state, false); | path_state_modify_bounce(state, false); | ||||
| # endif | |||||
| #ifdef __BACKGROUND_MIS__ | #ifdef __BACKGROUND_MIS__ | ||||
| /* check if background light exists or if we should skip pdf */ | /* check if background light exists or if we should skip pdf */ | ||||
| int res = kernel_data.integrator.pdf_background_res; | int res = kernel_data.integrator.pdf_background_res; | ||||
| if(!(state->flag & PATH_RAY_MIS_SKIP) && res) { | if(!(state->flag & PATH_RAY_MIS_SKIP) && res) { | ||||
| /* multiple importance sampling, get background light pdf for ray | /* multiple importance sampling, get background light pdf for ray | ||||
| * direction, and compute weight with respect to BSDF pdf */ | * direction, and compute weight with respect to BSDF pdf */ | ||||
| Show All 15 Lines | |||||