* 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.
This commit is contained in:
@@ -359,6 +359,7 @@ typedef struct Material {
|
||||
#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
|
||||
|
||||
@@ -656,8 +656,12 @@ void volume_trace(struct ShadeInput *shi, struct ShadeResult *shr)
|
||||
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 @@ void volume_trace(struct ShadeInput *shi, struct ShadeResult *shr)
|
||||
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];
|
||||
|
||||
|
||||
@@ -4447,6 +4447,12 @@ static void material_panel_material_volume(Material *ma)
|
||||
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");
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user