diff options
author | Ton Roosendaal <ton@blender.org> | 2013-04-18 20:26:58 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2013-04-18 20:26:58 +0400 |
commit | 4ad289a22de9d20d264bf6e62a2434401ff2e065 (patch) | |
tree | bfa4a7d78daed52f55cf91549a8316b85c7dd830 /source/blender | |
parent | 01ffbab8f54425bc3211859fe03aa9739cfbafdc (diff) |
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 :)
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/render/intern/source/shadbuf.c | 3 | ||||
-rw-r--r-- | source/blender/render/intern/source/shadeoutput.c | 10 |
2 files changed, 7 insertions, 6 deletions
diff --git a/source/blender/render/intern/source/shadbuf.c b/source/blender/render/intern/source/shadbuf.c index 1a24055c7f4..7d463316a98 100644 --- a/source/blender/render/intern/source/shadbuf.c +++ b/source/blender/render/intern/source/shadbuf.c @@ -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); diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index 7505b0fa567..6b48bb79e4d 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -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 */ |