TGA and fog... (sky fog, not texture)


(urgrund) #1

I thought I’d ask this in the q3map thread as I remember reading of different things getting coded to fog properly (brushes, entities).

I used q3map2 2.3.29 using a foghull with RtCW. (after trying the standard GTKR menu compiles, no difference)

prob: Any texture with an alpha channel will not have fog effect it. This looks really bad in game as models, brushes, terrain all fog together leaving a bold outline of the TGA textures.

Is there a newer version that takes care of this?
or perhaps some workaround?

.thanks


(ydnar) #2

Are you using a fog brush or Wolf fog?

y


(urgrund) #3

I’m using wolf fog I guess…

with _farplanedist and _foghullshader in the worldspawn.

This is the sky shader I’m using:

textures/gcsfx/foggysky
{
	qer_editorimage textures/skies/sky_m01dmcmp
	surfaceparm noimpact
	surfaceparm nolightmap
	surfaceparm sky
	q3map_globaltexture
	q3map_lightsubdivide 1024 
	q3map_sun 0.5 0.5 0.6 30 30 25
	q3map_surfacelight 190
	skyparms full 200 -
	fogvars ( .4 .4 .4 ) 2500	
	
	{
		map textures/skies/sky_m01dmcmp.tga
		blendfunc GL_ONE GL_ONE
		tcMod scale 12.0 12.0
	}
}

(btw: does it need the map texture pass if its all fog anyway?)

And this is the shader for the texture that doesn’t get fogged out.

textures/gcsfx/treeline
{
	qer_editorimage textures/gc_organic/treeline.tga
	cull disable
	cull twosided
	surfaceparm alphashadow
	surfaceparm trans
	surfaceparm nomarks

	{
		map textures/gc_organic/treeline.tga
		alphaFunc GE128
		depthWrite
		rgbGen vertex
		blendfunc blend
		rgbGen identity
	}
	{
		map $lightmap
		rgbGen identity
		blendFunc filter
		depthFunc equal
	}
}

(urgrund) #4

any ideas?
this pretty much determines a major layout plan of the map, whether this can be resolved or not.

I noticed in MoH it fogs textures with alpha channels.


(pazur) #5

i`m using wolf fog in my map and alphaFunc shaders are shown correctly

  1. check your video card drivers
  2. usually u dont need _foghullshader when using fogvars(wolf fog) this is only for q3a

(urgrund) #6

yeh, the alphaFunc works fine…
and my drivers are the latest nVidia ones for XP…

Its that global fog doesn’t effect TGA textures.
Try putting a tga texture with something (like trans or reflect) next to a normal jpeg texture in a map with fog, then walk away and see the difference.
I can post a screenshot if needed.

Is there anything wrong in the script?
I’d really like to see what can be done about this. :slight_smile:


(pazur) #7

nobody seems to know how this wolf fog really works(hey did the programmer get lost or something). its twice as fast as real fog but it doesnt like some blendfuncs on the 3rd stage. i found out that 1st stage texture and then 2nd stage lightmap with blendfunc filter is ok for this fog usually. the ONLY blendfunc that looks correct on 3rd stage with wolf fog is GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA(is that blend?)… anyway u need a tga with an alpha channel that determines the transparency on the 3rd stage.

here is a metal shader with environment “reflections” that works for me with wolf fog:


textures/natter/ventgang_metal
{
	qer_editorimage textures/metal_misc/metal_m02ss.tga
	surfaceparm metalsteps

	{
		map textures/metal_misc/metal_m02ss.tga
		rgbGen identity
	}
	{
		map $lightmap
		blendfunc filter
		rgbGen identity
	}
	{
		map textures/natter/tinfx_n.tga
		blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
		tcMod scale .3 .3
		tcGen environment
		rgbGen identity
	}
}

tinfx_n.tga has 50% gray alpha channel

edit: textures/liquids/water_calm2 has a “fog on” in the first 2 stages, but i didnt really figure out how this can be used to solve this fog problem


(urgrund) #8

Thanks, got it to work… a combination of your script and mine made it work (there were still some issues with the alpha channel after it fogged correctly)

Here’s a screen (no lightmap)

The flat tree texture on the far left/right is fogged properly in the distnace above that cottage.

Here’s the script working, for anyone else that had that problem.
Cheers

textures/gcsfx/treelinefog
{ 
   qer_editorimage textures/gc_organic/treeline.tga
	surfaceparm nomarks
	cull disable
	cull twosided
   
   { 
 	map $lightmap
	rgbGen identity
	blendFunc filter
	depthFunc equal
   } 
   { 
	map textures/gc_organic/treeline.tga 
      	blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA 
	alphaFunc GE128
      	depthWrite 	
      	rgbGen identity 
   } 
} 

(pazur) #9

looks nice…a bit like the level in MOHAA sp demo :slight_smile: good that i could help u a bit

edit:why do u have both alphaFunc and blendFunc in 2nd stage?