diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-02-07 14:17:19 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-02-07 14:17:19 +0300 |
commit | 7d2c4384e275a1ff5ab289b859d6e75a29645115 (patch) | |
tree | 562bfb8aee5bf8db61f369933cbef1a0d931bbe0 /source/blender | |
parent | 65d05fca0dfefce3caf09512bd403779c6fe9497 (diff) |
Fix #20147: AO + onlyshadow wasn't being done right, also updated this
code to work with new ao/env separation.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/render/intern/source/shadeoutput.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index 4192966b1fa..eeb353eb66f 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -1538,18 +1538,21 @@ static void shade_lamp_loop_only_shadow(ShadeInput *shi, ShadeResult *shr) } /* quite disputable this... also note it doesn't mirror-raytrace */ - if((R.wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT)) && shi->amb!=0.0f) { + if((R.wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT)) && shi->amb!=0.0f) { float f; - f= 1.0f - shi->ao[0]; - f= R.wrld.aoenergy*f*shi->amb; - - if(R.wrld.aomix==WO_AOADD) { - shr->alpha += f; - shr->alpha *= f; + if(R.wrld.mode & WO_AMB_OCC) { + f= R.wrld.aoenergy*shi->amb; + + if(R.wrld.aomix==WO_AOADD) + shr->alpha += f*(1.0f - rgb_to_grayscale(shi->ao)); + else + shr->alpha= (1.0f - f)*shr->alpha + f*(1.0f - (1.0f - shr->alpha)*rgb_to_grayscale(shi->ao)); } - else if(R.wrld.aomix==WO_AOMUL) { - shr->alpha *= f; + + if(R.wrld.mode & WO_ENV_LIGHT) { + f= R.wrld.ao_env_energy*shi->amb; + shr->alpha += f*(1.0f - rgb_to_grayscale(shi->env)); } } } |