forked from bartvdbraak/blender
Bug fix #2719
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:
parent
ae77736c30
commit
5e0aa9b1ec
@ -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 fx= 2.0/(R.rectx*R.winmat[0][0]);
|
||||||
float fy= 2.0/(R.recty*R.winmat[1][1]);
|
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[0]= (0.5 + 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[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 */
|
/* 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];
|
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;
|
stack[ptr].data= vlr;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
i= centmask[ zrow[totvlak][RE_MASK] ]; /* recenter sample position - */
|
if(R.osa) {
|
||||||
xs= (float)x+centLut[i & 15];
|
i= centmask[ zrow[totvlak][RE_MASK] ]; /* recenter sample position - */
|
||||||
ys= (float)y+centLut[i >> 4];
|
xs= (float)x+centLut[i & 15];
|
||||||
|
ys= (float)y+centLut[i >> 4];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
xs= (float)x;
|
||||||
|
ys= (float)y;
|
||||||
|
}
|
||||||
|
|
||||||
/* stack face ----------- */
|
/* stack face ----------- */
|
||||||
stack[ptr].mask = zrow[totvlak][RE_MASK];
|
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 fx= 2.0/(R.rectx*R.winmat[0][0]);
|
||||||
float fy= 2.0/(R.recty*R.winmat[1][1]);
|
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];
|
fx= (0.5 + 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];
|
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 */
|
/* 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];
|
zco= (dface - vlr->n[0]*fx - vlr->n[1]*fy)/vlr->n[2];
|
||||||
|
Loading…
Reference in New Issue
Block a user