Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/kernel_path.h
| Show First 20 Lines • Show All 130 Lines • ▼ Show 20 Lines | ccl_device_forceinline void kernel_path_background( | ||||
| KernelGlobals *kg, | KernelGlobals *kg, | ||||
| ccl_addr_space PathState *state, | ccl_addr_space PathState *state, | ||||
| ccl_addr_space Ray *ray, | ccl_addr_space Ray *ray, | ||||
| float3 throughput, | float3 throughput, | ||||
| ShaderData *emission_sd, | ShaderData *emission_sd, | ||||
| PathRadiance *L) | PathRadiance *L) | ||||
| { | { | ||||
| /* eval background shader if nothing hit */ | /* eval background shader if nothing hit */ | ||||
| if(kernel_data.background.transparent && (state->flag & PATH_RAY_CAMERA)) { | if(kernel_data.background.transparent && (state->flag & PATH_RAY_TRANSPARENT_BACKGROUND)) { | ||||
| L->transparent += average(throughput); | L->transparent += average(throughput); | ||||
| #ifdef __PASSES__ | #ifdef __PASSES__ | ||||
| if(!(kernel_data.film.pass_flag & PASS_BACKGROUND)) | if(!(kernel_data.film.pass_flag & PASS_BACKGROUND)) | ||||
| #endif /* __PASSES__ */ | #endif /* __PASSES__ */ | ||||
| return; | return; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 127 Lines • ▼ Show 20 Lines | ccl_device_forceinline bool kernel_path_shader_apply( | ||||
| ccl_addr_space Ray *ray, | ccl_addr_space Ray *ray, | ||||
| float3 throughput, | float3 throughput, | ||||
| ShaderData *emission_sd, | ShaderData *emission_sd, | ||||
| PathRadiance *L, | PathRadiance *L, | ||||
| ccl_global float *buffer) | ccl_global float *buffer) | ||||
| { | { | ||||
| #ifdef __SHADOW_TRICKS__ | #ifdef __SHADOW_TRICKS__ | ||||
| if((sd->object_flag & SD_OBJECT_SHADOW_CATCHER)) { | if((sd->object_flag & SD_OBJECT_SHADOW_CATCHER)) { | ||||
| if(state->flag & PATH_RAY_CAMERA) { | if(state->flag & PATH_RAY_TRANSPARENT_BACKGROUND) { | ||||
| state->flag |= (PATH_RAY_SHADOW_CATCHER | | state->flag |= (PATH_RAY_SHADOW_CATCHER | | ||||
| PATH_RAY_STORE_SHADOW_INFO); | PATH_RAY_STORE_SHADOW_INFO); | ||||
| float3 bg = make_float3(0.0f, 0.0f, 0.0f); | float3 bg = make_float3(0.0f, 0.0f, 0.0f); | ||||
| if(!kernel_data.background.transparent) { | if(!kernel_data.background.transparent) { | ||||
| bg = indirect_background(kg, emission_sd, state, ray); | bg = indirect_background(kg, emission_sd, state, ray); | ||||
| } | } | ||||
| path_radiance_accum_shadowcatcher(L, throughput, bg); | path_radiance_accum_shadowcatcher(L, throughput, bg); | ||||
| } | } | ||||
| } | } | ||||
| else if(state->flag & PATH_RAY_SHADOW_CATCHER) { | else if(state->flag & PATH_RAY_SHADOW_CATCHER) { | ||||
| /* Only update transparency after shadow catcher bounce. */ | /* Only update transparency after shadow catcher bounce. */ | ||||
| L->shadow_transparency *= | L->shadow_transparency *= | ||||
| average(shader_bsdf_transparency(kg, sd)); | average(shader_bsdf_transparency(kg, sd)); | ||||
| } | } | ||||
| #endif /* __SHADOW_TRICKS__ */ | #endif /* __SHADOW_TRICKS__ */ | ||||
| /* holdout */ | /* holdout */ | ||||
| #ifdef __HOLDOUT__ | #ifdef __HOLDOUT__ | ||||
| if(((sd->flag & SD_HOLDOUT) || | if(((sd->flag & SD_HOLDOUT) || | ||||
| (sd->object_flag & SD_OBJECT_HOLDOUT_MASK)) && | (sd->object_flag & SD_OBJECT_HOLDOUT_MASK)) && | ||||
| (state->flag & PATH_RAY_CAMERA)) | (state->flag & PATH_RAY_TRANSPARENT_BACKGROUND)) | ||||
| { | { | ||||
| if(kernel_data.background.transparent) { | if(kernel_data.background.transparent) { | ||||
| float3 holdout_weight; | float3 holdout_weight; | ||||
| if(sd->object_flag & SD_OBJECT_HOLDOUT_MASK) { | if(sd->object_flag & SD_OBJECT_HOLDOUT_MASK) { | ||||
| holdout_weight = make_float3(1.0f, 1.0f, 1.0f); | holdout_weight = make_float3(1.0f, 1.0f, 1.0f); | ||||
| } | } | ||||
| else { | else { | ||||
| holdout_weight = shader_holdout_eval(kg, sd); | holdout_weight = shader_holdout_eval(kg, sd); | ||||
| ▲ Show 20 Lines • Show All 415 Lines • Show Last 20 Lines | |||||