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
path: root/source
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2006-07-05 13:20:46 +0400
committerTon Roosendaal <ton@blender.org>2006-07-05 13:20:46 +0400
commit034c197d61091cdc87e0f0371836f5a4087c05b1 (patch)
treedc2f5c6f22b1e96571219c0f6696aa99e91e3f9f /source
parentd360c4fadf2213a9c1ff4637e1f56c56484f0d44 (diff)
bugfix #4604
Hemi light accidentally got shadow bias applied (to hide terminator probs). This whilst this lamp type doesn't have shadow at all.
Diffstat (limited to 'source')
-rw-r--r--source/blender/render/intern/source/rendercore.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c
index ca24484f7a8..4d00ff13f9c 100644
--- a/source/blender/render/intern/source/rendercore.c
+++ b/source/blender/render/intern/source/rendercore.c
@@ -1259,7 +1259,7 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int
Material *ma= shi->mat;
VlakRen *vlr= shi->vlr;
float lv[3], lampdist, ld= 1.0f, lacol[3], shadfac[4];
- float i, is, inp, i_noshad, *vn, *view, vnor[3], phongcorr;
+ float i, is, inp, i_noshad, *vn, *view, vnor[3], phongcorr=1.0f;
vn= shi->vn;
view= shi->view;
@@ -1384,20 +1384,25 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int
inp= vn[0]*lv[0] + vn[1]*lv[1] + vn[2]*lv[2];
/* phong threshold to prevent backfacing faces having artefacts on ray shadow (terminator problem) */
- if((ma->mode & MA_RAYBIAS) && (lar->mode & LA_SHAD_RAY) && (vlr->flag & R_SMOOTH)) {
- float thresh= vlr->ob->smoothresh;
- if(inp>thresh)
- phongcorr= (inp-thresh)/(inp*(1.0-thresh));
- else
- phongcorr= 0.0;
- }
- else if(ma->sbias!=0.0f) {
- if(inp>ma->sbias)
- phongcorr= (inp-ma->sbias)/(inp*(1.0-ma->sbias));
- else
- phongcorr= 0.0;
+ /* this complex construction screams for a nicer implementation! (ton) */
+ if(R.r.mode & R_SHADOW) {
+ if(ma->mode & MA_SHADOW) {
+ if(lar->type==LA_HEMI);
+ else if((ma->mode & MA_RAYBIAS) && (lar->mode & LA_SHAD_RAY) && (vlr->flag & R_SMOOTH)) {
+ float thresh= vlr->ob->smoothresh;
+ if(inp>thresh)
+ phongcorr= (inp-thresh)/(inp*(1.0-thresh));
+ else
+ phongcorr= 0.0;
+ }
+ else if(ma->sbias!=0.0f && ((lar->mode & LA_SHAD_RAY) || lar->shb)) {
+ if(inp>ma->sbias)
+ phongcorr= (inp-ma->sbias)/(inp*(1.0-ma->sbias));
+ else
+ phongcorr= 0.0;
+ }
+ }
}
- else phongcorr= 1.0;
/* diffuse shaders */
if(lar->mode & LA_NO_DIFF) {