diff options
author | Ton Roosendaal <ton@blender.org> | 2006-01-30 02:01:33 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2006-01-30 02:01:33 +0300 |
commit | 6dd3fd2a2656f77e1e2e1f40729def9d749ccd83 (patch) | |
tree | b4ce9bf1d0c4b6fa304f3f19a4cd783e1019026c /source | |
parent | 130c1dcb31e9e435b208a97cd6fc09500981dd34 (diff) |
Two issues solved in render recode;
- the sub-pixel masks for applying correct filters (gauss and friends)
accidentally were y-flipped, causing bad looking results.
- zbuffer was clipping extremely narrow, causing border pixels to miss
samples, and reveiling alpha that way (was in old render a prob too)
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/render/intern/source/initrender.c | 16 | ||||
-rw-r--r-- | source/blender/render/intern/source/pixelblending.c | 4 | ||||
-rw-r--r-- | source/blender/render/intern/source/zbuf.c | 33 |
3 files changed, 26 insertions, 27 deletions
diff --git a/source/blender/render/intern/source/initrender.c b/source/blender/render/intern/source/initrender.c index 786f720fddc..9a36cf99e27 100644 --- a/source/blender/render/intern/source/initrender.c +++ b/source/blender/render/intern/source/initrender.c @@ -486,16 +486,12 @@ void RE_SetCamera(Render *re, Object *camera) pixsize= clipsta/re->viewfac; } - /* revision / simplification of subpixel offsets: - - the matrix will go without offset from start (e.g. -100) to end (e.g. +99). - - filling in with zbuffer will set offset of 0.5. to make sure clipped faces fill in too - - in shadepixel() again that 0.5 offset is corrected - */ - viewplane.xmin= -0.5f*(float)re->winx; - viewplane.ymin= -0.5f*re->ycor*(float)re->winy; - viewplane.xmax= 0.5f*(float)re->winx; - viewplane.ymax= 0.5f*re->ycor*(float)re->winy; - + /* viewplane fully centered, zbuffer fills in jittered between -.5 and +.5 */ + viewplane.xmin= -0.5f*(float)re->winx; + viewplane.ymin= -0.5f*re->ycor*(float)re->winy; + viewplane.xmax= 0.5f*(float)re->winx; + viewplane.ymax= 0.5f*re->ycor*(float)re->winy; + if(re->flag & R_SEC_FIELD) { if(re->r.mode & R_ODDFIELD) { viewplane.ymin-= .5*re->ycor; diff --git a/source/blender/render/intern/source/pixelblending.c b/source/blender/render/intern/source/pixelblending.c index 73a8e86bc95..860aeed29d7 100644 --- a/source/blender/render/intern/source/pixelblending.c +++ b/source/blender/render/intern/source/pixelblending.c @@ -187,8 +187,8 @@ void add_filt_fmask(unsigned int mask, float *col, float *rowbuf, int row_w) al= col[3]; rb2= rowbuf-4; - rb1= rb2-4*row_w; - rb3= rb2+4*row_w; + rb3= rb2-4*row_w; + rb1= rb2+4*row_w; maskand= (mask & 255); maskshift= (mask >>8); diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c index 529fb5bd535..c4137a0e832 100644 --- a/source/blender/render/intern/source/zbuf.c +++ b/source/blender/render/intern/source/zbuf.c @@ -1290,14 +1290,18 @@ static void zbufinvulGL_onlyZ(ZSpan *zspan, int zvlnr, float *v1, float *v2, flo static void clippyra(float *labda, float *v1, float *v2, int *b2, int *b3, int a) { - float da,db,u1=0.0,u2=1.0; - + float da,dw,u1=0.0,u2=1.0; + float v13; + labda[0]= -1.0; labda[1]= -1.0; da= v2[a]-v1[a]; - db= v2[3]-v1[3]; - + /* prob; we clip slightly larger, osa renders add 2 pixels on edges, should become variable? */ + /* or better; increase r.winx/y size, but thats quite a complex one. do it later */ + dw= 1.005f*(v2[3]-v1[3]); + v13= 1.005f*v1[3]; + /* according the original article by Liang&Barsky, for clipping of * homogenous coordinates with viewplane, the value of "0" is used instead of "-w" . * This differs from the other clipping cases (like left or top) and I considered @@ -1305,8 +1309,8 @@ static void clippyra(float *labda, float *v1, float *v2, int *b2, int *b3, int a * who would have thought that of L&B! */ - if(cliptestf(-da-db, v1[3]+v1[a], &u1,&u2)) { - if(cliptestf(da-db, v1[3]-v1[a], &u1,&u2)) { + if(cliptestf(-da-dw, v13+v1[a], &u1,&u2)) { + if(cliptestf(da-dw, v13-v1[a], &u1,&u2)) { *b3=1; if(u2<1.0) { labda[1]= u2; @@ -1611,8 +1615,8 @@ void zbuffer_solid(RenderPart *pa, unsigned int lay, short layflag) zspan.zofsy= -pa->disprect.ymin - R.jit[pa->sample][1]; } else { - zspan.zofsx= -pa->disprect.xmin -0.5f; - zspan.zofsy= -pa->disprect.ymin -0.5f; + zspan.zofsx= -pa->disprect.xmin; + zspan.zofsy= -pa->disprect.ymin; } /* the buffers */ @@ -1815,8 +1819,8 @@ void zbuffer_shadow(Render *re, LampRen *lar, int *rectz, int size) zbuf_alloc_span(&zspan, size, size); zspan.zmulx= ((float)size)/2.0; zspan.zmuly= ((float)size)/2.0; - zspan.zofsx= -0.5f; - zspan.zofsy= -0.5f; + zspan.zofsx= 0.0f; + zspan.zofsy= 0.0f; /* the buffers */ zspan.rectz= rectz; @@ -1871,7 +1875,6 @@ static void copyto_abufz(RenderPart *pa, int *arectz, int sample) memcpy(arectz, pa->rectz, 4*pa->rectx*pa->recty); return; } - //if( (R.r.mode & R_OSA)==0 || sample==0) return; rza= arectz; rd= pa->rectdaps; @@ -1920,8 +1923,8 @@ static void zbuffer_abuf(RenderPart *pa, APixstr *APixbuf, ListBase *apsmbase, u /* needed for transform from hoco to zbuffer co */ zspan.zmulx= ((float)R.winx)/2.0; zspan.zmuly= ((float)R.winy)/2.0; - zspan.zofsx= -pa->disprect.xmin -0.5f; - zspan.zofsy= -pa->disprect.ymin -0.5f; + zspan.zofsx= -pa->disprect.xmin; + zspan.zofsy= -pa->disprect.ymin; /* the buffers */ zspan.arectz= RE_mallocN(sizeof(int)*pa->rectx*pa->recty, "Arectz"); @@ -1941,8 +1944,8 @@ static void zbuffer_abuf(RenderPart *pa, APixstr *APixbuf, ListBase *apsmbase, u zspan.mask= 1<<zsample; if(R.r.mode & R_OSA) { - zspan.zofsx= -pa->disprect.xmin-R.jit[zsample][0]-0.5; - zspan.zofsy= -pa->disprect.ymin-R.jit[zsample][1]-0.5; + zspan.zofsx= -pa->disprect.xmin-R.jit[zsample][0]; + zspan.zofsy= -pa->disprect.ymin-R.jit[zsample][1]; } for(v=0; v<R.totvlak; v++) { |