diff options
author | Ton Roosendaal <ton@blender.org> | 2003-12-30 00:32:03 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2003-12-30 00:32:03 +0300 |
commit | cf9ce09074aea870f7169a162ff7ba848add6faf (patch) | |
tree | d8996a84998ca4396cea03c42d5211ee02251101 /source/blender/render | |
parent | b269f6f46685d0d2125270d9b69535e97957804c (diff) |
- forgot to clip negative values coming from arealight formula.
- excluded 'dist' factor calculus from arealamps, which caused too much
distance sensitivity
Diffstat (limited to 'source/blender/render')
-rw-r--r-- | source/blender/render/intern/source/rendercore.c | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c index 17263e27da7..8f4839f13cb 100644 --- a/source/blender/render/intern/source/rendercore.c +++ b/source/blender/render/intern/source/rendercore.c @@ -1278,6 +1278,7 @@ static float area_lamp_energy(float *co, float *vn, LampRen *lar) fac+= tvec[0]*cross[2][0]+ tvec[1]*cross[2][1]+ tvec[2]*cross[2][2]; fac+= tvec[0]*cross[3][0]+ tvec[1]*cross[3][1]+ tvec[2]*cross[3][2]; + if(fac<=0.0) return 0.0; return pow(fac*lar->areasize, lar->k); // corrected for buttons size and lar->dist^2 } @@ -1735,28 +1736,31 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr, int mask) lv[2]/= ld; /* ld is re-used further on (texco's) */ - - if(lar->mode & LA_QUAD) { - t= 1.0; - if(lar->ld1>0.0) - t= lar->dist/(lar->dist+lar->ld1*ld); - if(lar->ld2>0.0) - t*= lar->distkw/(lar->distkw+lar->ld2*ld*ld); - - lampdist= t; + if(lar->type==LA_AREA) { + lampdist= 1.0; } else { - lampdist= (lar->dist/(lar->dist+ld)); - } - - if(lar->mode & LA_SPHERE) { - t= lar->dist - ld; - if(t<0.0) continue; - - t/= lar->dist; - lampdist*= (t); + if(lar->mode & LA_QUAD) { + t= 1.0; + if(lar->ld1>0.0) + t= lar->dist/(lar->dist+lar->ld1*ld); + if(lar->ld2>0.0) + t*= lar->distkw/(lar->distkw+lar->ld2*ld*ld); + + lampdist= t; + } + else { + lampdist= (lar->dist/(lar->dist+ld)); + } + + if(lar->mode & LA_SPHERE) { + t= lar->dist - ld; + if(t<0.0) continue; + + t/= lar->dist; + lampdist*= (t); + } } - } if(lar->mode & LA_TEXTURE) do_lamp_tex(lar, lv, shi); |