Composite & Pass render goodies:
- New Passes: UV and Rad(iosity) - New Nodes: UV Map and Index Mask - Z-combine now is antialiased As usual, please check the log. Has nice pics! http://www.blender3d.org/cms/Composite__UV_Map__ID.830.0.html For devs: the antialias code from Vector Blur is now exported in compo too. Works pretty good. Even fixed a bug in antialias, so vectorblur will be better. Also: found out that OpenGL display list speedup accidentally was still triggered with the rt button... so it did not work by default.
This commit is contained in:
parent
b003221c7a
commit
089e87ccea
|
@ -241,9 +241,10 @@ void set_node_shader_lamp_loop(void (*lamp_loop_func)(struct ShadeInput *, str
|
|||
#define CMP_NODE_CHROMA 237
|
||||
#define CMP_NODE_LUMA 238
|
||||
#define CMP_NODE_FLIP 239
|
||||
|
||||
|
||||
#define CMP_NODE_SPLITVIEWER 240
|
||||
#define CMP_NODE_INDEX_MASK 241
|
||||
#define CMP_NODE_MAP_UV 242
|
||||
#define CMP_NODE_ID_MASK 243
|
||||
|
||||
/* filter types */
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
|
||||
#include "RE_pipeline.h"
|
||||
#include "RE_shader_ext.h" /* <- TexResult */
|
||||
#include "RE_render_ext.h" /* <- ibuf_sample() */
|
||||
|
||||
#ifndef atanf
|
||||
#define atanf(a) atan((double)(a))
|
||||
|
@ -260,42 +261,87 @@ static CompBuf *typecheck_compbuf(CompBuf *inbuf, int type)
|
|||
outbuf->xof= inbuf->xof;
|
||||
outbuf->yof= inbuf->yof;
|
||||
|
||||
if(type==CB_VAL && inbuf->type==CB_VEC3) {
|
||||
for(; x>0; x--, outrf+= 1, inrf+= 3)
|
||||
*outrf= 0.333333f*(inrf[0]+inrf[1]+inrf[2]);
|
||||
}
|
||||
else if(type==CB_VAL && inbuf->type==CB_RGBA) {
|
||||
for(; x>0; x--, outrf+= 1, inrf+= 4)
|
||||
*outrf= inrf[0]*0.35f + inrf[1]*0.45f + inrf[2]*0.2f;
|
||||
}
|
||||
else if(type==CB_VEC3 && inbuf->type==CB_VAL) {
|
||||
for(; x>0; x--, outrf+= 3, inrf+= 1) {
|
||||
outrf[0]= inrf[0];
|
||||
outrf[1]= inrf[0];
|
||||
outrf[2]= inrf[0];
|
||||
if(type==CB_VAL) {
|
||||
if(inbuf->type==CB_VEC2) {
|
||||
for(; x>0; x--, outrf+= 1, inrf+= 2)
|
||||
*outrf= 0.5f*(inrf[0]+inrf[1]);
|
||||
}
|
||||
else if(inbuf->type==CB_VEC3) {
|
||||
for(; x>0; x--, outrf+= 1, inrf+= 3)
|
||||
*outrf= 0.333333f*(inrf[0]+inrf[1]+inrf[2]);
|
||||
}
|
||||
else if(inbuf->type==CB_RGBA) {
|
||||
for(; x>0; x--, outrf+= 1, inrf+= 4)
|
||||
*outrf= inrf[0]*0.35f + inrf[1]*0.45f + inrf[2]*0.2f;
|
||||
}
|
||||
}
|
||||
else if(type==CB_VEC3 && inbuf->type==CB_RGBA) {
|
||||
for(; x>0; x--, outrf+= 3, inrf+= 4) {
|
||||
outrf[0]= inrf[0];
|
||||
outrf[1]= inrf[1];
|
||||
outrf[2]= inrf[2];
|
||||
else if(type==CB_VEC2) {
|
||||
if(inbuf->type==CB_VAL) {
|
||||
for(; x>0; x--, outrf+= 2, inrf+= 1) {
|
||||
outrf[0]= inrf[0];
|
||||
outrf[1]= inrf[0];
|
||||
}
|
||||
}
|
||||
else if(inbuf->type==CB_VEC3) {
|
||||
for(; x>0; x--, outrf+= 2, inrf+= 3) {
|
||||
outrf[0]= inrf[0];
|
||||
outrf[1]= inrf[1];
|
||||
}
|
||||
}
|
||||
else if(inbuf->type==CB_RGBA) {
|
||||
for(; x>0; x--, outrf+= 2, inrf+= 4) {
|
||||
outrf[0]= inrf[0];
|
||||
outrf[1]= inrf[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(type==CB_RGBA && inbuf->type==CB_VAL) {
|
||||
for(; x>0; x--, outrf+= 4, inrf+= 1) {
|
||||
outrf[0]= inrf[0];
|
||||
outrf[1]= inrf[0];
|
||||
outrf[2]= inrf[0];
|
||||
outrf[3]= inrf[0];
|
||||
else if(type==CB_VEC3) {
|
||||
if(inbuf->type==CB_VAL) {
|
||||
for(; x>0; x--, outrf+= 3, inrf+= 1) {
|
||||
outrf[0]= inrf[0];
|
||||
outrf[1]= inrf[0];
|
||||
outrf[2]= inrf[0];
|
||||
}
|
||||
}
|
||||
else if(inbuf->type==CB_VEC2) {
|
||||
for(; x>0; x--, outrf+= 3, inrf+= 2) {
|
||||
outrf[0]= inrf[0];
|
||||
outrf[1]= inrf[1];
|
||||
outrf[2]= 0.0f;
|
||||
}
|
||||
}
|
||||
else if(inbuf->type==CB_RGBA) {
|
||||
for(; x>0; x--, outrf+= 3, inrf+= 4) {
|
||||
outrf[0]= inrf[0];
|
||||
outrf[1]= inrf[1];
|
||||
outrf[2]= inrf[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(type==CB_RGBA && inbuf->type==CB_VEC3) {
|
||||
for(; x>0; x--, outrf+= 4, inrf+= 3) {
|
||||
outrf[0]= inrf[0];
|
||||
outrf[1]= inrf[1];
|
||||
outrf[2]= inrf[2];
|
||||
outrf[3]= 1.0f;
|
||||
else if(type==CB_RGBA) {
|
||||
if(inbuf->type==CB_VAL) {
|
||||
for(; x>0; x--, outrf+= 4, inrf+= 1) {
|
||||
outrf[0]= inrf[0];
|
||||
outrf[1]= inrf[0];
|
||||
outrf[2]= inrf[0];
|
||||
outrf[3]= inrf[0];
|
||||
}
|
||||
}
|
||||
else if(inbuf->type==CB_VEC2) {
|
||||
for(; x>0; x--, outrf+= 4, inrf+= 2) {
|
||||
outrf[0]= inrf[0];
|
||||
outrf[1]= inrf[1];
|
||||
outrf[2]= 0.0f;
|
||||
outrf[3]= 1.0f;
|
||||
}
|
||||
}
|
||||
else if(inbuf->type==CB_VEC3) {
|
||||
for(; x>0; x--, outrf+= 4, inrf+= 3) {
|
||||
outrf[0]= inrf[0];
|
||||
outrf[1]= inrf[1];
|
||||
outrf[2]= inrf[2];
|
||||
outrf[3]= 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1054,21 +1100,24 @@ static bNodeType cmp_node_image= {
|
|||
#define RRES_OUT_ALPHA 1
|
||||
#define RRES_OUT_Z 2
|
||||
#define RRES_OUT_NORMAL 3
|
||||
#define RRES_OUT_VEC 4
|
||||
#define RRES_OUT_RGBA 5
|
||||
#define RRES_OUT_DIFF 6
|
||||
#define RRES_OUT_SPEC 7
|
||||
#define RRES_OUT_SHADOW 8
|
||||
#define RRES_OUT_AO 9
|
||||
#define RRES_OUT_REFLECT 10
|
||||
#define RRES_OUT_REFRACT 11
|
||||
#define RRES_OUT_INDEXOB 12
|
||||
#define RRES_OUT_UV 4
|
||||
#define RRES_OUT_VEC 5
|
||||
#define RRES_OUT_RGBA 6
|
||||
#define RRES_OUT_DIFF 7
|
||||
#define RRES_OUT_SPEC 8
|
||||
#define RRES_OUT_SHADOW 9
|
||||
#define RRES_OUT_AO 10
|
||||
#define RRES_OUT_REFLECT 11
|
||||
#define RRES_OUT_REFRACT 12
|
||||
#define RRES_OUT_RADIO 13
|
||||
#define RRES_OUT_INDEXOB 14
|
||||
|
||||
static bNodeSocketType cmp_node_rlayers_out[]= {
|
||||
{ SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
|
||||
{ SOCK_VALUE, 0, "Alpha", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
|
||||
{ SOCK_VALUE, 0, "Z", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
|
||||
{ SOCK_VECTOR, 0, "Normal", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
|
||||
{ SOCK_VECTOR, 0, "UV", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
|
||||
{ SOCK_VECTOR, 0, "Speed", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
|
||||
{ SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
|
||||
{ SOCK_RGBA, 0, "Diffuse", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
|
||||
|
@ -1077,6 +1126,7 @@ static bNodeSocketType cmp_node_rlayers_out[]= {
|
|||
{ SOCK_RGBA, 0, "AO", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
|
||||
{ SOCK_RGBA, 0, "Reflect", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
|
||||
{ SOCK_RGBA, 0, "Refract", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
|
||||
{ SOCK_RGBA, 0, "Radio", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
|
||||
{ SOCK_VALUE, 0, "IndexOB", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
|
||||
{ -1, 0, "" }
|
||||
};
|
||||
|
@ -1147,6 +1197,8 @@ static void node_composit_exec_rlayers(void *data, bNode *node, bNodeStack **in,
|
|||
out[RRES_OUT_VEC]->data= compbuf_from_pass(rd, rl, rr->rectx, rr->recty, SCE_PASS_VECTOR);
|
||||
if(out[RRES_OUT_NORMAL]->hasoutput)
|
||||
out[RRES_OUT_NORMAL]->data= compbuf_from_pass(rd, rl, rr->rectx, rr->recty, SCE_PASS_NORMAL);
|
||||
if(out[RRES_OUT_UV]->hasoutput)
|
||||
out[RRES_OUT_UV]->data= compbuf_from_pass(rd, rl, rr->rectx, rr->recty, SCE_PASS_UV);
|
||||
|
||||
if(out[RRES_OUT_RGBA]->hasoutput)
|
||||
out[RRES_OUT_RGBA]->data= compbuf_from_pass(rd, rl, rr->rectx, rr->recty, SCE_PASS_RGBA);
|
||||
|
@ -1162,6 +1214,8 @@ static void node_composit_exec_rlayers(void *data, bNode *node, bNodeStack **in,
|
|||
out[RRES_OUT_REFLECT]->data= compbuf_from_pass(rd, rl, rr->rectx, rr->recty, SCE_PASS_REFLECT);
|
||||
if(out[RRES_OUT_REFRACT]->hasoutput)
|
||||
out[RRES_OUT_REFRACT]->data= compbuf_from_pass(rd, rl, rr->rectx, rr->recty, SCE_PASS_REFRACT);
|
||||
if(out[RRES_OUT_RADIO]->hasoutput)
|
||||
out[RRES_OUT_RADIO]->data= compbuf_from_pass(rd, rl, rr->rectx, rr->recty, SCE_PASS_RADIO);
|
||||
if(out[RRES_OUT_INDEXOB]->hasoutput)
|
||||
out[RRES_OUT_INDEXOB]->data= compbuf_from_pass(rd, rl, rr->rectx, rr->recty, SCE_PASS_INDEXOB);
|
||||
|
||||
|
@ -1618,7 +1672,10 @@ static void do_mix_rgb(bNode *node, float *out, float *in1, float *in2, float *f
|
|||
float col[3];
|
||||
|
||||
VECCOPY(col, in1);
|
||||
ramp_blend(node->custom1, col, col+1, col+2, fac[0], in2);
|
||||
if(node->custom2)
|
||||
ramp_blend(node->custom1, col, col+1, col+2, in2[3]*fac[0], in2);
|
||||
else
|
||||
ramp_blend(node->custom1, col, col+1, col+2, fac[0], in2);
|
||||
VECCOPY(out, col);
|
||||
out[3]= in1[3];
|
||||
}
|
||||
|
@ -1650,7 +1707,7 @@ static void node_composit_exec_mix_rgb(void *data, bNode *node, bNodeStack **in,
|
|||
static bNodeType cmp_node_mix_rgb= {
|
||||
/* type code */ CMP_NODE_MIX_RGB,
|
||||
/* name */ "Mix",
|
||||
/* width+range */ 80, 40, 120,
|
||||
/* width+range */ 80, 60, 120,
|
||||
/* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS,
|
||||
/* input sock */ cmp_node_mix_rgb_in,
|
||||
/* output sock */ cmp_node_mix_rgb_out,
|
||||
|
@ -1741,7 +1798,7 @@ static void do_filter3(CompBuf *out, CompBuf *in, float *filter, float fac)
|
|||
|
||||
if(pixlen==1) {
|
||||
fp[0]= row2[0];
|
||||
fp+= pixlen;
|
||||
fp+= 1;
|
||||
|
||||
for(x=2; x<rowlen; x++) {
|
||||
fp[0]= mfac*row2[1] + fac*(filter[0]*row1[0] + filter[1]*row1[1] + filter[2]*row1[2] + filter[3]*row2[0] + filter[4]*row2[1] + filter[5]*row2[2] + filter[6]*row3[0] + filter[7]*row3[1] + filter[8]*row3[2]);
|
||||
|
@ -1749,12 +1806,26 @@ static void do_filter3(CompBuf *out, CompBuf *in, float *filter, float fac)
|
|||
}
|
||||
fp[0]= row2[1];
|
||||
}
|
||||
else if(pixlen==3) {
|
||||
VECCOPY(fp, row2);
|
||||
fp+= pixlen;
|
||||
else if(pixlen==2) {
|
||||
fp[0]= row2[0];
|
||||
fp[1]= row2[1];
|
||||
fp+= 2;
|
||||
|
||||
for(x=2; x<rowlen; x++) {
|
||||
for(c=0; c<pixlen; c++) {
|
||||
for(c=0; c<2; c++) {
|
||||
fp[0]= mfac*row2[2] + fac*(filter[0]*row1[0] + filter[1]*row1[2] + filter[2]*row1[4] + filter[3]*row2[0] + filter[4]*row2[2] + filter[5]*row2[4] + filter[6]*row3[0] + filter[7]*row3[2] + filter[8]*row3[4]);
|
||||
fp++; row1++; row2++; row3++;
|
||||
}
|
||||
}
|
||||
fp[0]= row2[2];
|
||||
fp[1]= row2[3];
|
||||
}
|
||||
else if(pixlen==3) {
|
||||
VECCOPY(fp, row2);
|
||||
fp+= 3;
|
||||
|
||||
for(x=2; x<rowlen; x++) {
|
||||
for(c=0; c<3; c++) {
|
||||
fp[0]= mfac*row2[3] + fac*(filter[0]*row1[0] + filter[1]*row1[3] + filter[2]*row1[6] + filter[3]*row2[0] + filter[4]*row2[3] + filter[5]*row2[6] + filter[6]*row3[0] + filter[7]*row3[3] + filter[8]*row3[6]);
|
||||
fp++; row1++; row2++; row3++;
|
||||
}
|
||||
|
@ -1763,10 +1834,10 @@ static void do_filter3(CompBuf *out, CompBuf *in, float *filter, float fac)
|
|||
}
|
||||
else {
|
||||
QUATCOPY(fp, row2);
|
||||
fp+= pixlen;
|
||||
fp+= 4;
|
||||
|
||||
for(x=2; x<rowlen; x++) {
|
||||
for(c=0; c<pixlen; c++) {
|
||||
for(c=0; c<4; c++) {
|
||||
fp[0]= mfac*row2[4] + fac*(filter[0]*row1[0] + filter[1]*row1[4] + filter[2]*row1[8] + filter[3]*row2[0] + filter[4]*row2[4] + filter[5]*row2[8] + filter[6]*row3[0] + filter[7]*row3[4] + filter[8]*row3[8]);
|
||||
fp++; row1++; row2++; row3++;
|
||||
}
|
||||
|
@ -2295,6 +2366,7 @@ static bNodeType cmp_node_alphaover= {
|
|||
};
|
||||
|
||||
/* **************** Z COMBINE ******************** */
|
||||
/* lazy coder note: node->custom1 is abused to send signal */
|
||||
static bNodeSocketType cmp_node_zcombine_in[]= {
|
||||
{ SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
|
||||
{ SOCK_VALUE, 1, "Z", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 10000.0f},
|
||||
|
@ -2308,25 +2380,24 @@ static bNodeSocketType cmp_node_zcombine_out[]= {
|
|||
{ -1, 0, "" }
|
||||
};
|
||||
|
||||
static void do_zcombine(bNode *node, float *out, float *src1, float *z1, float *src2, float *z2)
|
||||
static void do_zcombine_mask(bNode *node, float *out, float *z1, float *z2)
|
||||
{
|
||||
if(*z1 <= *z2) {
|
||||
QUATCOPY(out, src1);
|
||||
}
|
||||
else {
|
||||
QUATCOPY(out, src2);
|
||||
if(*z1 > *z2) {
|
||||
*out= 1.0f;
|
||||
if(node->custom1)
|
||||
*z1= *z2;
|
||||
}
|
||||
}
|
||||
|
||||
static void do_zcombine_assign(bNode *node, float *out, float *src1, float *z1, float *src2, float *z2)
|
||||
static void do_zcombine_add(bNode *node, float *out, float *col1, float *col2, float *acol)
|
||||
{
|
||||
if(*z1 <= *z2) {
|
||||
QUATCOPY(out, src1);
|
||||
}
|
||||
else {
|
||||
*z1= *z2;
|
||||
QUATCOPY(out, src2);
|
||||
}
|
||||
float alpha= *acol;
|
||||
float malpha= 1.0f - alpha;
|
||||
|
||||
out[0]= malpha*col1[0] + alpha*col2[0];
|
||||
out[1]= malpha*col1[1] + alpha*col2[1];
|
||||
out[2]= malpha*col1[2] + alpha*col2[2];
|
||||
out[3]= malpha*col1[3] + alpha*col2[3];
|
||||
}
|
||||
|
||||
static void node_composit_exec_zcombine(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
|
||||
|
@ -2344,7 +2415,10 @@ static void node_composit_exec_zcombine(void *data, bNode *node, bNodeStack **in
|
|||
/* make output size of first input image */
|
||||
CompBuf *cbuf= in[0]->data;
|
||||
CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 1); // allocs
|
||||
CompBuf *zbuf= NULL;
|
||||
CompBuf *zbuf, *mbuf;
|
||||
float *fp;
|
||||
int x;
|
||||
char *aabuf;
|
||||
|
||||
if(out[1]->hasoutput) {
|
||||
/* copy or make a buffer for for the first z value, here we write result in */
|
||||
|
@ -2358,17 +2432,42 @@ static void node_composit_exec_zcombine(void *data, bNode *node, bNodeStack **in
|
|||
for(zval= zbuf->rect; tot; tot--, zval++)
|
||||
*zval= in[1]->vec[0];
|
||||
}
|
||||
/* lazy coder hack */
|
||||
node->custom1= 1;
|
||||
}
|
||||
else {
|
||||
node->custom1= 0;
|
||||
zbuf= in[1]->data;
|
||||
}
|
||||
|
||||
if(zbuf)
|
||||
composit4_pixel_processor(node, stackbuf, in[0]->data, in[0]->vec, zbuf, in[1]->vec, in[2]->data, in[2]->vec,
|
||||
in[3]->data, in[3]->vec, do_zcombine_assign, CB_RGBA, CB_VAL, CB_RGBA, CB_VAL);
|
||||
else
|
||||
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);
|
||||
/* make a mask based on comparison, optionally write zvalue */
|
||||
mbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_VAL, 1);
|
||||
composit2_pixel_processor(node, mbuf, zbuf, in[1]->vec, in[3]->data, in[3]->vec, do_zcombine_mask, CB_VAL, CB_VAL);
|
||||
|
||||
/* convert to char */
|
||||
aabuf= MEM_mallocN(cbuf->x*cbuf->y, "aa buf");
|
||||
fp= mbuf->rect;
|
||||
for(x= cbuf->x*cbuf->y-1; x>=0; x--)
|
||||
if(fp[x]==0.0f) aabuf[x]= 0;
|
||||
else aabuf[x]= 255;
|
||||
|
||||
antialias_tagbuf(cbuf->x, cbuf->y, aabuf);
|
||||
|
||||
/* convert to float */
|
||||
fp= mbuf->rect;
|
||||
for(x= cbuf->x*cbuf->y-1; x>=0; x--)
|
||||
if(aabuf[x]>1)
|
||||
fp[x]= (1.0f/255.0f)*(float)aabuf[x];
|
||||
|
||||
composit3_pixel_processor(node, stackbuf, in[0]->data, in[0]->vec, in[2]->data, in[2]->vec, mbuf, NULL,
|
||||
do_zcombine_add, CB_RGBA, CB_RGBA, CB_VAL);
|
||||
/* free */
|
||||
free_compbuf(mbuf);
|
||||
MEM_freeN(aabuf);
|
||||
|
||||
out[0]->data= stackbuf;
|
||||
out[1]->data= zbuf;
|
||||
if(node->custom1)
|
||||
out[1]->data= zbuf;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2986,7 +3085,7 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN
|
|||
if(img==NULL || out[0]->hasoutput==0)
|
||||
return;
|
||||
|
||||
if(img->type==CB_VEC3) {
|
||||
if(img->type==CB_VEC2 || img->type==CB_VEC3) {
|
||||
img= typecheck_compbuf(in[0]->data, CB_RGBA);
|
||||
}
|
||||
|
||||
|
@ -4348,6 +4447,180 @@ static bNodeType cmp_node_scale= {
|
|||
/* execfunc */ node_composit_exec_scale
|
||||
};
|
||||
|
||||
/* **************** Map UV ******************** */
|
||||
|
||||
static bNodeSocketType cmp_node_mapuv_in[]= {
|
||||
{ SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
|
||||
{ SOCK_VECTOR, 1, "UV", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
|
||||
{ -1, 0, "" }
|
||||
};
|
||||
static bNodeSocketType cmp_node_mapuv_out[]= {
|
||||
{ SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
|
||||
{ -1, 0, "" }
|
||||
};
|
||||
|
||||
/* foreach UV, use these values to read in cbuf and write to stackbuf */
|
||||
/* stackbuf should be zeroed */
|
||||
static void do_mapuv(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *uvbuf, float threshold)
|
||||
{
|
||||
ImBuf *ibuf;
|
||||
float *out= stackbuf->rect, *uv, *uvnext, *uvprev;
|
||||
float dx, dy, alpha;
|
||||
int x, y, sx, sy, row= 3*stackbuf->x;
|
||||
|
||||
/* ibuf needed for sampling */
|
||||
ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0, 0);
|
||||
ibuf->rect_float= cbuf->rect;
|
||||
|
||||
/* vars for efficient looping */
|
||||
uv= uvbuf->rect;
|
||||
uvnext= uv+row;
|
||||
uvprev= uv-row;
|
||||
sx= stackbuf->x;
|
||||
sy= stackbuf->y;
|
||||
|
||||
for(y=0; y<sy; y++) {
|
||||
for(x=0; x<sx; x++, out+=4, uv+=3, uvnext+=3, uvprev+=3) {
|
||||
if(x>0 && x<sx-1 && y>0 && y<sy-1) {
|
||||
if(uv[2]!=0.0f) {
|
||||
|
||||
dx= 0.5f*(fabs(uv[0]-uv[-3]) + fabs(uv[0]-uv[3]));
|
||||
|
||||
dx+= 0.25f*(fabs(uv[0]-uvprev[-3]) + fabs(uv[0]-uvnext[-3]));
|
||||
dx+= 0.25f*(fabs(uv[0]-uvprev[+3]) + fabs(uv[0]-uvnext[+3]));
|
||||
|
||||
dy= 0.5f*(fabs(uv[1]-uv[-row+1]) + fabs(uv[1]-uv[row+1]));
|
||||
|
||||
dy+= 0.25f*(fabs(uv[1]-uvprev[+1-3]) + fabs(uv[1]-uvnext[+1-3]));
|
||||
dy+= 0.25f*(fabs(uv[1]-uvprev[+1+3]) + fabs(uv[1]-uvnext[+1+3]));
|
||||
|
||||
/* UV to alpha threshold */
|
||||
alpha= 1.0f - threshold*(dx+dy);
|
||||
if(alpha<0.0f) alpha= 0.0f;
|
||||
else alpha*= uv[2];
|
||||
|
||||
/* should use mipmap */
|
||||
if(dx > 0.20f) dx= 0.20f;
|
||||
if(dy > 0.20f) dy= 0.20f;
|
||||
|
||||
ibuf_sample(ibuf, uv[0], uv[1], dx, dy, out);
|
||||
/* premul */
|
||||
if(alpha<1.0f) {
|
||||
out[0]*= alpha;
|
||||
out[1]*= alpha;
|
||||
out[2]*= alpha;
|
||||
out[3]*= alpha;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IMB_freeImBuf(ibuf);
|
||||
}
|
||||
|
||||
|
||||
static void node_composit_exec_mapuv(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
|
||||
{
|
||||
if(out[0]->hasoutput==0)
|
||||
return;
|
||||
|
||||
if(in[0]->data && in[1]->data) {
|
||||
CompBuf *cbuf= in[0]->data;
|
||||
CompBuf *uvbuf= in[1]->data;
|
||||
CompBuf *stackbuf;
|
||||
|
||||
cbuf= typecheck_compbuf(cbuf, CB_RGBA);
|
||||
uvbuf= typecheck_compbuf(uvbuf, CB_VEC3);
|
||||
stackbuf= alloc_compbuf(uvbuf->x, uvbuf->y, CB_RGBA, 1); // allocs;
|
||||
|
||||
do_mapuv(stackbuf, cbuf, uvbuf, 0.05f*(float)node->custom1);
|
||||
|
||||
out[0]->data= stackbuf;
|
||||
|
||||
if(cbuf!=in[0]->data)
|
||||
free_compbuf(cbuf);
|
||||
if(uvbuf!=in[1]->data)
|
||||
free_compbuf(uvbuf);
|
||||
}
|
||||
}
|
||||
|
||||
static bNodeType cmp_node_mapuv= {
|
||||
/* type code */ CMP_NODE_MAP_UV,
|
||||
/* name */ "Map UV",
|
||||
/* width+range */ 140, 100, 320,
|
||||
/* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS,
|
||||
/* input sock */ cmp_node_mapuv_in,
|
||||
/* output sock */ cmp_node_mapuv_out,
|
||||
/* storage */ "",
|
||||
/* execfunc */ node_composit_exec_mapuv
|
||||
};
|
||||
|
||||
|
||||
/* **************** ID Mask ******************** */
|
||||
|
||||
static bNodeSocketType cmp_node_idmask_in[]= {
|
||||
{ SOCK_VALUE, 1, "ID value", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
|
||||
{ -1, 0, "" }
|
||||
};
|
||||
static bNodeSocketType cmp_node_idmask_out[]= {
|
||||
{ SOCK_VALUE, 0, "Alpha", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
|
||||
{ -1, 0, "" }
|
||||
};
|
||||
|
||||
/* stackbuf should be zeroed */
|
||||
static void do_idmask(CompBuf *stackbuf, CompBuf *cbuf, float idnr)
|
||||
{
|
||||
float *rect;
|
||||
int x;
|
||||
char *abuf= MEM_mapallocN(cbuf->x*cbuf->y, "anti ali buf");
|
||||
|
||||
rect= cbuf->rect;
|
||||
for(x= cbuf->x*cbuf->y - 1; x>=0; x--)
|
||||
if(rect[x]==idnr)
|
||||
abuf[x]= 255;
|
||||
|
||||
antialias_tagbuf(cbuf->x, cbuf->y, abuf);
|
||||
|
||||
rect= stackbuf->rect;
|
||||
for(x= cbuf->x*cbuf->y - 1; x>=0; x--)
|
||||
if(abuf[x]>1)
|
||||
rect[x]= (1.0f/255.0f)*(float)abuf[x];
|
||||
|
||||
MEM_freeN(abuf);
|
||||
}
|
||||
|
||||
static void node_composit_exec_idmask(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
|
||||
{
|
||||
if(out[0]->hasoutput==0)
|
||||
return;
|
||||
|
||||
if(in[0]->data) {
|
||||
CompBuf *cbuf= in[0]->data;
|
||||
CompBuf *stackbuf;
|
||||
|
||||
if(cbuf->type!=CB_VAL)
|
||||
return;
|
||||
|
||||
stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_VAL, 1); // allocs;
|
||||
|
||||
do_idmask(stackbuf, cbuf, (float)node->custom1);
|
||||
|
||||
out[0]->data= stackbuf;
|
||||
}
|
||||
}
|
||||
|
||||
static bNodeType cmp_node_idmask= {
|
||||
/* type code */ CMP_NODE_ID_MASK,
|
||||
/* name */ "ID Mask",
|
||||
/* width+range */ 140, 100, 320,
|
||||
/* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS,
|
||||
/* input sock */ cmp_node_idmask_in,
|
||||
/* output sock */ cmp_node_idmask_out,
|
||||
/* storage */ "",
|
||||
/* execfunc */ node_composit_exec_idmask
|
||||
};
|
||||
|
||||
|
||||
/* ****************** types array for all shaders ****************** */
|
||||
|
||||
|
@ -4393,6 +4666,8 @@ bNodeType *node_all_composit[]= {
|
|||
&cmp_node_scale,
|
||||
&cmp_node_luma,
|
||||
&cmp_node_splitviewer,
|
||||
&cmp_node_mapuv,
|
||||
&cmp_node_idmask,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -4420,6 +4695,8 @@ void ntreeCompositForceHidden(bNodeTree *ntree)
|
|||
if(!(srl->passflag & SCE_PASS_NORMAL)) sock->flag |= SOCK_UNAVAIL;
|
||||
sock= BLI_findlink(&node->outputs, RRES_OUT_VEC);
|
||||
if(!(srl->passflag & SCE_PASS_VECTOR)) sock->flag |= SOCK_UNAVAIL;
|
||||
sock= BLI_findlink(&node->outputs, RRES_OUT_UV);
|
||||
if(!(srl->passflag & SCE_PASS_UV)) sock->flag |= SOCK_UNAVAIL;
|
||||
sock= BLI_findlink(&node->outputs, RRES_OUT_RGBA);
|
||||
if(!(srl->passflag & SCE_PASS_RGBA)) sock->flag |= SOCK_UNAVAIL;
|
||||
sock= BLI_findlink(&node->outputs, RRES_OUT_DIFF);
|
||||
|
@ -4434,6 +4711,8 @@ void ntreeCompositForceHidden(bNodeTree *ntree)
|
|||
if(!(srl->passflag & SCE_PASS_REFLECT)) sock->flag |= SOCK_UNAVAIL;
|
||||
sock= BLI_findlink(&node->outputs, RRES_OUT_REFRACT);
|
||||
if(!(srl->passflag & SCE_PASS_REFRACT)) sock->flag |= SOCK_UNAVAIL;
|
||||
sock= BLI_findlink(&node->outputs, RRES_OUT_RADIO);
|
||||
if(!(srl->passflag & SCE_PASS_RADIO)) sock->flag |= SOCK_UNAVAIL;
|
||||
sock= BLI_findlink(&node->outputs, RRES_OUT_INDEXOB);
|
||||
if(!(srl->passflag & SCE_PASS_INDEXOB)) sock->flag |= SOCK_UNAVAIL;
|
||||
}
|
||||
|
|
|
@ -151,8 +151,10 @@ typedef struct SceneRenderLayer {
|
|||
#define SCE_PASS_VECTOR 512
|
||||
#define SCE_PASS_REFRACT 1024
|
||||
#define SCE_PASS_INDEXOB 2048
|
||||
#define SCE_PASS_RADIO 4096
|
||||
/* note, passflag is treestore element 'nr' in outliner, short still... */
|
||||
#define SCE_PASS_UV 4096
|
||||
#define SCE_PASS_RADIO 8192
|
||||
/* note, srl->passflag is treestore element 'nr' in outliner, short still... */
|
||||
|
||||
|
||||
typedef struct RenderData {
|
||||
struct AviCodecData *avicodecdata;
|
||||
|
|
|
@ -42,10 +42,16 @@ struct RadView;
|
|||
struct RNode;
|
||||
struct Render;
|
||||
struct MTex;
|
||||
struct ImBuf;
|
||||
|
||||
void RE_zbufferall_radio(struct RadView *vw, struct RNode **rg_elem, int rg_totelem, struct Render *re);
|
||||
|
||||
/* effect.c, editmesh_modes.c and brush.c, returns 1 if rgb, 0 otherwise */
|
||||
int externtex(struct MTex *mtex, float *vec, float *tin, float *tr, float *tg, float *tb, float *ta);
|
||||
|
||||
/* node_composite.c */
|
||||
void ibuf_sample(struct ImBuf *ibuf, float fx, float fy, float dx, float dy, float *result);
|
||||
void antialias_tagbuf(int xsize, int ysize, char *rectmove);
|
||||
|
||||
#endif /* RE_RENDER_EXT_H */
|
||||
|
||||
|
|
|
@ -603,7 +603,7 @@ void image_sample(Image *ima, float fx, float fy, float dx, float dy, float *res
|
|||
if( (R.flag & R_SEC_FIELD) && (ima->ibuf->flags & IB_fields) )
|
||||
ima->ibuf->rect+= (ima->ibuf->x*ima->ibuf->y);
|
||||
|
||||
boxsample(ima->ibuf, fx, fy, fx+dx, fy+dy, &texres, 0, 0);
|
||||
boxsample(ima->ibuf, fx, fy, fx+dx, fy+dy, &texres, 0, 1);
|
||||
result[0]= texres.tr;
|
||||
result[1]= texres.tg;
|
||||
result[2]= texres.tb;
|
||||
|
@ -613,6 +613,23 @@ void image_sample(Image *ima, float fx, float fy, float dx, float dy, float *res
|
|||
ima->ibuf->rect-= (ima->ibuf->x*ima->ibuf->y);
|
||||
}
|
||||
|
||||
void ibuf_sample(ImBuf *ibuf, float fx, float fy, float dx, float dy, float *result)
|
||||
{
|
||||
TexResult texres;
|
||||
|
||||
if(ibuf==NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
boxsample(ibuf, fx, fy, fx+dx, fy+dy, &texres, 0, 1);
|
||||
result[0]= texres.tr;
|
||||
result[1]= texres.tg;
|
||||
result[2]= texres.tb;
|
||||
result[3]= texres.ta;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int imagewraposa(Tex *tex, Image *ima, float *texvec, float *dxt, float *dyt, TexResult *texres)
|
||||
{
|
||||
TexResult texr;
|
||||
|
|
|
@ -264,6 +264,10 @@ static char *get_pass_name(int passtype, int channel)
|
|||
else if(channel==1) return "Normal.Y";
|
||||
else return "Normal.Z";
|
||||
}
|
||||
if(passtype == SCE_PASS_UV) {
|
||||
if(channel==0) return "Tex.U";
|
||||
else return "Tex.V";
|
||||
}
|
||||
if(passtype == SCE_PASS_RGBA) {
|
||||
if(channel==0) return "Color.R";
|
||||
else if(channel==1) return "Color.G";
|
||||
|
@ -300,6 +304,11 @@ static char *get_pass_name(int passtype, int channel)
|
|||
else if(channel==1) return "Refract.G";
|
||||
else return "Refract.B";
|
||||
}
|
||||
if(passtype == SCE_PASS_RADIO) {
|
||||
if(channel==0) return "Radio.R";
|
||||
else if(channel==1) return "Radio.G";
|
||||
else return "Radio.B";
|
||||
}
|
||||
if(passtype == SCE_PASS_INDEXOB)
|
||||
return "IndexOB";
|
||||
return "Unknown";
|
||||
|
@ -440,6 +449,8 @@ static RenderResult *new_render_result(Render *re, rcti *partrct, int crop, int
|
|||
render_layer_add_pass(rr, rl, 4, SCE_PASS_VECTOR);
|
||||
if(srl->passflag & SCE_PASS_NORMAL)
|
||||
render_layer_add_pass(rr, rl, 3, SCE_PASS_NORMAL);
|
||||
if(srl->passflag & SCE_PASS_UV)
|
||||
render_layer_add_pass(rr, rl, 3, SCE_PASS_UV);
|
||||
if(srl->passflag & SCE_PASS_RGBA)
|
||||
render_layer_add_pass(rr, rl, 4, SCE_PASS_RGBA);
|
||||
if(srl->passflag & SCE_PASS_DIFFUSE)
|
||||
|
@ -457,6 +468,9 @@ static RenderResult *new_render_result(Render *re, rcti *partrct, int crop, int
|
|||
if(srl->passflag & SCE_PASS_REFRACT)
|
||||
render_layer_add_pass(rr, rl, 3, SCE_PASS_REFRACT);
|
||||
}
|
||||
if(re->r.mode & R_RADIO)
|
||||
if(srl->passflag & SCE_PASS_RADIO)
|
||||
render_layer_add_pass(rr, rl, 3, SCE_PASS_RADIO);
|
||||
if(srl->passflag & SCE_PASS_INDEXOB)
|
||||
render_layer_add_pass(rr, rl, 1, SCE_PASS_INDEXOB);
|
||||
|
||||
|
|
|
@ -395,14 +395,28 @@ static void add_filt_passes(RenderLayer *rl, int curmask, int rectx, int offset,
|
|||
case SCE_PASS_REFRACT:
|
||||
col= shr->refr;
|
||||
break;
|
||||
case SCE_PASS_RADIO:
|
||||
col= shr->rad;
|
||||
break;
|
||||
case SCE_PASS_NORMAL:
|
||||
col= shr->nor;
|
||||
break;
|
||||
case SCE_PASS_UV:
|
||||
/* box filter only, gauss will screwup UV too much */
|
||||
if(shi->uv[2]!=0.0f) {
|
||||
float mult= (float)count_mask(curmask)/(float)R.osa;
|
||||
fp= rpass->rect + 3*offset;
|
||||
fp[0]+= mult*(0.5f + 0.5f*shi->uv[0]);
|
||||
fp[1]+= mult*(0.5f + 0.5f*shi->uv[1]);
|
||||
fp[2]+= mult;
|
||||
}
|
||||
break;
|
||||
case SCE_PASS_INDEXOB:
|
||||
/* no filter */
|
||||
if(shi->vlr) {
|
||||
fp= rpass->rect + offset;
|
||||
*fp= (float)shi->vlr->ob->index;
|
||||
if(*fp==0.0f)
|
||||
*fp= (float)shi->vlr->ob->index;
|
||||
}
|
||||
break;
|
||||
case SCE_PASS_VECTOR:
|
||||
|
@ -433,7 +447,7 @@ static void add_passes(RenderLayer *rl, int offset, ShadeInput *shi, ShadeResult
|
|||
RenderPass *rpass;
|
||||
|
||||
for(rpass= rl->passes.first; rpass; rpass= rpass->next) {
|
||||
float *fp, *col= NULL;
|
||||
float *fp, *col= NULL, uvcol[3];
|
||||
int a, pixsize= 3;
|
||||
|
||||
switch(rpass->passtype) {
|
||||
|
@ -459,9 +473,18 @@ static void add_passes(RenderLayer *rl, int offset, ShadeInput *shi, ShadeResult
|
|||
case SCE_PASS_REFRACT:
|
||||
col= shr->refr;
|
||||
break;
|
||||
case SCE_PASS_RADIO:
|
||||
col= shr->rad;
|
||||
break;
|
||||
case SCE_PASS_NORMAL:
|
||||
col= shr->nor;
|
||||
break;
|
||||
case SCE_PASS_UV:
|
||||
uvcol[0]= 0.5f + 0.5f*shi->uv[0];
|
||||
uvcol[1]= 0.5f + 0.5f*shi->uv[1];
|
||||
uvcol[2]= 1.0f;
|
||||
col= uvcol;
|
||||
break;
|
||||
case SCE_PASS_VECTOR:
|
||||
col= shr->winspeed;
|
||||
pixsize= 4;
|
||||
|
@ -559,7 +582,7 @@ static void shadeDA_tile(RenderPart *pa, RenderLayer *rl)
|
|||
add_filt_fmask(ssamp.shi[samp].mask, fcol, rf, pa->rectx);
|
||||
|
||||
if(addpassflag)
|
||||
add_filt_passes(rl, ssamp.shi[samp].mask, pa->rectx, od, ssamp.shi, &ssamp.shr[samp]);
|
||||
add_filt_passes(rl, ssamp.shi[samp].mask, pa->rectx, od, &ssamp.shi[samp], &ssamp.shr[samp]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "MTC_matrixops.h"
|
||||
#include "BLI_arithb.h"
|
||||
|
||||
#include "DNA_curve_types.h"
|
||||
#include "DNA_group_types.h"
|
||||
#include "DNA_lamp_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
|
@ -151,9 +152,12 @@ void shade_input_do_shade(ShadeInput *shi, ShadeResult *shr)
|
|||
shade_material_loop(shi, shr);
|
||||
}
|
||||
|
||||
/* additional passes */
|
||||
QUATCOPY(shr->winspeed, shi->winspeed);
|
||||
VECCOPY(shr->nor, shi->vn);
|
||||
/* copy additional passes */
|
||||
if(shi->passflag & (SCE_PASS_VECTOR|SCE_PASS_NORMAL|SCE_PASS_RADIO)) {
|
||||
QUATCOPY(shr->winspeed, shi->winspeed);
|
||||
VECCOPY(shr->nor, shi->vn);
|
||||
VECCOPY(shr->rad, shi->rad);
|
||||
}
|
||||
|
||||
/* MIST */
|
||||
if((R.wrld.mode & WO_MIST) && (shi->mat->mode & MA_NOMIST)==0 ) {
|
||||
|
@ -396,7 +400,7 @@ void shade_input_set_uv(ShadeInput *shi)
|
|||
{
|
||||
VlakRen *vlr= shi->vlr;
|
||||
|
||||
if( (vlr->flag & R_SMOOTH) || (shi->mat->texco & NEED_UV) ) {
|
||||
if( (vlr->flag & R_SMOOTH) || (shi->mat->texco & NEED_UV) || (shi->passflag & SCE_PASS_UV)) {
|
||||
float *v1= shi->v1->co, *v2= shi->v2->co, *v3= shi->v3->co;
|
||||
|
||||
/* exception case for wire render of edge */
|
||||
|
@ -578,6 +582,10 @@ void shade_input_set_shade_texco(ShadeInput *shi)
|
|||
shi->winspeed[0]= shi->winspeed[1]= shi->winspeed[2]= shi->winspeed[3]= 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
/* pass option forces UV calc */
|
||||
if(shi->passflag & SCE_PASS_UV)
|
||||
texco |= (NEED_UV|TEXCO_UV);
|
||||
|
||||
/* texture coordinates. shi->dxuv shi->dyuv have been set */
|
||||
if(texco & NEED_UV) {
|
||||
|
@ -663,7 +671,7 @@ void shade_input_set_shade_texco(ShadeInput *shi)
|
|||
|
||||
shi->uv[0]= -1.0f + 2.0f*(l*uv3[0]-u*uv1[0]-v*uv2[0]);
|
||||
shi->uv[1]= -1.0f + 2.0f*(l*uv3[1]-u*uv1[1]-v*uv2[1]);
|
||||
shi->uv[2]= 0.0f; // texture.c assumes there are 3 coords
|
||||
shi->uv[2]= 1.0f; /* texture.c assumes there are 3 coords, also to indicate it is real UV for passes */
|
||||
|
||||
if(shi->osatex) {
|
||||
float duv[2];
|
||||
|
@ -694,7 +702,8 @@ void shade_input_set_shade_texco(ShadeInput *shi)
|
|||
else {
|
||||
shi->uv[0]= 2.0f*(u+.5f);
|
||||
shi->uv[1]= 2.0f*(v+.5f);
|
||||
shi->uv[2]= 0.0f; // texture.c assumes there are 3 coords
|
||||
shi->uv[2]= 0.0f; /* texture.c assumes there are 3 coords, also to indicate it is no real UV for passes */
|
||||
|
||||
if(mode & MA_FACETEXTURE) {
|
||||
/* no tface? set at 1.0f */
|
||||
shi->vcol[0]= 1.0f;
|
||||
|
|
|
@ -2117,7 +2117,9 @@ static void zbuf_fill_in_rgba(ZSpan *zspan, DrawBufPixel *col, float *v1, float
|
|||
}
|
||||
}
|
||||
|
||||
static void antialias_tagbuf(int xsize, int ysize, char *rectmove)
|
||||
/* char value==255 is filled in, rest should be zero */
|
||||
/* returns alpha values, but sets alpha to 1 for zero alpha pixels that have an alpha value as neighbour */
|
||||
void antialias_tagbuf(int xsize, int ysize, char *rectmove)
|
||||
{
|
||||
char *row1, *row2, *row3;
|
||||
char prev, next;
|
||||
|
@ -2136,6 +2138,7 @@ static void antialias_tagbuf(int xsize, int ysize, char *rectmove)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 2: evaluate horizontal scanlines and calculate alphas */
|
||||
row1= rectmove;
|
||||
for(y=0; y<ysize; y++) {
|
||||
|
@ -2151,21 +2154,23 @@ static void antialias_tagbuf(int xsize, int ysize, char *rectmove)
|
|||
if(x+step!=xsize) {
|
||||
/* now we can blend values */
|
||||
next= row1[step];
|
||||
if(prev!=next) {
|
||||
for(a=0; a<step; a++) {
|
||||
int fac, mfac;
|
||||
|
||||
fac= ((a+1)<<8)/(step+1);
|
||||
mfac= 255-fac;
|
||||
|
||||
row1[a]= (prev*mfac + next*fac)>>8;
|
||||
}
|
||||
|
||||
/* note, prev value can be next value, but we do this loop to clear 128 then */
|
||||
for(a=0; a<step; a++) {
|
||||
int fac, mfac;
|
||||
|
||||
fac= ((a+1)<<8)/(step+1);
|
||||
mfac= 255-fac;
|
||||
|
||||
row1[a]= (prev*mfac + next*fac)>>8;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* 2: evaluate vertical scanlines and calculate alphas */
|
||||
|
||||
/* 3: evaluate vertical scanlines and calculate alphas */
|
||||
/* use for reading a copy of the original tagged buffer */
|
||||
for(x=0; x<xsize; x++) {
|
||||
row1= rectmove + x+xsize;
|
||||
|
||||
|
@ -2180,22 +2185,20 @@ static void antialias_tagbuf(int xsize, int ysize, char *rectmove)
|
|||
if(y+step!=ysize) {
|
||||
/* now we can blend values */
|
||||
next= row1[step*xsize];
|
||||
if(prev!=next) {
|
||||
for(a=0; a<step; a++) {
|
||||
int fac, mfac;
|
||||
|
||||
fac= ((a+1)<<8)/(step+1);
|
||||
mfac= 255-fac;
|
||||
|
||||
row1[a*xsize]= (prev*mfac + next*fac)>>8;
|
||||
}
|
||||
/* note, prev value can be next value, but we do this loop to clear 128 then */
|
||||
for(a=0; a<step; a++) {
|
||||
int fac, mfac;
|
||||
|
||||
fac= ((a+1)<<8)/(step+1);
|
||||
mfac= 255-fac;
|
||||
|
||||
row1[a*xsize]= (prev*mfac + next*fac)>>8;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* last: pixels with 0 we fill in zbuffer, with 1 we skip for mask */
|
||||
for(y=2; y<ysize; y++) {
|
||||
/* setup rows */
|
||||
|
@ -2732,6 +2735,9 @@ static void merge_transp_passes(RenderLayer *rl, ShadeResult *shr)
|
|||
case SCE_PASS_REFLECT:
|
||||
col= shr->refl;
|
||||
break;
|
||||
case SCE_PASS_RADIO:
|
||||
col= shr->rad;
|
||||
break;
|
||||
case SCE_PASS_REFRACT:
|
||||
col= shr->refr;
|
||||
break;
|
||||
|
@ -2788,6 +2794,9 @@ static void add_transp_passes(RenderLayer *rl, int offset, ShadeResult *shr, flo
|
|||
case SCE_PASS_REFRACT:
|
||||
col= shr->refr;
|
||||
break;
|
||||
case SCE_PASS_RADIO:
|
||||
col= shr->rad;
|
||||
break;
|
||||
case SCE_PASS_NORMAL:
|
||||
col= shr->nor;
|
||||
break;
|
||||
|
@ -2951,6 +2960,9 @@ static int addtosamp_shr(ShadeResult *samp_shr, ShadeSample *ssamp, int addpassf
|
|||
|
||||
if(addpassflag & SCE_PASS_REFRACT)
|
||||
addvecmul(samp_shr->refr, shr->refr, fac);
|
||||
|
||||
if(addpassflag & SCE_PASS_RADIO)
|
||||
addvecmul(samp_shr->refr, shr->rad, fac);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1841,21 +1841,21 @@ static void render_panel_layers(void)
|
|||
uiBlockEndAlign(block);
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefBut(block, LABEL, 0, "Pass:", 10,30,45,20, NULL, 0, 0, 0, 0, "");
|
||||
uiDefButBitI(block, TOG, SCE_PASS_COMBINED, B_SET_PASS,"Combined", 55, 30, 90, 20, &srl->passflag, 0, 0, 0, 0, "Deliver full combined RGBA buffer");
|
||||
uiDefButBitI(block, TOG, SCE_PASS_Z, B_SET_PASS,"Z", 145, 30, 25, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Z values pass");
|
||||
uiDefButBitI(block, TOG, SCE_PASS_VECTOR, B_SET_PASS,"Vec", 170, 30, 40, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Speed Vector pass");
|
||||
uiDefButBitI(block, TOG, SCE_PASS_NORMAL, B_SET_PASS,"Nor", 210, 30, 40, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Normal pass");
|
||||
uiDefButBitI(block, TOG, SCE_PASS_INDEXOB, B_SET_PASS,"IndexOb",250, 30, 60, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Object Index pass");
|
||||
uiDefButBitI(block, TOG, SCE_PASS_COMBINED, B_SET_PASS,"Combined", 10, 30, 80, 20, &srl->passflag, 0, 0, 0, 0, "Deliver full combined RGBA buffer");
|
||||
uiDefButBitI(block, TOG, SCE_PASS_Z, B_SET_PASS,"Z", 90, 30, 30, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Z values pass");
|
||||
uiDefButBitI(block, TOG, SCE_PASS_VECTOR, B_SET_PASS,"Vec", 120, 30, 40, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Speed Vector pass");
|
||||
uiDefButBitI(block, TOG, SCE_PASS_NORMAL, B_SET_PASS,"Nor", 160, 30, 40, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Normal pass");
|
||||
uiDefButBitI(block, TOG, SCE_PASS_UV, B_SET_PASS,"UV", 200, 30, 40, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Texture UV pass");
|
||||
uiDefButBitI(block, TOG, SCE_PASS_INDEXOB, B_SET_PASS,"IndexOb",240, 30, 70, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Object Index pass");
|
||||
|
||||
uiDefButBitI(block, TOG, SCE_PASS_RGBA, B_SET_PASS,"Col", 10, 10, 45, 20, &srl->passflag, 0, 0, 0, 0, "Deliver shade-less Color pass");
|
||||
uiDefButBitI(block, TOG, SCE_PASS_DIFFUSE, B_SET_PASS,"Diff", 55, 10, 45, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Diffuse pass");
|
||||
uiDefButBitI(block, BUT_TOGDUAL, SCE_PASS_SPEC, B_SET_PASS,"Spec", 100, 10, 45, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Specular pass");
|
||||
uiDefButBitI(block, BUT_TOGDUAL, SCE_PASS_SHADOW, B_SET_PASS,"Shad", 145, 10, 45, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Shadow pass");
|
||||
uiDefButBitI(block, BUT_TOGDUAL, SCE_PASS_AO, B_SET_PASS,"AO", 185, 10, 40, 20, &srl->passflag, 0, 0, 0, 0, "Deliver AO pass");
|
||||
uiDefButBitI(block, BUT_TOGDUAL, SCE_PASS_REFLECT, B_SET_PASS,"Refl", 225, 10, 45, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Raytraced Reflection pass");
|
||||
uiDefButBitI(block, BUT_TOGDUAL, SCE_PASS_REFRACT, B_SET_PASS,"Refr", 270, 10, 40, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Raytraced Refraction pass");
|
||||
|
||||
uiDefButBitI(block, TOG, SCE_PASS_RGBA, B_SET_PASS,"Col", 10, 10, 35, 20, &srl->passflag, 0, 0, 0, 0, "Deliver shade-less Color pass");
|
||||
uiDefButBitI(block, TOG, SCE_PASS_DIFFUSE, B_SET_PASS,"Diff", 45, 10, 35, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Diffuse pass");
|
||||
uiDefButBitI(block, BUT_TOGDUAL, SCE_PASS_SPEC, B_SET_PASS,"Spec", 80, 10, 40, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Specular pass");
|
||||
uiDefButBitI(block, BUT_TOGDUAL, SCE_PASS_SHADOW, B_SET_PASS,"Shad", 120, 10, 40, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Shadow pass");
|
||||
uiDefButBitI(block, BUT_TOGDUAL, SCE_PASS_AO, B_SET_PASS,"AO", 160, 10, 30, 20, &srl->passflag, 0, 0, 0, 0, "Deliver AO pass");
|
||||
uiDefButBitI(block, BUT_TOGDUAL, SCE_PASS_REFLECT, B_SET_PASS,"Refl", 190, 10, 40, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Raytraced Reflection pass");
|
||||
uiDefButBitI(block, BUT_TOGDUAL, SCE_PASS_REFRACT, B_SET_PASS,"Refr", 230, 10, 40, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Raytraced Refraction pass");
|
||||
uiDefButBitI(block, BUT_TOGDUAL, SCE_PASS_RADIO, B_SET_PASS,"Rad", 270, 10, 40, 20, &srl->passflag, 0, 0, 0, 0, "Deliver Raytraced Refraction pass");
|
||||
}
|
||||
|
||||
void render_panels()
|
||||
|
|
|
@ -275,10 +275,15 @@ static int node_buts_mix_rgb(uiBlock *block, bNodeTree *ntree, bNode *node, rctf
|
|||
uiBut *bt;
|
||||
|
||||
/* blend type */
|
||||
uiBlockBeginAlign(block);
|
||||
bt=uiDefButS(block, MENU, B_NODE_EXEC+node->nr, "Mix %x0|Add %x1|Subtract %x3|Multiply %x2|Screen %x4|Overlay %x9|Divide %x5|Difference %x6|Darken %x7|Lighten %x8|Dodge %x10|Burn %x11|Color %x15|Value %x14|Saturation %x13|Hue %x12",
|
||||
butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
|
||||
butr->xmin, butr->ymin, butr->xmax-butr->xmin-20, 20,
|
||||
&node->custom1, 0, 0, 0, 0, "");
|
||||
uiButSetFunc(bt, node_but_title_cb, node, bt);
|
||||
/* Alpha option */
|
||||
uiDefButS(block, TOG, B_NODE_EXEC+node->nr, "A",
|
||||
butr->xmax-20, butr->ymin, 20, 20,
|
||||
&node->custom2, 0, 0, 0, 0, "Include Alpha of 2nd input in this operation");
|
||||
}
|
||||
return 20;
|
||||
}
|
||||
|
@ -1177,6 +1182,27 @@ static int node_composit_buts_luma_matte(uiBlock *block, bNodeTree *ntree, bNode
|
|||
return 60;
|
||||
}
|
||||
|
||||
static int node_composit_buts_map_uv(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
|
||||
{
|
||||
if(block) {
|
||||
uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "Alpha:",
|
||||
butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
|
||||
&node->custom1, 0, 100, 0, 0, "Conversion percentage of UV differences to Alpha");
|
||||
}
|
||||
return 20;
|
||||
}
|
||||
|
||||
static int node_composit_buts_id_mask(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
|
||||
{
|
||||
if(block) {
|
||||
uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "ID:",
|
||||
butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20,
|
||||
&node->custom1, 0, 10000, 0, 0, "Pass Index number to convert to Alpha");
|
||||
}
|
||||
return 20;
|
||||
}
|
||||
|
||||
|
||||
/* allocate sufficient! */
|
||||
static void node_imagetype_string(char *str)
|
||||
{
|
||||
|
@ -1353,6 +1379,12 @@ static void node_composit_set_butfunc(bNodeType *ntype)
|
|||
case CMP_NODE_LUMA:
|
||||
ntype->butfunc= node_composit_buts_luma_matte;
|
||||
break;
|
||||
case CMP_NODE_MAP_UV:
|
||||
ntype->butfunc= node_composit_buts_map_uv;
|
||||
break;
|
||||
case CMP_NODE_ID_MASK:
|
||||
ntype->butfunc= node_composit_buts_id_mask;
|
||||
break;
|
||||
default:
|
||||
ntype->butfunc= NULL;
|
||||
}
|
||||
|
|
|
@ -2653,7 +2653,7 @@ static void draw_dupli_objects(View3D *v3d, Base *base)
|
|||
BoundBox *bb= NULL;
|
||||
GLuint displist=0;
|
||||
int color= (base->flag & SELECT)?TH_SELECT:TH_WIRE;
|
||||
short transflag, use_displist= G.rt; /* -1 is initialize */
|
||||
short transflag, use_displist= -1; /* -1 is initialize */
|
||||
char dt, dtx;
|
||||
|
||||
if (base->object->restrictflag & OB_RESTRICT_VIEW) return;
|
||||
|
|
Loading…
Reference in New Issue