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/render/buffers.cpp
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/render/buffers.cpp')
-rw-r--r--intern/cycles/render/buffers.cpp27
1 files changed, 20 insertions, 7 deletions
diff --git a/intern/cycles/render/buffers.cpp b/intern/cycles/render/buffers.cpp
index c8d5dd2da8d..da0453e5822 100644
--- a/intern/cycles/render/buffers.cpp
+++ b/intern/cycles/render/buffers.cpp
@@ -186,15 +186,28 @@ bool RenderBuffers::get_pass(PassType type, float exposure, int sample, int comp
assert(pass.components == components);
/* RGBA */
- for(int i = 0; i < size; i++, in += pass_stride, pixels += 4) {
- float4 f = make_float4(in[0], in[1], in[2], in[3]);
+ if(type == PASS_SHADOW) {
+ for(int i = 0; i < size; i++, in += pass_stride, pixels += 4) {
+ float4 f = make_float4(in[0], in[1], in[2], in[3]);
+ float invw = (f.w > 0.0f)? 1.0f/f.w: 1.0f;
+
+ pixels[0] = f.x*invw;
+ pixels[1] = f.y*invw;
+ pixels[2] = f.z*invw;
+ pixels[3] = 1.0f;
+ }
+ }
+ else {
+ for(int i = 0; i < size; i++, in += pass_stride, pixels += 4) {
+ float4 f = make_float4(in[0], in[1], in[2], in[3]);
- pixels[0] = f.x*scale_exposure;
- pixels[1] = f.y*scale_exposure;
- pixels[2] = f.z*scale_exposure;
+ pixels[0] = f.x*scale_exposure;
+ pixels[1] = f.y*scale_exposure;
+ pixels[2] = f.z*scale_exposure;
- /* clamp since alpha might be > 1.0 due to russian roulette */
- pixels[3] = clamp(f.w*scale, 0.0f, 1.0f);
+ /* clamp since alpha might be > 1.0 due to russian roulette */
+ pixels[3] = clamp(f.w*scale, 0.0f, 1.0f);
+ }
}
}