fog: bad clipping of the terrain


(]UBC[ McNite) #1

After I solved the problem with the clipping of the water by a worldspawn fog (using a very simple shader for the water-surface) I found out that both worldspawn fog and multivolume fog make framerates drop amazingly if not horribly (down to 25 in too many places in the map). So I wondered what was used in the original map in RtCW and found out that its a fog in the sky… using these parameters:

	fogvars ( .4 .4 .45 ) 4850	
	skyfogvars ( .23 .23 .24 ) .05

I got a nice fogclipping on the water as u can see on the pics, and for the first time serious improvement on the framerates too: in a standard-bad-spot a raise of about 10FPS (38 without fog, 25 with worldspawn _fog, now 49) and general improvement in the whole map. Only problem is the clipping of the terrain now…

I know GoGerbil worked with a similiar fog once http://www.splashdamage.com/index.php?name=pnPHPbb2&file=viewtopic&t=9090&highlight=fogvars but tbh I didn’t understand much of his thread :smiley: my approach to the water-clipping-problem was already pretty ballistic.

This is my terrain-shader (from EasyGen with q3map2-settings)… they are all the same (some with landmines and phong, but not all of them). I got 5 terrain-textures (but I doubt this is important). Using the ET-settings in EasyGen makes no difference.

textures/river2nd_t/terrain_0
{
	q3map_lightmapsamplesize 64
	q3map_lightmapaxis z
	q3map_texturesize 512 512
	q3map_tcGen ivector ( 640 0 0 ) ( 0 640 0 )
	{
		map textures/river2nd_t/rv2nd_rock_steep.tga
	}
	{
		map $lightmap
		blendFunc GL_DST_COLOR GL_ZERO
		tcGen lightmap
	}
}
textures/river2nd_t/terrain_0to1
{
	q3map_lightmapsamplesize 64
	q3map_lightmapaxis z
	q3map_texturesize 512 512
	q3map_tcGen ivector ( 512 0 0 ) ( 0 512 0 )
	
	{
		map textures/river2nd_t/rv2nd_rock_steep.tga
	}
	{
		map textures/stone/mxrock3_a.jpg
		alphaGen vertex
		blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
	}
	{
		map $lightmap
		blendFunc GL_DST_COLOR GL_ZERO
		tcGen lightmap
	}
}

I tried out what happens when I use the old RtCW-shader for terrain used in the original map, but you probably d throw up all over your screen when u see the result so I won’t post a pic (the blending areas simply were not there… and that’s not the worst part).

So what I m searching for is a terrain-shader that works with this fog. Has anyone been able to use sky-fog successfully?


(ydnar) #2

GL (non-volumetric) fog does not work with shaders using more than two stages, and not properly on a number of particular blend modes.


(]UBC[ McNite) #3

Ok… I kinda figured out when I saw the map after the compile that the terrain shader won’t work with this fog… Sorry Ydnar, but your answer didn’t give me much of a clue what to do or where to search for a solution.

My unsolved questions stays the same: is it theoretically possible to set up a terrain shader that will work with this fog or not? And what would I have to do in order to get it working?


(obsidian) #4

Well, if I understand ydnar correctly, then no… since your terrain has more than two stages the GL fog will not appear correctly.

You can either create your terrain shader with a single stage (no blending terrain) or use volumetric fog, which depending on which game you’re mapping for, you may or may not be able to use.