- fix for specularity calculus. Because of new area lamps and new ray-shadow
some tests where moved around, causing specularity being calculared when light actually shines behind a face. Thanks inttr for the (horrible!) test scene that showed it. :)
This commit is contained in:
parent
220e2f0c25
commit
acdcc29990
@ -991,10 +991,14 @@ static int d3dda(Isect *is)
|
||||
|
||||
|
||||
/* only for shadow! */
|
||||
if(is->mode==DDA_SHADOW && g_oc.vlr_last!=NULL && g_oc.vlr_last!=is->vlrorig) {
|
||||
is->vlr= g_oc.vlr_last;
|
||||
VECSUB(is->vec, is->end, is->start);
|
||||
if(intersection(is)) return 1;
|
||||
if(is->mode==DDA_SHADOW) {
|
||||
|
||||
/* check with last intersected shadow face */
|
||||
if(g_oc.vlr_last!=NULL && g_oc.vlr_last!=is->vlrorig) {
|
||||
is->vlr= g_oc.vlr_last;
|
||||
VECSUB(is->vec, is->end, is->start);
|
||||
if(intersection(is)) return 1;
|
||||
}
|
||||
}
|
||||
|
||||
ldx= is->end[0] - is->start[0];
|
||||
@ -1781,6 +1785,8 @@ static void ray_trace_shadow_tra(Isect *is, int depth)
|
||||
}
|
||||
}
|
||||
|
||||
/* not used, test function for ambient occlusion (yaf: pathlight) */
|
||||
/* main problem; has to be called within shading loop, giving unwanted recursion */
|
||||
int ray_trace_shadow_rad(ShadeInput *ship, ShadeResult *shr)
|
||||
{
|
||||
static int counter=0, only_one= 0;
|
||||
|
@ -1887,36 +1887,33 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr, int mask)
|
||||
i*= lampdist*ma->ref;
|
||||
}
|
||||
|
||||
/* shadow and spec */
|
||||
if(lampdist> 0.0) {
|
||||
/* shadow and spec, only when inp>0 */
|
||||
if(lampdist> 0.0 && inp>0.0) {
|
||||
|
||||
if(i>0.0 && (R.r.mode & R_SHADOW)) {
|
||||
if(ma->mode & MA_SHADOW) {
|
||||
/* single sided */
|
||||
if( shi->vlr->n[0]*lv[0] + shi->vlr->n[1]*lv[1] + shi->vlr->n[2]*lv[2] > -0.01) {
|
||||
|
||||
if(lar->shb) {
|
||||
shadfac[3] = testshadowbuf(lar->shb, shi->co, inp);
|
||||
}
|
||||
else if(lar->mode & LA_SHAD_RAY) {
|
||||
ray_shadow(shi, lar, shadfac, mask);
|
||||
}
|
||||
|
||||
/* warning, here it skips the loop */
|
||||
if(lar->mode & LA_ONLYSHADOW) {
|
||||
|
||||
shadfac[3]= i*lar->energy*(1.0-shadfac[3]);
|
||||
shr->diff[0] -= shadfac[3];
|
||||
shr->diff[1] -= shadfac[3];
|
||||
shr->diff[2] -= shadfac[3];
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if(shadfac[3]==0.0) continue;
|
||||
|
||||
i*= shadfac[3];
|
||||
if(lar->shb) {
|
||||
shadfac[3] = testshadowbuf(lar->shb, shi->co, inp);
|
||||
}
|
||||
else if(lar->mode & LA_SHAD_RAY) {
|
||||
ray_shadow(shi, lar, shadfac, mask);
|
||||
}
|
||||
|
||||
/* warning, here it skips the loop */
|
||||
if(lar->mode & LA_ONLYSHADOW) {
|
||||
|
||||
shadfac[3]= i*lar->energy*(1.0-shadfac[3]);
|
||||
shr->diff[0] -= shadfac[3];
|
||||
shr->diff[1] -= shadfac[3];
|
||||
shr->diff[2] -= shadfac[3];
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if(shadfac[3]==0.0) continue;
|
||||
|
||||
i*= shadfac[3];
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user