texture gradient transparency


(stealth6) #1

I’m trying to make a texture that consists of multiple layers and is half transparent.
Here are my results so far:

There are 3 layers with bars that are moving at different speeds and on top of that is a layer that should slowly make them transparent. But at the moment it just makes half the texture white.
So the question is how do I make the bars slowly disappear as they move upwards?

shader:


textures/stealth4/cyanbarvert
{
	cull none
	noPicmip 
	surfaceparm trans 
	deformVertexes wave 160 sin 0 3 0 0.3
	q3map_tessSize 384
	{
		map textures/stealth4/23bar1.tga
		blendFunc GL_SRC_ALPHA GL_ONE
		rgbGen const ( 0.0 0.78 1.0 )
		tcmod scale 1 1
		tcMod scroll 0 0.3
	}
	{
		map textures/stealth4/23bar2.tga
		blendFunc GL_SRC_ALPHA GL_ONE
		rgbGen const ( 0.0 0.78 1.0 )
		tcmod scale 1 1
		tcMod scroll 0 0.2
	} 
	{
		map textures/stealth4/23bar3.tga
		blendFunc GL_SRC_ALPHA GL_ONE
		//rgbgen wave sin 0.5 1 0 0.2
		rgbGen const ( 0.0 0.78 1.0 )
		tcmod scale 1 1
		tcMod scroll 0 0.4
	}
	{
		map textures/stealth4/trans1.tga
		blendFunc GL_SRC_ALPHA GL_ONE
		//rgbgen wave sin 0.5 1 0 0.2
	} 
}

EDIT: attached the files so anybody who’s interested can play around with it.


(Detoeni) #2

ello,
I’m a bit rusty at this, but at a glance your taking your source and adding to it “blendFunc GL_SRC_ALPHA GL_ONE”
for the effect your after i think you should be using a filter.


(stealth6) #3

Well I tried filter, but that didn’t work. So I opened up the Q3 shader manual and tried pretty much every type of blendFunc :smiley:
Nothing worked. Then I noticed AlphaGen so I tried that and it worked for 1 layer, but as soon as there are more layers involved the timing seemed to be wrong and I couldn’t figure out what the exact problem was.

Then while googling depthFunc and depthWrite I stumbled upon this topic:
http://www.quake3world.com/forum/viewtopic.php?f=10&t=37504
and that was the solution. I added alphaGen vertex and then an alpha brush and it works.

shader:


textures/stealth4/cyanbarvert
{
	cull none
	noPicmip 
	surfaceparm trans 
	deformVertexes wave 160 sin 0 3 0 0.3
	q3map_tessSize 384
	{
		map textures/stealth4/23bar1.tga
		blendFunc GL_SRC_ALPHA GL_ONE
		rgbGen const ( 0.0 0.78 1.0 )
		tcmod scale 1 1
		tcMod scroll 0 0.25
		alphaGen vertex
	}
	{
	    map textures/stealth4/23bar2.tga
		blendFunc GL_SRC_ALPHA GL_ONE
		rgbGen const ( 0.0 0.78 1.0 )
		tcmod scale 1 1
		tcMod scroll 0 0.4
		alphaGen vertex
	} 
	{
		map textures/stealth4/23bar3.tga
		blendFunc GL_SRC_ALPHA GL_ONE
		rgbGen const ( 0.0 0.78 1.0 )
		tcmod scale 1 1
		tcMod scroll 0 0.3
		alphaGen vertex
	}
}

Effect:
[video=youtube_share;Er8ScXm9wfQ]http://youtu.be/Er8ScXm9wfQ[/video]


(Mateos) #4

I guess the thingys moving are the 23barx.tga? I/You may try this with leaves :slight_smile: Could be a good combo with wind sound effect!


(stealth6) #5

Well I gave it a shot, but didn’t turn out too well. Here is the shader:


textures/stealth4/fallingleaf
{
	cull none
	noPicmip 
	surfaceparm trans 
	deformVertexes autosprite2
	deformVertexes move 1 1 0 sin 0 32 0 0.2
	{
		map textures/stealth4/leaf.tga
		blendFunc blend
		tcmod scale 1 1
		tcMod scroll 0 -0.25
		alphaFunc GE128
		depthWrite
		alphaGen vertex
	}
	{
		map $lightmap
		blendFunc filter
		depthFunc equal
		rgbGen identity
		alphaGen vertex
	}
}

Makes the leaf rock from side to side + move down + autosprite + lightmap but I didn’t like it very much, but it’s a start I guess for anybody who is. I think using both autosprite and deformVertexes move was messing it up a bit.

Here’s a video of the result. I used the same method as previously mentioned to make the leaf fade, but it didn’t seem to work at all bleh.
[video=youtube_share;Jov-umvbnPo]http://youtu.be/Jov-umvbnPo[/video]


(ailmanki) #6

try this, although I think q3 and et shaders are not fully compatible… should be usefull.
http://www.quake3world.com/forum/viewtopic.php?f=10&t=37893&st=0&sk=t&sd=a&hilit=particle+studio


(Mateos) #7

Ah, I was thinking about them on the ground, not in air: there’s a tut for this effect already, let me check my bookmarks :slight_smile: But, still, lot of magic to find and learn about Q3 shaders…

(Will edit)

Edit:
Found it, but less sophisticated, and so less candy than yours, but here’s the link (with other effects):
http://pazurmapping.com/shaders.htm


(stealth6) #8

[QUOTE=Mateos;407266]Ah, I was thinking about them on the ground, not in air: there’s a tut for this effect already, let me check my bookmarks :slight_smile: But, still, lot of magic to find and learn about Q3 shaders…

(Will edit)

Edit:
Found it, but less sophisticated, and so less candy than yours, but here’s the link (with other effects):
http://pazurmapping.com/shaders.htm[/QUOTE]

Yea, seen something similar to that before. interesting using the smoke entity like that.


(Mateos) #9

The difference, compared to your shader, is that the trajectory is vertical, and so only Z-Axis related; Yours is more interesting because you can use the 3 axis, it allows more combinations and something more natural :slight_smile: