Author Topic: [SOLVED] Fog: visibleSide  (Read 2442 times)

GlobalWarming

  • Posts: 23
  • Turrets: +1/-0
[SOLVED] Fog: visibleSide
« on: May 04, 2009, 03:52:59 pm »
According to many sources, you can only create Fog with one visible side, which in few words, is the "available" side that is not in contact with other surfaces, and can not be set manually.

However, looking at the GtkRadian source code:
(https://zerowing.idsoftware.com/svn/radiant/GtkRadiant/trunk/tools/quake3/q3map2/writebsp.c)

Code: [Select]
/* try to use forced visible side */
if( mapFogs[ i ].visibleSide >= 0 )
{
bspFogs[ i ].visibleSide = mapFogs[ i ].visibleSide;
continue;
}

/* find visible side */
for( j = 0; j < 6; j++ )
{
if( mapFogs[ i ].brush->sides[ j ].visibleHull != NULL )
{
Sys_Printf( "Fog %d has visible side %d\n", i, j );
bspFogs[ i ].visibleSide = j;
break;
}
}

It say "if .. visibleSide >= 0 " then use it... if not, try to guess it... so anyone here knows how to setup that variable? I tried to put it at the shades file as "visibleside 1" but it fails to load the shade... any ideas?

Thank you.
« Last Edit: May 06, 2009, 02:43:34 am by GlobalWarming »

gimhael

  • Posts: 546
  • Turrets: +70/-16
Re: Fog: visibleSide
« Reply #1 on: May 04, 2009, 04:04:16 pm »
Apparently you have to specify the fog "direction" with the q3map_fogDir keyword. The parameter is a vector that points into the fog, so that the visible side is the side which has the opposite normal. (e.g. if you want to make the top side of a cube the visible side, specify a fog direction vector pointing down.
 

GlobalWarming

  • Posts: 23
  • Turrets: +1/-0
Re: Fog: visibleSide
« Reply #2 on: May 04, 2009, 04:29:34 pm »
Thank you Gimhael, i will try that... so if it is possible, then maybe some trick can be done to simulate 2-sides fog...

GlobalWarming

  • Posts: 23
  • Turrets: +1/-0
[SOLVED] Re: Fog: visibleSide
« Reply #3 on: May 05, 2009, 03:07:11 pm »
I goggled and I didn't find any example of how to use that variable... however, according to the Q3Map2 Shader Manual (http://pumpkin.game-server.cc/q3map2/shader_manual/ch3.html) it says:

Quote
q3map_fogDir angle
Specifies the direction a fog shader fades from transparent to opaque.

So I made some test and finally I find the way to do it:

Code: [Select]
textures/test/fog
{
q3map_fogDir ( 0 90 0 ) 
qer_editorimage textures/common/fog.tga
qer_trans .2
surfaceparm trans
surfaceparm nonsolid
surfaceparm fog
surfaceparm nolightmap
qer_nocarve
fogparms ( 0 0 0 ) 500
}

if you want change other angle for fogDir, you can also use negative angles:  q3map_fogDir ( 0 -90 0 ).

I tried to use a 2 sides fog, however if your fog is not so dark, you will see a solid frame between them. I tested with fogparams opacity 50 and its very nice for a hidden (and really dark) passage.

Thank you gimhael for the hint.