Quake3World.com
https://www.quake3world.com/forum/

Problem with translucence and func_train
https://www.quake3world.com/forum/viewtopic.php?f=10&t=43467
Page 1 of 1

Author:  Noruen [ 04-23-2010 12:13 AM ]
Post subject:  Problem with translucence and func_train

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 :)

Author:  obsidian [ 04-23-2010 06:55 AM ]
Post subject:  Re: Problem with translucence and func_train

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

Author:  skinNCNmaster [ 04-23-2010 07:07 AM ]
Post subject:  Re: Problem with translucence and func_train

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

Code:
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:
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

Author:  obsidian [ 04-23-2010 07:29 AM ]
Post subject:  Re: Problem with translucence and func_train

He's talking about getting lightmaps to work with transparency. You don't even have a lightmap stage.

Author:  Noruen [ 04-23-2010 01:11 PM ]
Post subject:  Re: Problem with translucence and func_train

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 :)

Author:  skinNCNmaster [ 04-23-2010 02:45 PM ]
Post subject:  Re: Problem with translucence and func_train

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?

Author:  Noruen [ 04-24-2010 12:15 AM ]
Post subject:  Re: Problem with translucence and func_train

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 :)

Author:  dONKEY [ 04-24-2010 02:29 AM ]
Post subject:  Re: Problem with translucence and func_train

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

Code:
{
   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.

Author:  skinNCNmaster [ 04-24-2010 05:55 AM ]
Post subject:  Re: Problem with translucence and func_train

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..

Author:  obsidian [ 04-24-2010 06:48 AM ]
Post subject:  Re: Problem with translucence and func_train

If this is indeed a decal, then read this:

http://robotrenegade.com/q3map2/docs/sh ... ricks.html

Page 1 of 1 All times are UTC - 8 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/