Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/kernel_accumulate.h
| Show First 20 Lines • Show All 90 Lines • ▼ Show 20 Lines | #ifdef __PASSES__ | ||||
| } | } | ||||
| else | else | ||||
| #endif | #endif | ||||
| { | { | ||||
| return is_zero(eval->diffuse); | return is_zero(eval->diffuse); | ||||
| } | } | ||||
| } | } | ||||
| ccl_device_inline void bsdf_eval_mul(BsdfEval *eval, float3 value) | ccl_device_inline void bsdf_eval_mul(BsdfEval *eval, float value) | ||||
| { | { | ||||
| #ifdef __PASSES__ | #ifdef __PASSES__ | ||||
| if(eval->use_light_pass) { | if(eval->use_light_pass) { | ||||
| eval->diffuse *= value; | eval->diffuse *= value; | ||||
| eval->glossy *= value; | eval->glossy *= value; | ||||
| eval->transmission *= value; | eval->transmission *= value; | ||||
| eval->subsurface *= value; | eval->subsurface *= value; | ||||
| eval->scatter *= value; | eval->scatter *= value; | ||||
| /* skipping transparent, this function is used by for eval(), will be zero then */ | /* skipping transparent, this function is used by for eval(), will be zero then */ | ||||
| } | } | ||||
| else | else | ||||
| #endif | #endif | ||||
| { | { | ||||
| eval->diffuse *= value; | eval->diffuse *= value; | ||||
| } | } | ||||
| } | } | ||||
| ccl_device_inline void bsdf_eval_mul3(BsdfEval *eval, float3 value) | |||||
| { | |||||
| #ifdef __PASSES__ | |||||
| if(eval->use_light_pass) { | |||||
| eval->diffuse *= value; | |||||
| eval->glossy *= value; | |||||
| eval->transmission *= value; | |||||
| eval->subsurface *= value; | |||||
| eval->scatter *= value; | |||||
| /* skipping transparent, this function is used by for eval(), will be zero then */ | |||||
| } | |||||
| else | |||||
| eval->diffuse *= value; | |||||
| #else | |||||
| eval->diffuse *= value; | |||||
| #endif | |||||
| } | |||||
| ccl_device_inline float3 bsdf_eval_sum(BsdfEval *eval) | |||||
| { | |||||
| #ifdef __PASSES__ | |||||
| if(eval->use_light_pass) { | |||||
| return eval->diffuse + eval->glossy + eval->transmission + eval->subsurface + eval->scatter; | |||||
| } | |||||
| else | |||||
| #endif | |||||
| return eval->diffuse; | |||||
| } | |||||
| /* Path Radiance | /* Path Radiance | ||||
| * | * | ||||
| * We accumulate different render passes separately. After summing at the end | * We accumulate different render passes separately. After summing at the end | ||||
| * to get the combined result, it should be identical. We definite directly | * to get the combined result, it should be identical. We definite directly | ||||
| * visible as the first non-transparent hit, while indirectly visible are the | * visible as the first non-transparent hit, while indirectly visible are the | ||||
| * bounces after that. */ | * bounces after that. */ | ||||
| ccl_device_inline void path_radiance_init(PathRadiance *L, int use_light_pass) | ccl_device_inline void path_radiance_init(PathRadiance *L, int use_light_pass) | ||||
| ▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | if(bounce == 0 && !(bsdf_label & LABEL_TRANSPARENT)) { | ||||
| L->path_scatter = bsdf_eval->scatter*value; | L->path_scatter = bsdf_eval->scatter*value; | ||||
| *throughput = L->path_diffuse + L->path_glossy + L->path_transmission + L->path_subsurface + L->path_scatter; | *throughput = L->path_diffuse + L->path_glossy + L->path_transmission + L->path_subsurface + L->path_scatter; | ||||
| L->direct_throughput = *throughput; | L->direct_throughput = *throughput; | ||||
| } | } | ||||
| else { | else { | ||||
| /* transparent bounce before first hit, or indirectly visible through BSDF */ | /* transparent bounce before first hit, or indirectly visible through BSDF */ | ||||
| float3 sum = (bsdf_eval->diffuse + bsdf_eval->glossy + bsdf_eval->transmission + bsdf_eval->transparent + | float3 sum = (bsdf_eval_sum(bsdf_eval) + bsdf_eval->transparent) * inverse_pdf; | ||||
| bsdf_eval->subsurface + bsdf_eval->scatter) * inverse_pdf; | |||||
| *throughput *= sum; | *throughput *= sum; | ||||
| } | } | ||||
| } | } | ||||
| else | else | ||||
| #endif | #endif | ||||
| { | { | ||||
| *throughput *= bsdf_eval->diffuse*inverse_pdf; | *throughput *= bsdf_eval->diffuse*inverse_pdf; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | if(bounce == 0) { | ||||
| if(is_lamp) { | if(is_lamp) { | ||||
| L->shadow.x += shadow.x*shadow_fac; | L->shadow.x += shadow.x*shadow_fac; | ||||
| L->shadow.y += shadow.y*shadow_fac; | L->shadow.y += shadow.y*shadow_fac; | ||||
| L->shadow.z += shadow.z*shadow_fac; | L->shadow.z += shadow.z*shadow_fac; | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| /* indirectly visible lighting after BSDF bounce */ | /* indirectly visible lighting after BSDF bounce */ | ||||
| float3 sum = bsdf_eval->diffuse + bsdf_eval->glossy + bsdf_eval->transmission + bsdf_eval->subsurface + bsdf_eval->scatter; | L->indirect += throughput*bsdf_eval_sum(bsdf_eval)*shadow; | ||||
| L->indirect += throughput*sum*shadow; | |||||
| } | } | ||||
| } | } | ||||
| else | else | ||||
| #endif | #endif | ||||
| { | { | ||||
| L->emission += throughput*bsdf_eval->diffuse*shadow; | L->emission += throughput*bsdf_eval->diffuse*shadow; | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 201 Lines • Show Last 20 Lines | |||||