diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-02-28 20:45:08 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-02-28 20:45:08 +0400 |
commit | 22abc63f676dc7681ee8f734cbc96a7279172d24 (patch) | |
tree | 8f945d2a9db54869802aa5eb24c975488c99edd1 /intern/cycles/kernel/kernel_accumulate.h | |
parent | 6cb896ff0a7d24be3ff500585642ae5d61a5b788 (diff) |
Cycles: ambient occlusion support, with AO factor and distance, and a render pass.
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/World#Ambient_Occlusion
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes#Lighting_Passes
Diffstat (limited to 'intern/cycles/kernel/kernel_accumulate.h')
-rw-r--r-- | intern/cycles/kernel/kernel_accumulate.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/intern/cycles/kernel/kernel_accumulate.h b/intern/cycles/kernel/kernel_accumulate.h index e71fad58c96..7d9aaf81906 100644 --- a/intern/cycles/kernel/kernel_accumulate.h +++ b/intern/cycles/kernel/kernel_accumulate.h @@ -135,6 +135,7 @@ __device_inline void path_radiance_init(PathRadiance *L, int use_light_pass) L->emission = make_float3(0.0f, 0.0f, 0.0f); L->background = make_float3(0.0f, 0.0f, 0.0f); + L->ao = make_float3(0.0f, 0.0f, 0.0f); } else L->emission = make_float3(0.0f, 0.0f, 0.0f); @@ -199,6 +200,27 @@ __device_inline void path_radiance_accum_emission(PathRadiance *L, float3 throug #endif } +__device_inline void path_radiance_accum_ao(PathRadiance *L, float3 throughput, float3 bsdf, float3 ao, int bounce) +{ +#ifdef __PASSES__ + if(L->use_light_pass) { + if(bounce == 0) { + /* directly visible lighting */ + L->direct_diffuse += throughput*bsdf*ao; + L->ao += throughput*ao; + } + else { + /* indirectly visible lighting after BSDF bounce */ + L->indirect += throughput*bsdf*ao; + } + } + else + L->emission += throughput*bsdf*ao; +#else + *L += throughput*bsdf*ao; +#endif +} + __device_inline void path_radiance_accum_light(PathRadiance *L, float3 throughput, BsdfEval *bsdf_eval, int bounce) { #ifdef __PASSES__ |