Creating transparent textures ???

If you're looking for mapping help or you reckon you're a mapping guru, post your questions / solutions here

Moderator: Moderators

User avatar
mcunha98
Lieutenant Colonel
Posts: 384
Joined: Sat Jan 17, 2004 1:52 am
Location: Brasil
Contact:

Creating transparent textures ???

Post by mcunha98 »

People,

How i create a transparent texture (for example to use in gates/stairs) ?
Moh:aa have many transparent textures and i use, but in some cases, i need use my transparent texture.
I know, its a shader file tell to engine the transparency of texture, but i dont find a tutorial about this, some idea ????
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

tell us what image editor u have. Photoshop? Paintshop? Photopaint?
In photoshop, it was easy enough. Just make ur transparent image and save it as 32bit Targa file.
For the shader, u should try to find something similar in the original shaders and do copy/paste. Also, I recommend reading the Q3 shader manual for in depth information.
User avatar
mcunha98
Lieutenant Colonel
Posts: 384
Joined: Sat Jan 17, 2004 1:52 am
Location: Brasil
Contact:

Post by mcunha98 »

Wacko wrote:tell us what image editor u have. Photoshop? Paintshop? Photopaint?
In photoshop, it was easy enough. Just make ur transparent image and save it as 32bit Targa file.
For the shader, u should try to find something similar in the original shaders and do copy/paste. Also, I recommend reading the Q3 shader manual for in depth information.
Photoshop 7.0
Sorry, but the Q3 Shader manual i know, but it is very very complex and hard to understand.

A pratice example help more of read all tutorial
Random
Moderator
Posts: 401
Joined: Sun Jun 01, 2003 11:00 pm

Post by Random »

I doubt anyone can easily impart upon you all the knowledge you will need to understand it all in just a few short lines. May i suggest trial and error, breaking down the textures that are already done and examine those shaders as well as reading the shader bible.

You will soon have a basic enough grasp of things to get the job done.
Moderator
Image
User avatar
mcunha98
Lieutenant Colonel
Posts: 384
Joined: Sat Jan 17, 2004 1:52 am
Location: Brasil
Contact:

Post by mcunha98 »

Random wrote: May i suggest trial and error, breaking down the textures that are already done and examine those shaders as well as reading the shader bible.
Well...
Ok, but i have hope of a "big" head help me only tell "use this commands..." because the reference of shader like you tell, its a "bible" :cry:
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

mcunha98 wrote:Well...
Ok, but i have hope of a "big" head help me only tell "use this commands..." because the reference of shader like you tell, its a "bible" :cry:
Because there are different kinds of transparent textures, the best way would be to read the shader and open the targa's of an existing texture u like to do and look what's in there. What might help additionally is, that u must save ur tga's as 32-bit.
Once u've done one, read the 'bible' and look up the commands used in your shader. Or the other way round, read the 'bible' until u find a interesting command, and then try to find a shader using it
Balr14
Colonel
Posts: 450
Joined: Sat Aug 03, 2002 4:01 am
Location: Germantown, WI, USA

Post by Balr14 »

MOHAA does not support 32 bit color, so saving a texture as 32 bit tga will cause an error in the game. You have to create a 24 bit texture with an alpha channel, and save that as 32 bit for transparencies.

The simplest transparent shader is something like this, presuming your alpha channel is black where it's transparent and white where it isn't:

textures/yourfolder/texturename
{
qer_keyword masked
qer_keyword whatever you want
surfaceparm solid
surfaceparm trans
cull none
{
map textures/yourfolder/texturename.tga
depthWrite
alphaFunc GE128
nextbundle
map $lightmap
}
}
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

What about this shader

textures/common/white_volumetric
{
qer_editorimage textures/common/qer_volumetric_fade.tga
qer_keyword utility
qer_trans .4
surfaceparm nolightmap
surfaceparm nonsolid
surfaceparm trans
sort additive
cull none
{
map $whiteimage
blendFunc add
rgbGen constant .15 .15 .15
nextbundle
map textures/common/qer_volumetric_fade.tga
}
{
map textures/common/dust.tga
blendFunc add
rgbGen constant .2 .2 .2
tcMod scroll -.1 0
tcMod scale 4 4
nextbundle
map textures/common/qer_volumetric_fade.tga
}
}

The .tga's don't seem to have an alpha channel I think it is done with some kind of blend function I know rgbGen constant .2 .2 .2 sets alpha but how the blend affects it not sure .
Image
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

Balr14 wrote:...saving a texture as 32 bit tga will cause an error in the game ... and save that as 32 bit for transparencies.
No offense ment, but this sounds a bit confusing :wink:
And: In Photoshop, u don't have to create an extra alpha channel. Having transparency in ur image and saving it as 32-bit Targa is fine.
User avatar
mcunha98
Lieutenant Colonel
Posts: 384
Joined: Sat Jan 17, 2004 1:52 am
Location: Brasil
Contact:

Post by mcunha98 »

I do the obvious...
I open the misc_outside folder and get the iron_window_grate2.tga for understand the process. In your shader file i get the part of script to define transparency:textures/misc_outside/windowgrate2

Code: Select all

{
	qer_editorimage textures/misc_outside/iron_window_grate2.tga
	qer_keyword door
	qer_keyword metal
	qer_keyword masked
	surfaceparm metal
	surfaceparm fence
	surfaceparm alphashadow
	cull none
	nomipmaps
	nopicmip
	{
		map textures/misc_outside/iron_window_grate2.tga
		depthWrite
		alphaFunc GE128
	nextbundle
		map $lightmap
	}
}

But like PhotoShop open a "finally" image (TGA File) i dont know the process to make the final image (chanells, definitions of image (8/16 bits), etc...)

Exist a tutorial for i coming to final image ???? :oops:
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

mmm. in photoshop copy ur image on a new layer, delete the background layer. delete everything that shall be transparent (this makes the checked background visible). Save this as tga, choose 32bit. That'S the way I do it and it's working, even with semi transparent parts.
panTera
Brigadier General
Posts: 573
Joined: Wed Jan 29, 2003 11:46 pm
Location: The Netherlands
Contact:

Post by panTera »

User avatar
mcunha98
Lieutenant Colonel
Posts: 384
Joined: Sat Jan 17, 2004 1:52 am
Location: Brasil
Contact:

Post by mcunha98 »

Well

I read the tutorials pointed by Pantera.
Really, is most simple to understand.
But, my final image dont is transparent...

Image

Shader Code...

Code: Select all

textures/teste_natural/trans1
{
	qer_editorimage textures/teste_natural/trans1.tga
	qer_keyword masked
	surfaceparm metal
	surfaceparm fence
	surfaceparm alphashadow
	cull none
	nomipmaps
	nopicmip
	{
		map textures/teste_natural/trans1.tga
		depthWrite
		alphaFunc GE128
                nextbundle
		map $lightmap
	}
}
User avatar
mcunha98
Lieutenant Colonel
Posts: 384
Joined: Sat Jan 17, 2004 1:52 am
Location: Brasil
Contact:

Post by mcunha98 »

The photoshop result...
How tutorial indicate, i create a image in RGB with mask color of selection and export to TGA (TARGA) file with 24 bits format...

Image
panTera
Brigadier General
Posts: 573
Joined: Wed Jan 29, 2003 11:46 pm
Location: The Netherlands
Contact:

Post by panTera »

Well then you misread something. This comes straight from the tutorial:


(...) "Once this is all set up, save the file as a TGA, and select TGA in the drop down file type menu. After naming the TGA file you will get a dialogue box prompting you to select either 24 bit or 32 bit. You must select 32 bit if the alpha channel information is to be stored in the file, if you select 24 bit the alpha channel information will be lost".
Post Reply