Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Bobboau on October 16, 2002, 09:48:11 pm

Title: ambient lighting and transparency in textures
Post by: Bobboau on October 16, 2002, 09:48:11 pm
well I've got code that can give any ship texture nonlit ambient glow or transparency
unfortunately I don't have any way to set the level of glow and the transparency value seems to be filtered after the poly is lit, wich means this would probly only be good for a cloaking device or some specal thing like that.

add these two guys to the polymodel struct in model.h
Code: [Select]

int ambient[MAX_MODEL_TEXTURES]; // ambient light-Bobboau
int transparent[MAX_MODEL_TEXTURES]; // flag this texture as being a transparent blend-Bobboau



in the part of read_model_file in modelread.cpp in the section that deals with the TXTR chunk add
Code: [Select]

pm->transparent[i]=0; //it's transparent
pm->ambient[i]=0; //ambient glow

wich is just above
Code: [Select]

[i]note this is only here if you've got my animated texture thing[/i] pm->is_ani[i]=0; //animated textures
if ( strstr(tmp_name, "thruster") || strstr(tmp_name, "invisible") || strstr(tmp_name, "warpmap") ) { //added warp map for subspace rift rendering-Bobboau
// Don't load textures for thruster animations or invisible textures
pm->textures[i] = -1;
} else {


and just below that add this
Code: [Select]

if(strstr(tmp_name, "trans")){
pm->transparent[i]=1;
nprintf(("%s is transparent, oooow\n",tmp_name));
}
if(strstr(tmp_name, "amb")){
pm->ambient[i]=1;
nprintf(("%s is amient, aaaahhh\n",tmp_name));
}

as you can see the code looks for the string "trans" within the name of the texture as a flag that it is transparent and "amb" if it is ambient

in modelinterp.cpp in model_interp_tmappoly were it says
Code: [Select]

if(Interp_flags & MR_ALL_XPARENT){
gr_set_bitmap( texture, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, Interp_xparent_alpha );
} else {

gr_set_bitmap( texture );

}


replace with
Code: [Select]

if(Interp_flags & MR_ALL_XPARENT){
gr_set_bitmap( texture, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, Interp_xparent_alpha );
} else {
if(pm->transparent[w(p+40)]){ //trying to get transperent textures-Bobboau
gr_set_bitmap( texture, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, 0.8f );
}else{
gr_set_bitmap( texture );
}
}

Title: ambient lighting and transparency in textures
Post by: Bobboau on October 16, 2002, 09:52:38 pm
keep in mind that anything with in it is getting screwed by the italic tag
Title: ambient lighting and transparency in textures
Post by: Nico on October 17, 2002, 04:59:25 am
pics please!
Title: ambient lighting and transparency in textures
Post by: LAW ENFORCER on October 17, 2002, 05:02:18 am
You alsway ask for pics!
I want to ask for pics for a change!

pics please!