Bugfix #34895
Error in shadowbuffer with halo effect. It had render error when you look straight into the lamp, with something in front of lamp. The code that was sampling the shadowbuffer exited too soon (for ray going perpendicular to buffer it should take at least 1 sample). Code from 90ies. And still got a bug fix. Whoa :)
This commit is contained in:
@@ -1394,7 +1394,6 @@ float shadow_halo(LampRen *lar, const float p1[3], const float p2[3])
|
||||
}
|
||||
|
||||
lambda = min_ff(lambda_x, lambda_y);
|
||||
if (lambda==lambda_o || lambda>=1.0f) break;
|
||||
|
||||
zf= zf1 + lambda*(zf2-zf1);
|
||||
count+= (float)shb->totbuf;
|
||||
@@ -1410,6 +1409,8 @@ float shadow_halo(LampRen *lar, const float p1[3], const float p2[3])
|
||||
lightcount+= readshadowbuf_halo(shb, shsample, x, y, z);
|
||||
|
||||
}
|
||||
/* break after sample, so it takes at least one */
|
||||
if (lambda==lambda_o || lambda>=1.0f) break;
|
||||
}
|
||||
|
||||
if (count!=0.0f) return (lightcount/count);
|
||||
|
||||
@@ -181,7 +181,7 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens)
|
||||
double a, b, c, disc, nray[3], npos[3];
|
||||
double t0, t1 = 0.0f, t2= 0.0f, t3;
|
||||
float p1[3], p2[3], ladist, maxz = 0.0f, maxy = 0.0f, haint;
|
||||
int snijp, do_clip = TRUE, use_yco = FALSE;
|
||||
int cuts, do_clip = TRUE, use_yco = FALSE;
|
||||
|
||||
*intens= 0.0f;
|
||||
haint= lar->haint;
|
||||
@@ -244,7 +244,7 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens)
|
||||
b = nray[0] * npos[0] + nray[1] * npos[1] - nray[2]*npos[2];
|
||||
c = npos[0] * npos[0] + npos[1] * npos[1] - npos[2]*npos[2];
|
||||
|
||||
snijp= 0;
|
||||
cuts= 0;
|
||||
if (fabs(a) < DBL_EPSILON) {
|
||||
/*
|
||||
* Only one intersection point...
|
||||
@@ -256,16 +256,16 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens)
|
||||
|
||||
if (disc==0.0) {
|
||||
t1=t2= (-b)/ a;
|
||||
snijp= 2;
|
||||
cuts= 2;
|
||||
}
|
||||
else if (disc > 0.0) {
|
||||
disc = sqrt(disc);
|
||||
t1 = (-b + disc) / a;
|
||||
t2 = (-b - disc) / a;
|
||||
snijp= 2;
|
||||
cuts= 2;
|
||||
}
|
||||
}
|
||||
if (snijp==2) {
|
||||
if (cuts==2) {
|
||||
int ok1=0, ok2=0;
|
||||
|
||||
/* sort */
|
||||
|
||||
Reference in New Issue
Block a user