Jump to content

Transparent shader acting oddly


Recommended Posts

Posted

I set up my skin with some textures with alpha applied in areas along with a shader so the parts aren't visible ingame. It works, only the textures that have this shader also show other things in the map through them.

 

The skin has alpha and the shader on the head and legs to hide some parts (which works) but it also makes other shaders in the map (and players too I think) visible through it:

 

alpha.png?dl=0

 

 

The shader:

models/players/mara_khaal/head
{
	{
		map models/players/mara_khaal/head
		blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
		rgbGen lightingDiffuse
	}
}

models/players/mara_khaal/legs
{
	{
		map models/players/mara_khaal/legs
		blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
		rgbGen lightingDiffuse
	}
}

Before, I was using blendFunc GL_ONE GL_ZERO (same as no blendFunc) and alphaFunc GE128, which worked fine, but Xycaleth said it wasn't good for performance

Posted

You need depthWrite, but I don't think that works quite properly without an alphaFunc? It's been a while, consult the shader manual.

Posted

Yep, that worked, didn't seem to need an alphaGen. However, the legs have gone a bit weird, the back of the boot shafts are completely transparent:

 

 

legalpha.png?dl=0

 

models/players/mara_khaal/boots
{
	{
		map models/players/mara_khaal/boots
		blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
		rgbGen lightingDiffuse
		depthWrite
	}
}

models/players/mara_khaal/legs
{
	{
		map models/players/mara_khaal/legs
		blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
		rgbGen lightingDiffuse
		depthWrite
	}
}

I think it has something to do with the fact that I used 2 textures for the legs: One for the 'skin' and boots' foot part (legs.png), the other for the boot boot shaft (boots.png).

Posted

yes, i know the issue.

instead of

blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA

 

use

 

alphaFunc GE128

rgbGen lightingDiffuse
depthWrite

 

this is good for raster surfaces, GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA is good for glasses.

Posted

That fixed my problem when i added it to the legs stage, thanks!

Any time :)

I learn that in a fight with leaves of my plants and some old flags with holes. XD

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...