Transparency + Lightmap issues


(Pande) #1

Ok, so I got a problem now where I have a tire tread overlay for my terrain.

I wanted black in it also, so .jpg was out of the question for blending.

So I made my .tga with appropriate alpha. Then, I throw it in a shader like this:

textures/el_daba/car_streak
{
qer_editorImage textures/el_daba/car_sreak
surfaceparm gravelsteps
q3map_shadeangle 120
surfaceparm landmine
surfaceparm alphashadow
surfaceparm trans
{
map textures/el_daba/car_streak
blendfunc blend
}
{
map $lightmap
blendFunc GL_DST_COLOR GL_ZERO
}
}

Which works ok for blending (opaque pixels included) BUT! Anywhere that shadow touches it, the alpha areas become black (depending on strength of shadow). Also if player walks over it, same thing.

So… I took a look at some decal shaders in W:ET (though what I’m doing is actually a raised 0.125, for stopping z-fighting with player shadow) because of the alphas they used… and I saw a really odd kind of shader so I tried it also:

textures/el_daba/car_streak
{
surfaceparm gravelsteps
q3map_shadeangle 120
surfaceparm alphashadow
surfaceparm trans
surfaceparm landmine
implicitMask -
}

Works, and no shadow errors, BUT: its as if I’m using AlphaFunc GE128; its an all or nothing test for alpha pixel values. So its really ugly, yuck!
Not to mention I have no control over lighting: attempting to add a new lightmap stage to it results in white areas over the alpha. So I’m stuck with default shader lighting.

So… now I wanna know: how can I get a transparent image to work like the decals used in base ET, AND not throw those ugly shadow errors?

Any help appreciated, thanks in advance.


Also I have another problem, may as well post here about it:

I’m making sand storm effects for my map, but I’m doing it all in Radiant since W:ET doesn’t support custom effect files. :eek: So, after tons of bug testing I’m now here:

textures/el_daba/dust3
{
qer_editorimage textures/el_daba/dust3
surfaceparm trans
surfaceparm nonsolid
surfaceparm opaque
surfaceparm detail
q3map_nofog
q3map_nolightmap
q3map_nonplanar
cull twosided
{
map textures/el_daba/black.tga
blendfunc GL_ONE GL_ONE
}
{
clampmap textures/el_daba/dust3.tga
blendFunc blend
alphaGen vertex
tcMod rotate -16
}
}

so there are 2 problems. 1, the second image stage doesn’t seem to be responding to alpha volume brushes. :frowning:

2, the clampmap KINDA works… it seems to sort of stop repeat sometimes but then I get these weird lines like below (edges of cloud):

The actual .tga is 100% alpha on its edges, so I shouldn’t be seeing any edges to this cloud.

Btw, if anyone is wondering about the black image and GL_ONE GL_ONE, thats just to make sure that the second stage is blending onto something, otherwise I get an error. And for some odd reason, rendering a $whiteimage and then rgbGen const ( 0 0 0 )'ing it + GL_ONE GL_ONE doesn’t work. (goes solid white behind cloud)

So, thanks in advanced as usual for any light you guys can shed on these quality errors.


(IndyJones) #2

are u playing in 16-bit mode?


(Berzerkr) #3

Maybe if you add the following to the shader:

nocompress
nomipmaps
nopicmip


(Pande) #4

Hmm nope the compressions just made it grainy on distance as usual, and didn’t do anything to my alpha problems.

Also, no not 16 bit mode. I play on full settings on BaseET


(ailmanki) #5
{ // Q3Map2 defaulted (implicitMask)
"
	cull none
	{
		map %s
		alphaFunc GE128	
		depthWrite
	}
	{
		map $lightmap
		rgbGen identity
		depthFunc equal
	}

	q3map_styleMarker
	{
		map %s
		blendFunc GL_DST_COLOR GL_ZERO
		depthFunc equal
		rgbGen identity
	}
}

This is probably more or less what q3map2 made with your implicitmap statement. This is actually copy/paste from q3map2 source, slightly modified for easier reading… %s I got to suppose will be the name of the texture referenced.

I have almost no idea what the q3map_stylemarker does there, I suppose it will be used if you define a light style, like strob effect…
So this shader does indeed use GE128, but maybe I copied the wrong code, there are some choices if you use implicitmap, but this was the only which has a GE128 in it. So makes sense to me.

About the dust problem, it would help if you can provide a map file with only this stuff in it.
Anyway, few ideas to check:

  • what does r_showtris 1 show? (in the upper left, is that sharp edge, I suppose the tris does not end there. But might be.

  • What happens if you do only show the black image? Is it drawn where it should be? as the next stage is a overlay on to it, if I correctly understood.

  • if you want it to react on alpha volumes, you need to define a alphamod afaik.

  • ‘surfaceparm opaque’ does not exist, and if, in conjunction with surfaceparm trans . .it wouldn’t make any sense?


(Pande) #6

dust is fixed, was just a problem with func_rotate entiity it turned out. :o

"This is probably more or less what q3map2 made with your implicitmap statement. This is actually copy/paste from q3map2 source, slightly modified for easier reading… %s I got to suppose will be the name of the texture referenced.

I have almost no idea what the q3map_stylemarker does there, I suppose it will be used if you define a light style, like strob effect…
So this shader does indeed use GE128, but maybe I copied the wrong code, there are some choices if you use implicitmap, but this was the only which has a GE128 in it. So makes sense to me."

What are you saying there? :o


(ailmanki) #7

[QUOTE=Pande;192399]…so I tried it also:

textures/el_daba/car_streak
{
surfaceparm gravelsteps
q3map_shadeangle 120
surfaceparm alphashadow
surfaceparm trans
surfaceparm landmine
implicitMask -
}

Works, and no shadow errors, BUT: its as if I’m using AlphaFunc GE128; its an all or nothing test for alpha pixel values. So its really ugly, yuck![/QUOTE]
Well u used there implicitmask, and that resulted in alphafunc ge128. The above shader I posted, would be more or less what it does if you use implictmask.


(Pande) #8

are the depthfunc 's what are solving it then? Anyway, where’d that shader come from?


(ailmanki) #9

from q3map2 sourcecode. No Idea if its cause of depthfunc, might be…


(Pande) #10

textures/el_daba/car_streak
{
qer_editorImage textures/el_daba/car_sreak
surfaceparm gravelsteps
q3map_shadeangle 120
surfaceparm landmine
surfaceparm alphashadow
surfaceparm trans
{
map $whiteimage
rgbGen const ( 0 0 0 )
alphaFunc GE128
depthWrite
}
{
map $lightmap
rgbGen identity
depthFunc equal
}
{
map textures/el_daba/car_streak.tga
blendFunc GL_DST_COLOR GL_ZERO
depthFunc equal
rgbGen identity
}
}

testing this now… w/ and w/o depthfuncs.