From 703f248ab4bd918ba6a202a20b73dc6293851759 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Mon, 28 Jan 2008 16:33:59 +0000 Subject: New rendering option: FSA! This completes the pipeline make-over, as started in 2006. With this option, during rendering, each sample for every layer and pass is being saved on disk (looks like non-antialiased images). Then the composite and color correction happens, then a clip to 0-1 range, and only in end all samples get combined - using sampling filters such as gauss/mitch/catmul. This results in artefact-free antialiased images. Even Z-combine or ID masks now work perfect for it! This is an unfinished commit btw; Brecht will finish this for strands. Also Halo doesnt work yet. To activate FSA: press "Save Buffers" and the new button next to it. :) --- .../blender/nodes/intern/CMP_nodes/CMP_defocus.c | 6 ++++-- source/blender/nodes/intern/CMP_nodes/CMP_idMask.c | 22 +++++++++++++++++++++- .../blender/nodes/intern/CMP_nodes/CMP_zcombine.c | 22 ++++++++++++++++++++++ 3 files changed, 47 insertions(+), 3 deletions(-) (limited to 'source/blender/nodes') diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c b/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c index 53d01ab1d12..a7db8c2d53d 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c @@ -376,8 +376,10 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, // some sort of visual feedback would be nice, or at least this text in the renderwin header // but for now just print some info in the console every 8 scanlines. if (((y & 7)==0) || (y==(img->y-1))) { - printf("\rdefocus: Processing Line %d of %d ... ", y+1, img->y); - fflush(stdout); + if(G.background==0) { + printf("\rdefocus: Processing Line %d of %d ... ", y+1, img->y); + fflush(stdout); + } } // esc set by main calling process if(node->exec & NODE_BREAK) diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_idMask.c b/source/blender/nodes/intern/CMP_nodes/CMP_idMask.c index abb9fa98d97..a40579ac3b2 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_idMask.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_idMask.c @@ -63,8 +63,25 @@ static void do_idmask(CompBuf *stackbuf, CompBuf *cbuf, float idnr) MEM_freeN(abuf); } +/* full sample version */ +static void do_idmask_fsa(CompBuf *stackbuf, CompBuf *cbuf, float idnr) +{ + float *rect, *rs; + int x; + + rect= cbuf->rect; + rs= stackbuf->rect; + for(x= cbuf->x*cbuf->y - 1; x>=0; x--) + if(rect[x]==idnr) + rs[x]= 1.0f; + +} + + static void node_composit_exec_idmask(void *data, bNode *node, bNodeStack **in, bNodeStack **out) { + RenderData *rd= data; + if(out[0]->hasoutput==0) return; @@ -77,7 +94,10 @@ static void node_composit_exec_idmask(void *data, bNode *node, bNodeStack **in, stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_VAL, 1); /* allocs */; - do_idmask(stackbuf, cbuf, (float)node->custom1); + if(rd->scemode & R_FULL_SAMPLE) + do_idmask_fsa(stackbuf, cbuf, (float)node->custom1); + else + do_idmask(stackbuf, cbuf, (float)node->custom1); out[0]->data= stackbuf; } diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c b/source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c index 29cf8f34d54..eb939100644 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_zcombine.c @@ -45,6 +45,16 @@ static bNodeSocketType cmp_node_zcombine_out[]= { { -1, 0, "" } }; +static void do_zcombine(bNode *node, float *out, float *src1, float *z1, float *src2, float *z2) +{ + if(*z1 <= *z2) { + QUATCOPY(out, src1); + } + else { + QUATCOPY(out, src2); + } +} + static void do_zcombine_mask(bNode *node, float *out, float *z1, float *z2) { if(*z1 > *z2) { @@ -67,6 +77,8 @@ static void do_zcombine_add(bNode *node, float *out, float *col1, float *col2, f static void node_composit_exec_zcombine(void *data, bNode *node, bNodeStack **in, bNodeStack **out) { + RenderData *rd= data; + /* stack order in: col z col z */ /* stack order out: col z */ if(out[0]->hasoutput==0) @@ -76,6 +88,16 @@ static void node_composit_exec_zcombine(void *data, bNode *node, bNodeStack **in if(in[0]->data==NULL) { return; } + else if(rd->scemode & R_FULL_SAMPLE) { + /* make output size of first input image */ + CompBuf *cbuf= in[0]->data; + CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 1); // allocs + + composit4_pixel_processor(node, stackbuf, in[0]->data, in[0]->vec, in[1]->data, in[1]->vec, in[2]->data, in[2]->vec, + in[3]->data, in[3]->vec, do_zcombine, CB_RGBA, CB_VAL, CB_RGBA, CB_VAL); + + out[0]->data= stackbuf; + } else { /* make output size of first input image */ CompBuf *cbuf= in[0]->data; -- cgit v1.2.3