New Material option: "OnlyCast". This makes the object only cast shadows,
authorTon Roosendaal <ton@blender.org>
Sat, 4 Feb 2006 15:07:48 +0000 (15:07 +0000)
committerTon Roosendaal <ton@blender.org>
Sat, 4 Feb 2006 15:07:48 +0000 (15:07 +0000)
not show up in renders, nor being mirrored.

source/blender/makesdna/DNA_material_types.h
source/blender/render/intern/source/ray.c
source/blender/render/intern/source/zbuf.c
source/blender/src/buttons_shading.c

index b9b4eaa0c29b04fcad1ae86042d5067e4f498548..4743953ecf53aa2da9f3fa5c316688ee19674d6e 100644 (file)
@@ -147,6 +147,7 @@ typedef struct Material {
 #define MA_FACETEXTURE 0x800
 #define MA_HALOTEX             0x1000
 #define MA_HALOPUNO            0x2000
+#define MA_ONLYCAST            0x2000
 #define MA_NOMIST              0x4000
 #define MA_HALO_SHADE  0x4000
 #define MA_HALO_FLARE  0x8000
index ff27a287339832a9e110c39b5dd97776e19a2485..e493fcee1e2b04399629422e345a00d26f3f12a4 100644 (file)
@@ -972,18 +972,21 @@ static int testnode(Isect *is, Node *no, OcVal ocval)
                while(vlr) {
                        
                        if(is->vlrorig != vlr) {
-                               
-                               ov= no->ov+nr;
-                               if( (ov->ocx & ocval.ocx) && (ov->ocy & ocval.ocy) && (ov->ocz & ocval.ocz) ) { 
-                                       //accepted++;
-
-                                       isect.vlr= vlr;
-                                       if(intersection(&isect)) {
-                                               if(isect.labda<is->labda) *is= isect;
-                                               found= 1;
+                               /* I now... cpu cycle waste, might do smarter once */
+                               if(is->mode==DDA_MIRROR && (vlr->mat->mode & MA_ONLYCAST));
+                               else {
+                                       ov= no->ov+nr;
+                                       if( (ov->ocx & ocval.ocx) && (ov->ocy & ocval.ocy) && (ov->ocz & ocval.ocz) ) { 
+                                               //accepted++;
+
+                                               isect.vlr= vlr;
+                                               if(intersection(&isect)) {
+                                                       if(isect.labda<is->labda) *is= isect;
+                                                       found= 1;
+                                               }
                                        }
+                                       //else rejected++;
                                }
-                               //else rejected++;
                        }
                        
                        nr++;
index cc6764f8bc44657cab3df1afc712cb8e332bfe99..e853ba9e56ecee58c57f2e7b0d116dc4f60829b7 100644 (file)
@@ -1613,7 +1613,7 @@ void zbuffer_solid(RenderPart *pa, unsigned int lay, short layflag)
        Material *ma=0;
        int v, zvlnr;
        unsigned short clipmask;
-       short transp=0, env=0, wire=0;
+       short nofill=0, env=0, wire=0;
 
        zbuf_alloc_span(&zspan, pa->rectx, pa->recty);
        
@@ -1650,7 +1650,7 @@ void zbuffer_solid(RenderPart *pa, unsigned int lay, short layflag)
                if((vlr->flag & R_VISIBLE) && (vlr->lay & lay)) {
                        if(vlr->mat!=ma) {
                                ma= vlr->mat;
-                               transp= ma->mode & MA_ZTRA;
+                               nofill= ma->mode & (MA_ZTRA|MA_ONLYCAST);
                                env= (ma->mode & MA_ENV);
                                wire= (ma->mode & MA_WIRE);
                                
@@ -1658,7 +1658,7 @@ void zbuffer_solid(RenderPart *pa, unsigned int lay, short layflag)
                                else zspan.zbuffunc= zbufinvulGL4;
                        }
                        
-                       if(transp==0) {
+                       if(nofill==0) {
                                unsigned short partclip;
                                
                                /* partclipping doesn't need viewplane clipping */
@@ -1922,10 +1922,10 @@ static void copyto_abufz(RenderPart *pa, int *arectz, int sample)
 static void zbuffer_abuf(RenderPart *pa, APixstr *APixbuf, ListBase *apsmbase, unsigned int lay, short layflag)
 {
        ZSpan zspan;
-       Material *ma=0;
+       Material *ma=NULL;
        VlakRen *vlr=NULL;
        float vec[3], hoco[4], mul, zval, fval;
-       int v, zvlnr, zsample;
+       int v, zvlnr, zsample, dofill;
        unsigned short clipmask;
        
        zbuf_alloc_span(&zspan, pa->rectx, pa->recty);
@@ -1963,8 +1963,12 @@ static void zbuffer_abuf(RenderPart *pa, APixstr *APixbuf, ListBase *apsmbase, u
                                vlr= R.blovl[v>>8];
                        else vlr++;
                        
-                       ma= vlr->mat;
-                       if(ma->mode & (MA_ZTRA)) {
+                       if(vlr->mat!=ma) {
+                               ma= vlr->mat;
+                               dofill= (ma->mode & MA_ZTRA) && !(ma->mode & MA_ONLYCAST);
+                       }
+                       
+                       if(dofill) {
                                if((vlr->flag & R_VISIBLE) && (vlr->lay & lay)) {
                                        unsigned short partclip;
                                        
index a34d9d8406e91fe6ce2f89f05ef89d31c695d3be..bea89997509ad27c89ac4f8acc699643b047ffcb 100644 (file)
@@ -3230,14 +3230,15 @@ static void material_panel_links(Object *ob, Material *ma)
        uiDefButBitI(block, TOG, MA_ZTRA, B_MATZTRANSP,"ZTransp",       110,50,100,19, &(ma->mode), 0, 0, 0, 0, "Enables Z-Buffering of transparent faces");
        uiDefButF(block, NUM, B_DIFF, "Zoffs:",                                         210,50,100,19, &(ma->zoffs), 0.0, 10.0, 100, 0, "Gives faces an artificial offset in the Z buffer for Ztransp option");
                                  
-       uiDefButBitI(block, TOG, MA_WIRE, 0,    "Wire",                         10,30,100,19, &(ma->mode), 0, 0, 0, 0, "Renders only the edges of faces as a wireframe");
-       uiDefBlockBut(block, strand_menu, ma, "Strands",                        110,30,100, 19, "Display strand settings for static particles");
-       uiDefButBitI(block, TOG, MA_ZINV, 0,    "ZInvert",                      210,30,100,19, &(ma->mode), 0, 0, 0, 0, "Renders material's faces with inverted Z Buffer");
+       uiDefButBitI(block, TOG, MA_FULL_OSA, 0, "Full Osa",            10,30,75,19, &(ma->mode), 0.0, 10.0, 0, 0, "Forces to render all OSA samples, for shading and texture antialiasing");
+       uiDefButBitI(block, TOG, MA_WIRE, B_MATPRV,     "Wire",                         85,30,75,19, &(ma->mode), 0, 0, 0, 0, "Renders only the edges of faces as a wireframe");
+       uiDefBlockBut(block, strand_menu, ma, "Strands",                        160,30,75, 19, "Display strand settings for static particles");
+       uiDefButBitI(block, TOG, MA_ZINV, B_MATPRV,     "ZInvert",                      236,30,75,19, &(ma->mode), 0, 0, 0, 0, "Renders material's faces with inverted Z Buffer");
                                  
-       uiDefButBitI(block, TOG, MA_FULL_OSA, 0, "Full Osa",            10,10,75,19, &(ma->mode), 0.0, 10.0, 0, 0, "Forces to render all OSA samples, for shading and texture antialiasing");
-       uiDefButBitI(block, TOG, MA_RADIO, B_NOP,       "Radio",                85,10,75,19, &(ma->mode), 0, 0, 0, 0, "Enables material for radiosity rendering");
+       uiDefButBitI(block, TOG, MA_RADIO, B_NOP,       "Radio",                10,10,75,19, &(ma->mode), 0, 0, 0, 0, "Enables material for radiosity rendering");
+       uiDefButBitI(block, TOG, MA_ONLYCAST, B_MATPRV,"OnlyCast",              85,10,75,19, &(ma->mode), 0, 0, 0, 0, "Makes faces only cast shadows, not rendered");
        uiDefButBitI(block, TOG, MA_TRACEBLE, B_NOP,"Traceable",        160,10,75,19, &(ma->mode), 0, 0, 0, 0, "Makes material to being detected by ray tracing");
-       uiDefButBitI(block, TOG, MA_SHADBUF, B_NOP,     "Shadbuf",              235,10,75,19, &(ma->mode), 0, 0, 0, 0, "Makes material to cast shadows with shadow buffers");
+       uiDefButBitI(block, TOG, MA_SHADBUF, B_MATPRV,  "Shadbuf",              235,10,75,19, &(ma->mode), 0, 0, 0, 0, "Makes material to cast shadows with shadow buffers");
                                  
        
 }