From 5e0aa9b1eced8cb37f735ed9efd5d1be607267b8 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Wed, 8 Jun 2005 12:51:03 +0000 Subject: 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. --- source/blender/render/intern/source/rendercore.c | 4 ++-- source/blender/render/intern/source/vanillaRenderPipe.c | 16 +++++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) (limited to 'source') diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c index ee902cb9710..6f57a05e030 100644 --- a/source/blender/render/intern/source/rendercore.c +++ b/source/blender/render/intern/source/rendercore.c @@ -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]; diff --git a/source/blender/render/intern/source/vanillaRenderPipe.c b/source/blender/render/intern/source/vanillaRenderPipe.c index 6a2ccd5c566..053b5886bff 100644 --- a/source/blender/render/intern/source/vanillaRenderPipe.c +++ b/source/blender/render/intern/source/vanillaRenderPipe.c @@ -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]; -- cgit v1.2.3