Ortho render didn't correct texture/shadow coordinates for subpixel
position. Caused small errors where faces intersect each other.

Also found texture subpixel error in unified (using jitter table not
correctly). This also caused errors with z value comparing.
This commit is contained in:
Ton Roosendaal 2005-06-08 12:51:03 +00:00
parent ae77736c30
commit 5e0aa9b1ec
2 changed files with 13 additions and 7 deletions

@ -2125,8 +2125,8 @@ void *shadepixel(float x, float y, int z, int facenr, int mask, float *col)
float fx= 2.0/(R.rectx*R.winmat[0][0]);
float fy= 2.0/(R.recty*R.winmat[1][1]);
shi.co[0]= (x - 0.5*R.rectx)*fx - R.winmat[3][0]/R.winmat[0][0];
shi.co[1]= (y - 0.5*R.recty)*fy - R.winmat[3][1]/R.winmat[1][1];
shi.co[0]= (0.5 + x - 0.5*R.rectx)*fx - R.winmat[3][0]/R.winmat[0][0];
shi.co[1]= (0.5 + y - 0.5*R.recty)*fy - R.winmat[3][1]/R.winmat[1][1];
/* using a*x + b*y + c*z = d equation, (a b c) is normal */
shi.co[2]= (dface - shi.facenor[0]*shi.co[0] - shi.facenor[1]*shi.co[1])/shi.facenor[2];

@ -641,9 +641,15 @@ static int composeStack(int zrow[][RE_PIXELFIELDSIZE], RE_COLBUFTYPE *collector,
stack[ptr].data= vlr;
}
else {
i= centmask[ zrow[totvlak][RE_MASK] ]; /* recenter sample position - */
xs= (float)x+centLut[i & 15];
ys= (float)y+centLut[i >> 4];
if(R.osa) {
i= centmask[ zrow[totvlak][RE_MASK] ]; /* recenter sample position - */
xs= (float)x+centLut[i & 15];
ys= (float)y+centLut[i >> 4];
}
else {
xs= (float)x;
ys= (float)y;
}
/* stack face ----------- */
stack[ptr].mask = zrow[totvlak][RE_MASK];
@ -771,8 +777,8 @@ static int calcDepth(float x, float y, void *data, int type)
float fx= 2.0/(R.rectx*R.winmat[0][0]);
float fy= 2.0/(R.recty*R.winmat[1][1]);
fx= (x - 0.5*R.rectx)*fx - R.winmat[3][0]/R.winmat[0][0];
fy= (y - 0.5*R.recty)*fy - R.winmat[3][1]/R.winmat[1][1];
fx= (0.5 + x - 0.5*R.rectx)*fx - R.winmat[3][0]/R.winmat[0][0];
fy= (0.5 + y - 0.5*R.recty)*fy - R.winmat[3][1]/R.winmat[1][1];
/* using a*x + b*y + c*z = d equation, (a b c) is normal */
zco= (dface - vlr->n[0]*fx - vlr->n[1]*fy)/vlr->n[2];