Alpha channel in character texture, how?

Post anything to do with editing Nexuiz here. Whether its problems you've had, questions, or if you just want to show off your work.

Moderators: Nexuiz Moderators, Moderators

Alpha channel in character texture, how?

Postby ihsan » Wed Jan 14, 2009 3:50 pm

I'm trying to make some human models but i have 2 questions:
1. How do i use an alpha channel in the texture (for glasses and hair) :?:
2. What is the best way to package the models; do I replace existing ones or give them unique filenames :?:
ihsan
Alien trapper
 
Posts: 305
Joined: Fri Mar 03, 2006 3:33 pm
Location: Trinidad (Where Obama met Chavez)

Postby ai » Wed Jan 14, 2009 4:09 pm

1. If you use .tga just be sure to save it as a 32 bit file. Then any transparency will become the alpha. But be sure to save it correctly, certain applications (even Photoshop CS3 doesn't save correctly though there is an option for that).
If you use .png then you're set, just save normally and it should work.
Alternatively you can create a shader and define that it should use the alpha there.

2. It depends on what you want to do. If you create a model that is supposed to replace, for instance, the marine, then sure go ahead and do it. But for testing purposes until it's finished I suppose it's recommended to save a copy. You can then type this in the console: "playermodel models/player/yourPlayerModel.zym" (or whatever the path is to your model).
You can also create skin files, or copy the existing ones to define where the texture is and such, these needs IIRC in the same folder as the player model file (i.e. the zym etc.).
ai
Forum addon
 
Posts: 2131
Joined: Sun Mar 05, 2006 3:54 pm
Location: Behind you

Postby ihsan » Wed Jan 14, 2009 4:44 pm

ai wrote:1. If you use .tga just be sure to save it as a 32 bit file. Then any transparency will become the alpha. But be sure to save it correctly, certain applications (even Photoshop CS3 doesn't save correctly though there is an option for that).
If you use .png then you're set, just save normally and it should work.
Alternatively you can create a shader and define that it should use the alpha there.


I just tried PNG texture and TGA from Gimp but neither seemed to work.
PNG texture isn't used at all, even if i force it in the zym

I remember getting alpha to work in a shader once before but i don't know how to do alpha+bump+glow+shirt+pants. Please help.
ihsan
Alien trapper
 
Posts: 305
Joined: Fri Mar 03, 2006 3:33 pm
Location: Trinidad (Where Obama met Chavez)

Postby ai » Wed Jan 14, 2009 5:25 pm

Try this little app, it does work and I've used it myself and I know a few others who has as well. This app converts to alpha, just drag and drop the texture files here (there's a short description of this as well when you open it).
http://ai.planetnexuiz.de/Applications/AlphaConv.zip

The code for alpha in shaders is just 'blendfunc blend' there's a few more options like 'add' etc. These can all be found here:
http://www.heppler.com/shader/

Code: Select all
tagName (that the model file has defined)
{
   cull none (ignore this, you may as well want to remove this line altogether. Just makes sure faces are visible at both sides even if the normals are negative.)
   {
      map pathToTexture.tga
      blendfunc blend
   }
}


To use glow, glow, shirt etc. just name these files exactly the same as the texture the model is using, then add '_glow', '_norm', '_gloss', '_bump' and place these together with the texture file.
I.e. If you have a texture named 'brandy.tga' then the normal and glow should be named 'brandy_glow.tga' and 'brandy_norm.tga'. Nexuiz will automatically take these into account and perform the operations, nothing you need to do on your end, convenient. With other words, you do not need to specify these files in the shader or anyplace else. Just create the bumps and glows etc, put an _glow etc. after the texture name and place these in the same folder as the textures and done.
ai
Forum addon
 
Posts: 2131
Joined: Sun Mar 05, 2006 3:54 pm
Location: Behind you


Return to Nexuiz - Editing

Who is online

Users browsing this forum: No registered users and 1 guest

cron