Wierder problems with alpha...


(Pande) #1


So ya… what on earth is going on there?

THIS time, using Socks images work find but replacing with my own (and JUST replacing, no shader changes) results in the above.

If anyone has answers, that would be hot.

Oh, and the sand is the secondary layer.


(ailmanki) #2

Well if you have everything setup correctly,
you should have 2 shaders, which share the same blend.
k,
Then the blend on it, has to be in a specific range of alpha values.
That means, it can be between 0-255, but the actuall transition
(at least if you do use socks example shader, which AFAIk has a alpha_func ge128 or something like that),
has to be at 128, with the tool GIMP you can check that. That means if u do filter the all the values below alpha 128, you get the nice effecrt in socks example, yet if that is not the case, you can get various results - but not what you wanted there…

I guess the term is ‘Threshold Alpha’ for photoshop, with that you can like preview what will happen with ge128…

Well maybe it has another reason, but I guess its that.


(Pande) #3

Seperate test map and corresponding radiant shot:

For those using different poles: white = 0%, blue = 25%, red = 50%, green = 75%, purple = 100%

heh, ailmanki we posted at same time.

anyway, I have got other ones working fine with just one shader. Basically, telling secondary to appear where 100% is used. It doesn’t need more than one terrain to work. But this I guess is a problem with my image?

Offtopic… do .png not work in ET? Letdown… if they do, someone explain how to make them work please. :slight_smile: thanks.


(th0rn3) #4

You need an alpha channel for textures http://www.simonoc.com/pages/articles/terrain1_7.htm


(Pande) #5

lol, I know I have one. otherwise it wouldn’t work at all.


(IndyJones) #6

et supports jpg/tga only.


(carnage) #7

Post shader please


(DerSaidin) #8

As carnage said, need shader to work it out.

My guess is it’ll be
alphaFunc GE128
Or a similar alphaFunc.
That line means if the alpha is Greater than or Equal to 128 (out of 255), then blend. If not, then zero.
That only works ok if you have a alpha channel on the upper texture that adds some detail to the texture, otherwise it will result in hard lines - like yours.


(Pande) #9
textures/el_daba/1street_sand
{
        qer_editorimage textures/desert_sd/pavement_quad_sandy
	q3map_nonplanar
	q3map_shadeangle 120
	q3map_tcGen ivector ( 256 0 0 ) ( 0 256 0 )
	q3map_alphaMod dotproduct2 ( 0.0 0.0 0.75 )
	{
		map textures/desert_sd/pavement_quad_sandy.tga	// Primary
		rgbGen identity
	}
	{
		map textures/el_daba_alpha_terrains/sand_tga.tga	// Secondary
		blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
		alphaFunc GE128
		rgbGen identity
		alphaGen vertex
	}
	{
		map $lightmap
		blendFunc GL_DST_COLOR GL_ZERO
		rgbGen identity
	}
}



(DerSaidin) #10

Yeah, try removing the
alphaFunc GE128

Also you don’t need the
q3map_alphaMod dotproduct2
if your using brush volumes.


(carnage) #11

[QUOTE=Der’saidin;190781]Yeah, try removing the
alphaFunc GE128

Also you don’t need the
q3map_alphaMod dotproduct2
if your using brush volumes.[/QUOTE]

Ah yes as suspected. You see the command GE128 means that the pixel will only render if the alpha value is greater than 128 (witch is basialy over half alpha of the posible 256)

So you are getting a blend from 129 to 256 alpha values than anyhting bellow is just cut of witch is giving you that sharp edge

And as pointed out by Der’saidin its a common misconception that you you are doing is using the dot2product blend method. You are infact blending with alpha brush volumes, dot2product is a method of automaticaly generating vertex alpha values based on the direction of there normal vector (quite usefulfor terain when you want different textures to apear on slopes etc, not too good for this kind of preciced blending)


(S14Y3R) #12

Hm, so does he need to rework his alpha channels to get it working properly? Or is it just not possible on a flat surface?

interesting.


(DerSaidin) #13

If he removes the dotproduct bit from the shader, then any alpha blending done by it won’t happen. That alpha blending would have to be redone (with brush volumes). But looking at the screenshots, I doubt the dotproduct is having much effect.

dotproduct blending is possible on a flat surface… but to little/no effect.

The main issue, the hard lines of alpha, should be fixed by removing the GE128 line.


(ailmanki) #14

well removing the ge128 might be a way…
but the sharp edges can be nice …

And in simonoc’s example, there are sharp edges.


(Pande) #15

Ok so now just a general question, not as much a problem I don’t think.

Is there a shader line to tell the secondary texture not to appear when not specified with alpha volume brushes? The areas where the primary tex appears are where I placed a 0% brush, and where its solid and fades down I placed 100%, a few 75%, and the occasional 50%. But anyway to NOT have to put 0% everywhere else?

Thanks. :slight_smile:


(DerSaidin) #16

Swap the layers. Then 100% is 0%.


(Pande) #17

I COULD do that if it were my own texture for the base, but I’m using SD’s sandy quad pavement texture so I can’t edit it to make it .tga. Also, that wouldn’t fix the problem I don’t think because then I would still end up with the half mix where ever I didn’t use any poles.

edit: Instead, I just made a new shader for the SD image with the same ivector line, and used that wherever I don’t want poles. :slight_smile: Much easier to see things. :slight_smile: