Jump to content

Texture Transparency Help


Recommended Posts

I want to make some decal textures of numbers in the Aural Besh (sp) font, which i have, but, I'm confused on the transparency part. I know one layer will be my image, but how do i set up the background layer that isn't drawn? . I posted a decal shader since this is what I'm using as a base for the decal.

textures/decals/mp_imperial_symbol
{
	qer_editorimage	textures/decals/mp_imperial_symbol
	polygonOffset
	q3map_nolightmap
    {
        map textures/decals/mp_imperial_symbol
        alphaFunc GE128
        blendFunc GL_DST_COLOR GL_SRC_COLOR
    }
}
Link to comment

Can you explain more about this "background layer that isn't drawn?" If it isn't drawn, what function will it perform? As that base decal shader demonstrates, you can have a transparent decal with only one shader pass. You don't need another "background" pass unless it will serve some other purpose.

 

Also, for the blendFunc, I would recommend GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA, instead of the one in that example. It's the one I use for pretty much all my transparency.

Link to comment

Can you explain more about this "background layer that isn't drawn?" If it isn't drawn, what function will it perform? As that base decal shader demonstrates, you can have a transparent decal with only one shader pass. You don't need another "background" pass unless it will serve some other purpose.

 

Also, for the blendFunc, I would recommend GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA, instead of the one in that example. It's the one I use for pretty much all my transparency.

 

Not really, no.  :lol:

I make an image of the the number 4 on a white background. I make it a .jpg, toss it in the right directory, and there it is for me to add to my map. Problem is there is white behind the 4. In a decal, its just the 4 with no background. So, how does the background get removed? How does it become transparent? What do i need to do to the image to make it transparent. 

Link to comment

Alternately, if you don't want to use an alpha channel, you could make that background gray instead of white (perfect gray, with exactly 50 value), and use the blendfunc used in the original example you posted. This blendfunc blends the colors with those behind it in a specific way, and all perfect gray values become essentially transparent.

 

The advantage is that you can create a kind of transparency using a .jpg, which are smaller than .tga or .png. The disadvantage is that the colors of the decal itself will also blend with the colors behind it, making details visible from the texture it's placed on. If you don't want details visible from the texture underneath, you'll have to use an alpha channel.

Link to comment

Alternately, if you don't want to use an alpha channel, you could make that background gray instead of white (perfect gray, with exactly 50 value), and use the blendfunc used in the original example you posted. This blendfunc blends the colors with those behind it in a specific way, and all perfect gray values become essentially transparent.

 

The advantage is that you can create a kind of transparency using a .jpg, which are smaller than .tga or .png. The disadvantage is that the colors of the decal itself will also blend with the colors behind it, making details visible from the texture it's placed on. If you don't want details visible from the texture underneath, you'll have to use an alpha channel.

 

I like the idea of the details from the texture showing through, especially for painted number decals.

 

Ill try both methods and see what's what.

 

Thanks.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...