row.prop(mat, "transparency_method", expand=True)
split = layout.split()
+ split.active = base_mat.use_transparency
col = split.column()
col.prop(mat, "alpha")
row = col.row()
- row.active = base_mat.use_transparency and (not mat.use_shadeless)
+ row.active = (base_mat.transparency_method != 'MASK') and (not mat.use_shadeless)
row.prop(mat, "specular_alpha", text="Specular")
col = split.column()
* and keep comment above the defines.
* Use STRINGIFY() rather then defining with quotes */
#define BLENDER_VERSION 256
-#define BLENDER_SUBVERSION 2
+#define BLENDER_SUBVERSION 3
#define BLENDER_MINVERSION 250
#define BLENDER_MINSUBVERSION 0
}
}
+ if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile <3)){
+
+ Material *mat;
+ int tex_nr, transp_tex;
+
+ for(mat = main->mat.first; mat; mat = mat->id.next){
+ if(!(mat->mode & MA_TRANSP) && !(mat->material_type & MA_TYPE_VOLUME)){
+
+ transp_tex= 0;
+
+ for(tex_nr=0; tex_nr<MAX_MTEX; tex_nr++){
+ if(!mat->mtex[tex_nr]) continue;
+ if(mat->mtex[tex_nr]->mapto & MAP_ALPHA) transp_tex= 1;
+ }
+
+ if(mat->alpha < 1.0f || mat->fresnel_tra > 0.0f || transp_tex){
+ mat->mode |= MA_TRANSP;
+ mat->mode &= ~(MA_ZTRANSP|MA_RAYTRANSP);
+ }
+ }
+ }
+ }
+
/* put compatibility code here until next subversion bump */
{
{MA_TYPE_HALO, "HALO", 0, "Halo", "Render object as halo particles"},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem transparency_items[] = {
+ {0, "MASK", 0, "Mask", "Mask the background"},
{MA_ZTRANSP, "Z_TRANSPARENCY", 0, "Z Transparency", "Use alpha buffer for transparent faces"},
{MA_RAYTRANSP, "RAYTRACE", 0, "Raytrace", "Use raytracing for transparent refraction rendering"},
{0, NULL, 0, NULL, NULL}};
/* test for 100% transparant */
ok= 1;
- if(ma->alpha==0.0f && ma->spectra==0.0f && ma->filter==0.0f) {
+ if(ma->alpha==0.0f && ma->spectra==0.0f && ma->filter==0.0f && (ma->mode & MA_TRANSP)) {
ok= 0;
/* texture on transparency? */
for(a=0; a<MAX_MTEX; a++) {
if(depth>0) {
float fr, fg, fb, f, f1;
- if((shi.mat->mode_l & MA_TRANSP) && shr.alpha < 1.0f) {
+ if((shi.mat->mode_l & MA_TRANSP) && shr.alpha < 1.0f && (shi.mat->mode_l & (MA_ZTRANSP | MA_RAYTRANSP))) {
float nf, f, refract[3], tracol[4];
tracol[0]= shi.r;
if(ma->fresnel_tra!=0.0f)
shi->alpha*= fresnel_fac(shi->view, shi->vn, ma->fresnel_tra_i, ma->fresnel_tra);
-
+
+ if (!(shi->mode & MA_TRANSP)) shi->alpha= 1.0f;
+
shr->diff[0]= shi->r;
shr->diff[1]= shi->g;
shr->diff[2]= shi->b;
accum = 1.0f - shaded;
}}
- shr->alpha= (shi->mat->alpha)*(accum);
+ shr->alpha= (shi->alpha)*(accum);
}
else {
/* If "fully shaded", use full alpha even on areas that have no lights */
memset(shr, 0, sizeof(ShadeResult));
+ if(!(shi->mode & MA_TRANSP)) shi->alpha = 1.0f;
+
/* separate loop */
if(ma->mode & MA_ONLYSHADOW) {
shade_lamp_loop_only_shadow(shi, shr);
shi->g= shi->vcol[1];
shi->b= shi->vcol[2];
if(ma->mode & (MA_FACETEXTURE_ALPHA))
- shi->alpha= shi->vcol[3];
+ shi->alpha= (shi->mode & MA_TRANSP) ? shi->vcol[3] : 1.0f;
}
- if(ma->texco)
+ if(ma->texco){
do_material_tex(shi);
+ if (!(shi->mode & MA_TRANSP)) shi->alpha = 1.0f;
+ }
shr->col[0]= shi->r*shi->alpha;
shr->col[1]= shi->g*shi->alpha;
/* alpha in end, spec can influence it */
if(passflag & (SCE_PASS_COMBINED)) {
- if(ma->fresnel_tra!=0.0f)
+ if((ma->fresnel_tra!=0.0f) && (shi->mode & MA_TRANSP))
shi->alpha*= fresnel_fac(shi->view, shi->vn, ma->fresnel_tra_i, ma->fresnel_tra);
/* note: shi->mode! */
- if(shi->mode & MA_TRANSP) {
+ if(shi->mode & MA_TRANSP && (shi->mode & (MA_ZTRANSP|MA_RAYTRANSP))) {
if(shi->spectra!=0.0f) {
float t = MAX3(shr->spec[0], shr->spec[1], shr->spec[2]);
t *= shi->spectra;
shr->combined[0] *= obcol[0];
shr->combined[1] *= obcol[1];
shr->combined[2] *= obcol[2];
- shr->alpha *= obcol[3];
+ if (shi->mode & MA_TRANSP) shr->alpha *= obcol[3];
}
}