New render feature:

If you define multiple RenderLayers with different view-layers, these
view-layers are rendered entirely, not looking at the faces that are
invisible. This allows layered composite, but only when geometry does
not intersect or overlap partially.

This new Renderlayer option "All Z values" will fill in the Z of not
visible faces (in the Scene view-layers) as well, which then allows
masking out as if these faces were set to Material option "Env".

Here's an example composite to show the effect:

Two cubes, in view-layers 1 and 2, and rendered in 2 RenderLayers:
http://www.blender.org/bf/all_z0.jpg

Same scene, but with both RenderLayers set to "All Z values":
http://www.blender.org/bf/all_z.jpg
This commit is contained in:
Ton Roosendaal 2006-09-24 09:21:04 +00:00
parent e8495d1fdd
commit f6a6ad5688
3 changed files with 23 additions and 11 deletions

View File

@ -129,6 +129,8 @@ typedef struct SceneRenderLayer {
#define SCE_LAY_SKY 16
#define SCE_LAY_STRAND 32
#define SCE_LAY_ALL_Z 0x8000
/* srl->passflag */
#define SCE_PASS_COMBINED 1
#define SCE_PASS_Z 2

View File

@ -1620,7 +1620,7 @@ void zbuffer_solid(RenderPart *pa, unsigned int lay, short layflag)
Material *ma=0;
int v, zvlnr;
unsigned short clipmask;
short nofill=0, env=0, wire=0;
short nofill=0, env=0, wire=0, all_z= layflag & SCE_LAY_ALL_Z;
zbuf_alloc_span(&zspan, pa->rectx, pa->recty);
@ -1662,16 +1662,25 @@ void zbuffer_solid(RenderPart *pa, unsigned int lay, short layflag)
if((v & 255)==0) vlr= R.blovl[v>>8];
else vlr++;
if((vlr->flag & R_VISIBLE) && (vlr->lay & lay)) {
if(vlr->mat!=ma) {
ma= vlr->mat;
nofill= ma->mode & (MA_ZTRA|MA_ONLYCAST);
env= (ma->mode & MA_ENV);
wire= (ma->mode & MA_WIRE);
if(ma->mode & MA_ZINV) zspan.zbuffunc= zbufinvulGLinv4;
else zspan.zbuffunc= zbufinvulGL4;
if((vlr->flag & R_VISIBLE)) {
/* three cases, visible for render, only z values and nothing */
if(vlr->lay & lay) {
if(vlr->mat!=ma) {
ma= vlr->mat;
nofill= ma->mode & (MA_ZTRA|MA_ONLYCAST);
env= (ma->mode & MA_ENV);
wire= (ma->mode & MA_WIRE);
if(ma->mode & MA_ZINV) zspan.zbuffunc= zbufinvulGLinv4;
else zspan.zbuffunc= zbufinvulGL4;
}
}
else if(all_z) {
env= 1;
nofill= 0;
ma= NULL;
}
else nofill= 1;
if(nofill==0) {
unsigned short partclip;

View File

@ -1813,11 +1813,12 @@ static void render_panel_layers(void)
draw_3d_layer_buttons(block, &srl->lay, 130, 95, 35, 30);
uiBlockBeginAlign(block);
uiDefButBitS(block, TOG, SCE_LAY_SKY, B_NOP,"Sky", 10, 70, 40, 20, &srl->layflag, 0, 0, 0, 0, "Render Sky or backbuffer in this Layer");
uiDefButBitS(block, TOG, SCE_LAY_SKY, B_NOP,"Sky", 10, 70, 40, 20, &srl->layflag, 0, 0, 0, 0, "Render Sky or backbuffer in this Layer");
uiDefButBitS(block, TOG, SCE_LAY_SOLID, B_NOP,"Solid", 50, 70, 65, 20, &srl->layflag, 0, 0, 0, 0, "Render Solid faces in this Layer");
uiDefButBitS(block, TOG, SCE_LAY_HALO, B_NOP,"Halo", 115, 70, 65, 20, &srl->layflag, 0, 0, 0, 0, "Render Halos in this Layer (on top of Solid)");
uiDefButBitS(block, TOG, SCE_LAY_ZTRA, B_NOP,"Ztra", 180, 70, 65, 20, &srl->layflag, 0, 0, 0, 0, "Render Z-Transparent faces in this Layer (On top of Solid and Halos)");
uiDefButBitS(block, TOG, SCE_LAY_EDGE, B_NOP,"Edge", 245, 70, 65, 20, &srl->layflag, 0, 0, 0, 0, "Render Edge-enhance in this Layer (only works for Solid faces)");
uiDefButBitS(block, TOG, SCE_LAY_ALL_Z, B_NOP,"All Z values", 10, 50, 105, 20, &srl->layflag, 0, 0, 0, 0, "Fill in Z values for all not-rendered faces, for masking");
uiBlockEndAlign(block);
uiDefBut(block, LABEL, 0, "Passes:", 10,30,150,20, NULL, 0, 0, 0, 0, "");