Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2012-03-28 14:39:21 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2012-03-28 14:39:21 +0400
commit755f0183240527e9b274ce4f80f1cf1d7e414164 (patch)
treedb8472ce0ba4b4372ad1d3b907edf58c0b674164 /intern/cycles/kernel/kernel_accumulate.h
parent1e5424564c0c01d0772641f3896ffaa1a2616e2b (diff)
Cycles: shadow pass support. Note that this only takes into account lamps,
emitting objects or world lighting do not contribute to the shadow pass. Consider this more as a pass useful for some compositing tricks, unlike other lighting passes this pass can't be used to exactly reconstruct the combined pass.
Diffstat (limited to 'intern/cycles/kernel/kernel_accumulate.h')
-rw-r--r--intern/cycles/kernel/kernel_accumulate.h24
1 files changed, 17 insertions, 7 deletions
diff --git a/intern/cycles/kernel/kernel_accumulate.h b/intern/cycles/kernel/kernel_accumulate.h
index 7860913ce94..1e6605541ca 100644
--- a/intern/cycles/kernel/kernel_accumulate.h
+++ b/intern/cycles/kernel/kernel_accumulate.h
@@ -136,6 +136,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);
+ L->shadow = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
}
else
L->emission = make_float3(0.0f, 0.0f, 0.0f);
@@ -215,26 +216,35 @@ __device_inline void path_radiance_accum_ao(PathRadiance *L, float3 throughput,
#endif
}
-__device_inline void path_radiance_accum_light(PathRadiance *L, float3 throughput, BsdfEval *bsdf_eval, int bounce)
+__device_inline void path_radiance_accum_light(PathRadiance *L, float3 throughput, BsdfEval *bsdf_eval, float3 shadow, int bounce, bool is_lamp)
{
#ifdef __PASSES__
if(L->use_light_pass) {
if(bounce == 0) {
/* directly visible lighting */
- L->direct_diffuse += throughput*bsdf_eval->diffuse;
- L->direct_glossy += throughput*bsdf_eval->glossy;
- L->direct_transmission += throughput*bsdf_eval->transmission;
+ L->direct_diffuse += throughput*bsdf_eval->diffuse*shadow;
+ L->direct_glossy += throughput*bsdf_eval->glossy*shadow;
+ L->direct_transmission += throughput*bsdf_eval->transmission*shadow;
+
+ if(is_lamp) {
+ float3 sum = throughput*(bsdf_eval->diffuse + bsdf_eval->glossy + bsdf_eval->transmission);
+
+ L->shadow.x += shadow.x;
+ L->shadow.y += shadow.y;
+ L->shadow.z += shadow.z;
+ L->shadow.w += average(sum);
+ }
}
else {
/* indirectly visible lighting after BSDF bounce */
float3 sum = bsdf_eval->diffuse + bsdf_eval->glossy + bsdf_eval->transmission;
- L->indirect += throughput*sum;
+ L->indirect += throughput*sum*shadow;
}
}
else
- L->emission += throughput*bsdf_eval->diffuse;
+ L->emission += throughput*bsdf_eval->diffuse*shadow;
#else
- *L += throughput*(*bsdf_eval);
+ *L += throughput*(*bsdf_eval)*shadow;
#endif
}