Problem with translucence and func_train

Discussion for Level editing, modeling, programming, or any of the other technical aspects of Quake
Post Reply
Noruen
Posts: 308
Joined: Thu Jan 28, 2010 11:45 pm

Problem with translucence and func_train

Post by Noruen »

Hi guys!

I'm in serious trouble and need your help :)

1) I want to create transparent texture, where transparency is taken from alphachannel and this texture lightmap is also influenced by this alpha. I don't want such commands like GT0, LT128 and/or GE128. It creates "hard edges" of picture and I want soft gradient of transparency. And When I achieve soft transparency I can't achieve correct lightmapping of it - "not-transparent" areas are good colored, but "transparent" areas are black (doesn't have to be!). Does anybody know how to fix it? It means how to do lightmap of this texture same transparent as source image?

2) I don't know if anywhere here is the same topic, but my "func_trains" aren't moving :) I have simply cube, with originbrush in the center, linked with "path_corner"s (yes, brush and originbrush are parts of the "func_train" entity) but nothing is happening.

Thanks a LOT :)
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Re: Problem with translucence and func_train

Post by obsidian »

If you have something like a grate where some parts of the shader are transparent while other parts are not, and you want this properly lightmapped, you have to do an alpha test (alphaFunc). This tells other stages of the shader like the lightmap where areas are transparent. However, this will create hard edges as you have noticed. That's about as limited as the engine goes and there's not much you can do about it. Alpha becomes a 1-bit value.

If your transparent areas are more like glass, then you don't need to do any alpha testing and a traditional blendFunc will do. You also get to use the full 8-bit alpha.

Otherwise, you can try making the surface vertex lit only. Depending on the scenario, it might look decent. A screenshot of exactly what you are trying to do might help with giving suggestions.


Func_train tutorial:
http://www.1upclan.info/hosted/bubba-ma ... rain1.html
[size=85][url=http://gtkradiant.com]GtkRadiant[/url] | [url=http://q3map2.robotrenegade.com]Q3Map2[/url] | [url=http://q3map2.robotrenegade.com/docs/shader_manual/]Shader Manual[/url][/size]
skinNCNmaster
Posts: 344
Joined: Wed Jan 29, 2003 8:00 am

Re: Problem with translucence and func_train

Post by skinNCNmaster »

something like this scriipt will work for a gradiated transparency... that is... everything in the greyscale gets alpha'd..

Code: Select all

textures/pn03/blue-force-sheild
{
		cull disable
		qer_trans 0.5
		surfaceparm nomarks
		surfaceparm trans
		surfaceparm nonsolid
		surfaceparm noimpact
		surfaceparm nolightmap
	{
		map textures/pn03/blue-force-sheild.tga
		blendfunc add
	}
}
or this.. as a sprite..

Code: Select all

textures/pn03/blue_flare
{
	surfaceparm nolightmap
	qer_trans 0.5
	surfaceparm nomarks
	surfaceparm trans
	surfaceparm nonsolid
	deformvertexes autosprite
	cull disable
	sort 6
	{
		clampmap textures/pn03/blue_flare.tga
		blendfunc add
		tcMod rotate 30
		rgbGen wave inversesawtooth 0.5 0.5 0 0.5
	}
}
the images/textures for these are jpgs of color painted onto black. the same effect can be done on white.. but the coloration effect becomes different.. i belleive the on white works good for outdoor/sunlight applications where the on black is for trim lit areas. areas without light sources per/se

i believe the blendfunc add gets changed to subtract when working with white
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Re: Problem with translucence and func_train

Post by obsidian »

He's talking about getting lightmaps to work with transparency. You don't even have a lightmap stage.
[size=85][url=http://gtkradiant.com]GtkRadiant[/url] | [url=http://q3map2.robotrenegade.com]Q3Map2[/url] | [url=http://q3map2.robotrenegade.com/docs/shader_manual/]Shader Manual[/url][/size]
Noruen
Posts: 308
Joined: Thu Jan 28, 2010 11:45 pm

Re: Problem with translucence and func_train

Post by Noruen »

Obsidian - thanks! Look, I don't need transparent lightmap, I only want texture to be NOT black in shadow in transparent part of texture... :(

Thanks for func_train tutorial :)

NCmaster - thanks, but as said OBsidian - you have not lightmap enabled in your texture script :)
skinNCNmaster
Posts: 344
Joined: Wed Jan 29, 2003 8:00 am

Re: Problem with translucence and func_train

Post by skinNCNmaster »

noruen can you explain this furthur...

"not black in shadow in the transparent part"

like youve got a multi stage shader... projecting light.. AND allowing light to be projected onto itself? when the light hits the shader it scaled up the transparent pixel values from see through to opaque?
Noruen
Posts: 308
Joined: Thu Jan 28, 2010 11:45 pm

Re: Problem with translucence and func_train

Post by Noruen »

NCmaster - sorry, I have problem with english sentence structure :) There is screenshot:
Image

As you can see, texture is "softly" transparent (in blue area), but not influenced by lightmap (red area) and when it is, it is dark even where it should be transparent (green area).

You're right - when shadow hits my texture in transparent part, it makes texture less transparent, more opaque :)
dONKEY
Posts: 566
Joined: Mon Oct 15, 2001 7:00 am

Re: Problem with translucence and func_train

Post by dONKEY »

So it's decal?
My normal decal shader for that kind of effect uses a negative blend, here's the relevant bit:

Code: Select all

{ 
   surfaceparm trans 
   surfaceparm nomarks 
   polygonOffset 
   qer_trans 0.5 
   sort 6 
   { 
      map textures/mytexture/mytexture_decal.tga 
      blendFunc GL_ZERO GL_ONE_MINUS_SRC_COLOR 
      rgbGen identity 
   } 
}
The image I want to blend as the decal is on a white background in my 2d art application, then the whole image is inverted.
There is a decal thread here somewhere that goes through the different blend set ups you might like to try for various different results.
skinNCNmaster
Posts: 344
Joined: Wed Jan 29, 2003 8:00 am

Re: Problem with translucence and func_train

Post by skinNCNmaster »

love to see the original texture... please.. AND the script you've got setup for it..

and um/.. why are you adding a lightmap to a "marks" decal?

if its color on black background... and a decal.. try the first script i used.. theres no lightmap stage... no need... try it..

see your light is projected onto the floor...

turn off lightmap for the decal and you will still see the light and shadows on the floor beneath the decal..
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Re: Problem with translucence and func_train

Post by obsidian »

If this is indeed a decal, then read this:

http://robotrenegade.com/q3map2/docs/sh ... ricks.html
[size=85][url=http://gtkradiant.com]GtkRadiant[/url] | [url=http://q3map2.robotrenegade.com]Q3Map2[/url] | [url=http://q3map2.robotrenegade.com/docs/shader_manual/]Shader Manual[/url][/size]
Post Reply