Bugfix #26116
authorTon Roosendaal <ton@blender.org>
Mon, 21 Feb 2011 18:06:52 +0000 (18:06 +0000)
committerTon Roosendaal <ton@blender.org>
Mon, 21 Feb 2011 18:06:52 +0000 (18:06 +0000)
Node materials with 'ray transparency' set now work again.
Fix provided by Ervin Weber, thanks a lot!

source/blender/blenkernel/intern/material.c
source/blender/render/intern/source/rayshade.c
source/blender/render/intern/source/shadeinput.c

index 954de9c86e2d7a497b104b98d18e0e5b32de60f1..0b1cbd60432b311220ea901bdb870beb9b3edc7d 100644 (file)
@@ -872,7 +872,7 @@ static void init_render_nodetree(bNodeTree *ntree, Material *basemat, int r_mode
                                if(ma!=basemat) {
                                        do_init_render_material(ma, r_mode, amb);
                                        basemat->texco |= ma->texco;
-                                       basemat->mode_l |= ma->mode_l;
+                                       basemat->mode_l |= ma->mode_l & ~(MA_TRANSP|MA_ZTRANSP|MA_RAYTRANSP); 
                                }
                        }
                        else if(node->type==NODE_GROUP)
index 00092b8b0538fd4cc7877355a61c214852ee031e..a12e58890313f19f334fe7bc8e3038744b485a74 100644 (file)
@@ -1502,7 +1502,7 @@ void ray_trace(ShadeInput *shi, ShadeResult *shr)
        float diff[3];
        int do_tra, do_mir;
        
-       do_tra= ((shi->mat->mode & MA_TRANSP) && (shi->mat->mode & MA_RAYTRANSP) && shr->alpha!=1.0f && (shi->depth <= shi->mat->ray_depth_tra));
+       do_tra= ((shi->mode & MA_TRANSP) && (shi->mode & MA_RAYTRANSP) && shr->alpha!=1.0f && (shi->depth <= shi->mat->ray_depth_tra));
        do_mir= ((shi->mat->mode & MA_RAYMIRROR) && shi->ray_mirror!=0.0f && (shi->depth <= shi->mat->ray_depth));
        
        /* raytrace mirror amd refract like to separate the spec color */
index e4f0de688bef62bfaf25f027118fab97f906d19a..81b2203cbcf45b64fbd7df151ae8dcaa0ce8de87 100644 (file)
@@ -133,13 +133,13 @@ void shade_material_loop(ShadeInput *shi, ShadeResult *shr)
        /* depth >= 1 when ray-shading */
        if(shi->depth==0 || shi->volume_depth > 0) {
                if(R.r.mode & R_RAYTRACE) {
-                       if(shi->ray_mirror!=0.0f || ((shi->mat->mode & MA_TRANSP) && (shi->mat->mode & MA_RAYTRANSP) && shr->alpha!=1.0f)) {
+                   if(shi->ray_mirror!=0.0f || ((shi->mode & MA_TRANSP) && (shi->mode & MA_RAYTRANSP) && shr->alpha!=1.0f)) {
                                /* ray trace works on combined, but gives pass info */
                                ray_trace(shi, shr);
                        }
                }
                /* disable adding of sky for raytransp */
-               if((shi->mat->mode & MA_TRANSP) && (shi->mat->mode & MA_RAYTRANSP))
+               if((shi->mode & MA_TRANSP) && (shi->mode & MA_RAYTRANSP))
                        if((shi->layflag & SCE_LAY_SKY) && (R.r.alphamode==R_ADDSKY))
                                shr->alpha= 1.0f;
        }