Revision: 17418
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17418
Author:   broken
Date:     2008-11-12 00:24:10 +0100 (Wed, 12 Nov 2008)

Log Message:
-----------
* Added a button to the volume material controls 'Alpha' to generate an 
alpha channel based on the volume's transmission properties, allowing you
to use it in comp etc.

I'd rather not have this button at all, and make it just work properly 
by default, however it causes problems with overlapping volumes when 
'premul' is on (stoopid thing..) so for the time being, there's the 
button. I'll try and fix this up later on when I have more time.

Modified Paths:
--------------
    branches/sim_physics/source/blender/makesdna/DNA_material_types.h
    branches/sim_physics/source/blender/render/intern/source/volumetric.c
    branches/sim_physics/source/blender/src/buttons_shading.c

Modified: branches/sim_physics/source/blender/makesdna/DNA_material_types.h
===================================================================
--- branches/sim_physics/source/blender/makesdna/DNA_material_types.h   
2008-11-11 22:48:47 UTC (rev 17417)
+++ branches/sim_physics/source/blender/makesdna/DNA_material_types.h   
2008-11-11 23:24:10 UTC (rev 17418)
@@ -359,6 +359,7 @@
 #define MA_VOL_ATTENUATED      2
 #define MA_VOL_RECVSHADOW      4
 #define MA_VOL_PRECACHESHADING 8
+#define MA_VOL_USEALPHA                16
 
 /* vol_phasefunc_type */
 #define MA_VOL_PH_ISOTROPIC            0

Modified: branches/sim_physics/source/blender/render/intern/source/volumetric.c
===================================================================
--- branches/sim_physics/source/blender/render/intern/source/volumetric.c       
2008-11-11 22:48:47 UTC (rev 17417)
+++ branches/sim_physics/source/blender/render/intern/source/volumetric.c       
2008-11-11 23:24:10 UTC (rev 17418)
@@ -656,8 +656,12 @@
                shr->combined[1] = col[1];
                shr->combined[2] = col[2];
                
-               //if (col[3] > 1.0f)
-               col[3] = 1.0f;
+               if (shi->mat->vol_shadeflag & MA_VOL_USEALPHA) {
+                       if (col[3] > 1.0f)
+                               col[3] = 1.0f;
+               }
+               else
+                       col[3] = 1.0f;
                shr->combined[3] = col[3];
                shr->alpha = col[3];
                
@@ -683,8 +687,12 @@
                shr->combined[1] = col[1];
                shr->combined[2] = col[2];
                
-               //if (col[3] > 1.0f) 
-               col[3] = 1.0f;
+               if (shi->mat->vol_shadeflag & MA_VOL_USEALPHA) {
+                       if (col[3] > 1.0f)
+                               col[3] = 1.0f;
+               }
+               else
+                       col[3] = 1.0f;
                shr->combined[3] = col[3];
                shr->alpha = col[3];
                

Modified: branches/sim_physics/source/blender/src/buttons_shading.c
===================================================================
--- branches/sim_physics/source/blender/src/buttons_shading.c   2008-11-11 
22:48:47 UTC (rev 17417)
+++ branches/sim_physics/source/blender/src/buttons_shading.c   2008-11-11 
23:24:10 UTC (rev 17418)
@@ -4447,6 +4447,12 @@
                uiBlockEndAlign(block);
        }
        
+       yco -= YSPACE;
+       
+       uiDefButBitS(block, TOG, MA_VOL_USEALPHA, B_MATPRV, "Alpha",
+               X2CLM1, yco-=BUTH, BUTW2, BUTH, &(ma->vol_shadeflag), 0, 0, 0, 
0, "Generate an alpha channel (causes problems with Premul)");
+       
+       
        /*uiDefButBitS(block, TOG, MA_VOL_RECVSHADOW, B_MATPRV, "Receive 
Shadows",
                X2CLM1, yco-=BUTH, BUTW2, BUTH, &(ma->vol_shadeflag), 0, 0, 0, 
0, "Receive shadows from external objects");
        */


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to