Fix #31754: strand width fade value 2.0 gives wrong result, should fade out
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 13 Jun 2012 15:33:59 +0000 (15:33 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 13 Jun 2012 15:33:59 +0000 (15:33 +0000)
strand entirely. Fix based on patch by Philipp Oeser.

source/blender/render/intern/source/convertblender.c
source/blender/render/intern/source/strand.c

index a48a6b75049654f662c42277789b702695f7d305..4eebc9678231f9688774346e4fa564cf0c02c6c2 100644 (file)
@@ -1729,7 +1729,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
                        strandbuf->minwidth= ma->strand_min;
 
                        if (ma->strand_widthfade == 0.0f)
-                               strandbuf->widthfade= 0.0f;
+                               strandbuf->widthfade= -1.0f;
                        else if (ma->strand_widthfade >= 1.0f)
                                strandbuf->widthfade= 2.0f - ma->strand_widthfade;
                        else
index 7e0744096b370b508af1d2d914e96d04bb74d492..0e7c8a13043a657dcff16d306ead4808ef770440 100644 (file)
@@ -400,7 +400,7 @@ void strand_shade_segment(Render *re, StrandShadeCache *cache, StrandSegment *ss
        interpolate_shade_result(&shr1, &shr2, t, ssamp->shr, addpassflag);
 
        /* apply alpha along width */
-       if (sseg->buffer->widthfade != 0.0f) {
+       if (sseg->buffer->widthfade != -1.0f) {
                s = 1.0f - powf(fabsf(s), sseg->buffer->widthfade);
 
                strand_apply_shaderesult_alpha(ssamp->shr, s);