Author Topic: ambient lighting and transparency in textures  (Read 2263 times)

0 Members and 1 Guest are viewing this topic.

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
ambient lighting and transparency in textures
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 );
}
}

« Last Edit: October 16, 2002, 09:51:24 pm by 57 »
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
ambient lighting and transparency in textures
keep in mind that anything with in it is getting screwed by the italic tag
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline Nico

  • Venom
    Parlez-vous Model Magician?
  • 212
ambient lighting and transparency in textures
pics please!
SCREW CANON!

 

Offline LAW ENFORCER

  • Turret Fiend
  • 210
    • http://www.armouredstar.com
ambient lighting and transparency in textures
You alsway ask for pics!
I want to ask for pics for a change!

pics please!
Conflict GRDLA:
Operation Return To Riker
www.ARMOUREDSTAR.com - the latest site is not finished yet!
[What we have here is the source to the Freespace ENGINE, not the Freespace GAME. By allowing the ENGINE to support all kinds of cool stuff, we're allowing the creation of all new GAMES] - TurboNed