- Bugfix for ztransp not being filled into the z-pass after FSA changes.

- Bugfix for speedvectors being not properly set for some strands.
This commit is contained in:
Brecht Van Lommel 2008-01-30 13:35:28 +00:00
parent bace7e5788
commit 33656dfa83
6 changed files with 25 additions and 5 deletions

@ -47,7 +47,7 @@ typedef struct ShadeResult
{
float combined[4];
float col[4];
float alpha, mist;
float alpha, mist, z;
float diff[3]; /* no ramps, shadow, etc */
float spec[3];
float shad[3];

@ -4746,7 +4746,7 @@ static void calculate_speedvectors(Render *re, ObjectInstanceRen *obi, float *ve
else strand++;
index= RE_strandren_get_face(obr, strand, 0);
if(index && *index) {
if(index) {
speed= RE_strandren_get_winspeed(obi, strand, 1);
/* interpolate speed vectors from strand surface */

@ -359,7 +359,7 @@ static void add_filt_passes(RenderLayer *rl, int curmask, int rectx, int offset,
switch(rpass->passtype) {
case SCE_PASS_Z:
fp= rpass->rect + offset;
*fp= -shi->co[2];
*fp= shr->z;
break;
case SCE_PASS_RGBA:
col= shr->col;
@ -451,7 +451,7 @@ static void add_passes(RenderLayer *rl, int offset, ShadeInput *shi, ShadeResult
switch(rpass->passtype) {
case SCE_PASS_Z:
fp= rpass->rect + offset;
*fp= -shi->co[2];
*fp= shr->z;
break;
case SCE_PASS_RGBA:
col= shr->col;

@ -186,6 +186,8 @@ void shade_input_do_shade(ShadeInput *shi, ShadeResult *shr)
}
else shr->combined[3]= 1.0f;
/* add z */
shr->z= -shi->co[2];
}
/* **************************************************************************** */

@ -214,6 +214,8 @@ void interpolate_shade_result(ShadeResult *shr1, ShadeResult *shr2, float t, Sha
}
/* optim... */
if(addpassflag & ~(SCE_PASS_VECTOR)) {
if(addpassflag & SCE_PASS_Z)
interpolate_vec1(&shr1->z, &shr2->z, t, negt, &shr->z);
if(addpassflag & SCE_PASS_RGBA)
interpolate_vec4(shr1->col, shr2->col, t, negt, shr->col);
if(addpassflag & SCE_PASS_NORMAL) {
@ -411,6 +413,7 @@ typedef struct StrandPart {
ZSpan *zspan;
APixstrand *apixbuf;
int *totapixbuf;
int *rectz;
long *rectdaps;
int rectx, recty;
@ -483,6 +486,8 @@ static APixstrand *addpsAstrand(ZSpan *zspan)
return zspan->curpstrand;
}
#define MAX_ZROW 2000
static void do_strand_fillac(void *handle, int x, int y, float u, float v, float z)
{
StrandPart *spart= (StrandPart*)handle;
@ -528,7 +533,7 @@ static void do_strand_fillac(void *handle, int x, int y, float u, float v, float
{apn->obi[n]= obi; apn->p[n]= strnr; apn->z[n]= zverg; apn->mask[n]= mask; apn->v[n]= t; apn->u[n]= s; apn->seg[n]= seg; break; }
/* add to pixel list */
if(zverg < bufferz) {
if(zverg < bufferz && (spart->totapixbuf[offset] < MAX_ZROW)) {
t = u*spart->t[0] + v*spart->t[1] + (1.0f-u-v)*spart->t[2];
s = fabs(u*spart->s[0] + v*spart->s[1] + (1.0f-u-v)*spart->s[2]);
@ -551,6 +556,7 @@ static void do_strand_fillac(void *handle, int x, int y, float u, float v, float
strand_shade_refcount(cache, sseg->v[1]);
strand_shade_refcount(cache, sseg->v[2]);
spart->totapixbuf[offset]++;
}
}
@ -875,6 +881,8 @@ int zbuffer_strands_abuf(Render *re, RenderPart *pa, RenderLayer *rl, APixstrand
BLI_memarena_free(memarena);
spart.totapixbuf= MEM_callocN(sizeof(int)*pa->rectx*pa->recty, "totapixbuf");
if(!re->test_break()) {
/* render segments in sorted order */
sortseg= sortsegments;
@ -907,6 +915,7 @@ int zbuffer_strands_abuf(Render *re, RenderPart *pa, RenderLayer *rl, APixstrand
if(sortsegments)
MEM_freeN(sortsegments);
MEM_freeN(spart.totapixbuf);
zbuf_free_span(&zspan);

@ -3575,6 +3575,11 @@ void add_transp_passes(RenderLayer *rl, int offset, ShadeResult *shr, float alph
int pixsize= 3;
switch(rpass->passtype) {
case SCE_PASS_Z:
fp= rpass->rect + offset;
if(shr->z < *fp)
*fp= shr->z;
break;
case SCE_PASS_RGBA:
fp= rpass->rect + 4*offset;
addAlphaOverFloat(fp, shr->col);
@ -3801,6 +3806,8 @@ static int addtosamp_shr(ShadeResult *samp_shr, ShadeSample *ssamp, int addpassf
addAlphaUnderFloat(samp_shr->combined, shr->combined);
samp_shr->z= MIN2(samp_shr->z, shr->z);
if(addpassflag & SCE_PASS_VECTOR) {
QUATCOPY(samp_shr->winspeed, shr->winspeed);
}
@ -4071,6 +4078,8 @@ unsigned short *zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pas
/* for each mask-sample we alpha-under colors. then in end it's added using filter */
memset(samp_shr, 0, sizeof(ShadeResult)*R.osa);
for(a=0; a<R.osa; a++)
samp_shr[a].z= 10e10f;
/* nice this memset, but speed vectors are not initialized OK then. it is sufficient to only clear 1 (see merge_transp_passes) */
if(addpassflag & SCE_PASS_VECTOR)