diff options
author | Janne Karhu <jhkarh@gmail.com> | 2010-10-19 20:10:30 +0400 |
---|---|---|
committer | Janne Karhu <jhkarh@gmail.com> | 2010-10-19 20:10:30 +0400 |
commit | 94aa87dd62eb147c9d68627c020856cd46dc9cf2 (patch) | |
tree | 6262bfa162c596ee1d695eb74515235143df3ed8 /source/blender/render/extern | |
parent | 0a12a9bc7dd38979410156187472f25e5164e1f0 (diff) |
Fix for [#24293] Shadow pass is wrong
* The problem is that shadow pass is derived from the diffuse pass as
shad = shad'/diff, where shad' = shad*diff. In cases where diff is
0 and the division can't be done shad is left as shad' (=0).
* This all works just fine until the diffuse color is 0 on just one
channel (no red in material color for example). In this case the shadow
pass is left as 0 too regardless of the existence of an actual shadow,
so the end result is a colored shadow!
* The only real solution is to use the original shadow intensity to
determine if there actually is a shadow or not. This is now stored in
shr->shad[3] from the lamp shadow calculation.
Note: The best solution would probably be to calculate the shadow pass on
it's own and not to derive it from the diffuse pass, but I didn't dare to
start messing up the shading code totally.
Diffstat (limited to 'source/blender/render/extern')
-rw-r--r-- | source/blender/render/extern/include/RE_shader_ext.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/source/blender/render/extern/include/RE_shader_ext.h b/source/blender/render/extern/include/RE_shader_ext.h index 6cab4a7ce03..71ce269fce6 100644 --- a/source/blender/render/extern/include/RE_shader_ext.h +++ b/source/blender/render/extern/include/RE_shader_ext.h @@ -52,7 +52,7 @@ typedef struct ShadeResult float emit[3]; float diff[3]; /* no ramps, shadow, etc */ float spec[3]; - float shad[3]; + float shad[4]; /* shad[3] is shadow intensity */ float ao[3]; float env[3]; float indirect[3]; |