gl_dst_alpha and 16-bit mode


(fraco) #1

hi guys,

i read in this old thread over at quake3world that gl_dst_alpha doesn’t work in 16-bit mode.

I’d really want to use it, but myself I run in 16 bit mode. Can I somehow make a shader that kinda works in both modes (like a dumbed-down shader for 16bit mode)? Any other workaround?

Why is this? Has it got to do with the fact that in 32-bit mode the is 8 bits reserved for alpha or something?

[EDIT] I posted this over at quake3world already, but noone seems to know. I know it hasn’t really strictly got much to do with q3map2, but I know you guys have answers. :clap:

thnx for any info

fraco


(ydnar) #2

Destination alpha blend modes will not work with a 16-bit framebuffer.

Try to refactor your shader to use source alpha blending. There’s usually little call for dest alpha blending in most cases.

Post your shader?

y


(fraco) #3

i don’t have the complete shader yet


textures/aztec/beam
{
	qer_editorimage	textures/fraco/beam
	surfaceparm	noimpact
	surfaceparm	nomarks
	q3map_nolightmap
	cull disable
	{
		map textures/fraco/beam
		blendfunc blend
		tcMod turb 0 0.05 0 0.04
		tcMod scroll -0.02 0.02
		alphaGen wave sin 0.7 0.3 0 0.05 
	}
	{
		map textures/fraco/beam
		blendfunc blend
		tcMod turb 0 0.07 0 0.1
		tcMod scroll 0.02 0.04
		alphaGen wave sin 0.8 0.35 25 0.06 
	}
}

the beam texture is a cloudy texture (puffs of smoke), with a similar alpha channel (the alpha is a bit darker and has more contrast). The result is like smoke going up.

Now what I really want to make is like a smoky light beam. I want to put this around a spotlight.

The first two stages make the alpha (and rgb of course) channel scroll, so i need a non-moving alpha channel, to make the left and right edges of the texture non-transparant.

This is the alpha channel I want to add:

another way to explain what i want to do
define

out = output for shader
in=background, what is seen through the shader
t1,a1=rgb and alpha of the first stage, moving clouds
t2,a2 = rgb and alpha of second stage, clouds moving other way
a3 = the extra alpha channel i want to add

what my shader does up till now:
out=in*(1-a1)(1-a2)+t1a1*(1-a2)+t2*a2

what i actually intend:
out = in*(1-a1a2a3)+t1a1(1-a2)a3+t2a2*a3

[EDIT] fixed this expression

or something alike, that defines the final transparancy as a blend between that extra image and the two other moving alphas.

this making sense?

I’ve been thinking and trying some based on the example i linked to in the previous post. I thought that destination blending might allow me to at least create that first factor (1-a1a2a3). But now I’m completely confused.

any help welcome

thnx

fraco


(fraco) #4

sorry :bump:

after the effort of trying to explain my problem, I was hoping for some form of answer :smiley:

You can for instance tell me that I am too stoopid to do mapping and that i should apply myself to origami.

fraco

P.S. origami, i was told, is not so easy either. Might be a challenge…