fog: wrong clipping of water surface


(]UBC[ McNite) #1

Hey @ all,

today I tried to get some fog working in TheRiver, because the distances players can see in this open terrain map are fare too long and distract from gameplay or even annoy.

These are my fog-settings:
Worldspawn: farplanedist 4900, fogclip 4700

shader for my fog:

textures/river2nd_t/rv2nd_fog_02
{ 
	qer_editorimage textures/river2nd_t/rv2nd_fog_02.jpg 
	qer_trans 0.9 //0.4
	surfaceparm fog 
	surfaceparm nodraw 
	surfaceparm nolightmap 
	surfaceparm nonsolid 
	surfaceparm trans 
	fogparms ( 0.72 0.76 0.78 ) 4700
}  

The fog as a fog works fine. (Anybody any idea how to make it very light so you don’t get the fog in the buildings? I know you can thin the fog by increasing the fogparms and distances.)
What doesn’t work so fine is fog and water together:
For this, some pics:

First 2 pics both have the same water-shader with nofog in the shader and fog on in the blending parts (see below at siwa_water2 shader).

However when I disable the nofog to get some fogclipping this happens: there is a “fogline” on the water quite some units in front of the fogclipping, and most annoyingly the surface of the water gets transparent (which was disabled in the water-shader); furthermore you get the light grey fog in the water which sux too

To prove its not my water-shader that s the problem: this is siwa_water2 in the same map, same fog-settings:

This is the siwa_water2 shader:

textures/liquids_sd/siwa_water_2
{
	qer_editorimage textures/liquids_sd/siwa_water.tga
	qer_trans .5
	q3map_globaltexture
	cull disable
	nocompress
	nofog                            <<< when you disable this one you get something like the 3rd pic
	surfaceparm nomarks
	surfaceparm nonsolid
	surfaceparm trans
	surfaceparm water
	waterfogvars ( 0.11 0.13 0.15 ) 0.2
	nopicmip
	{
		map textures/liquids_sd/siwa_water.tga
		blendFunc blend
		alphaFunc GE128
		rgbgen identity
		tcmod scale 0.5 0.5
		tcmod scroll -.02 .001
		fog on              <<< when nofog is disabled u can let these or disable them too, its no difference (pic 3 in every case)
	}
	{
		map textures/liquids_sd/seawall_ripple1.tga
		blendFunc GL_ONE GL_ONE
		rgbGen wave sin 0.3 0.02 0 0.25
		tcmod scale 0.01 0.01
		tcmod scroll -.001 -.0002
		fog on
	}
	{
		map textures/liquids_sd/seawall_ripple1.tga
		blendFunc GL_ONE GL_ONE
		rgbGen wave sin 0.1 0.03 0 0.4
		tcmod scale 1 1
		tcmod scroll -.005 -.001
		fog on
	}
	{
		map textures/liquids_sd/siwa_shimshim1.tga
		blendFunc GL_ONE GL_ONE
		rgbGen wave sin 0.4 0.02 0 0.3
		tcmod transform 0 1.5 1 1.5 2 1
		tcmod scroll .005 -.001
		fog on
	}
}

So wtf am I doing wrong? Anybody had the same prob and found a solution?


(nUllSkillZ) #2

Here is a (german) tutorial that describes how to get rid of fog inside buildings:
http://www.level-designer.de/index.php?option=content&task=view&id=1820&Itemid=30

Edit:

Here is an english tutorial:
http://www.ut.map-depot.com/content.php?article.44


(]UBC[ McNite) #3

Thx null. Anyway I was hoping there s a way around multivolume fog. Gameperformance isn’t best in my map. The simple fog already fucked gameperformance up and lowered FPS from 40 to 25 in the real bad spots :disgust: so I fear multivolume fog won’t improve things


(]UBC[ McNite) #4

Well, tried the multivolume fog too…

First, it doesn’t seem necessary to stop after the BSP phase to change the shader. This only caused the fog not to be in the map at all. When compiling all stages with the same shader I get the fog, but same prob as in pic 1…


(TFate) #5

I could not find any way around this either. I tried breaking up the water into small chunks but to no avail. The reason battery gets away with this is that the fogclip is SOOO far away it hardly makes a difference, it’s more for effect IMO.

In your map it doesn’t really seem too big a deal though, Nite. It’s certainly not something I would complain about as a casual player, or even a scrutinous one.


(]UBC[ McNite) #6

I had a serious look at the Battery shaders and at how Battery is built… can’t figure it out. The Worldspawn fog of Battery clips the watersurface away nicely if you look at it closely. But I think this only works because the watersurface is in real a terrain which they used cuz on the terrain it was easily possible to get a blending of different textures they needed for the “breaking waves” around the rocks. I don’t need a blending like on battery so I thought it would work with a single brush that gets the watersurface and a brush that is the “water” below:
For the water I used a simple watershader (rv2nd_water_nodraw) and for the surface itself a nodraw brush with the watershader (without surfaceparm water), but nodraw brushes seem to fuck things up too.

// after battery/water_nodraw:
textures/river2nd_t/rv2nd_water_nodraw //works fine
{
	qer_editorimage textures/river2nd_t/rv2nd_water_nodraw.jpg
	qer_trans 0.9

	surfaceparm nodraw
  	surfaceparm nonsolid
  	surfaceparm trans
  	surfaceparm water
}

What does get clipped properly but ends up as orange/black is this (no idea y this gives only orange/black…

textures/river2nd_t/rv2nd_water2 //doesnt work
{
	// nocompress // no idea why this is here
	qer_editorimage textures/river2nd_t/rv2nd_water.tga
	qer_trans 0.5
	qer_nocarve

	q3map_globaltexture

	surfaceparm nomarks
	surfaceparm nonsolid
	// surfaceparm trans //disabled to make surface opaque
	surfaceparm water

	cull none
	nopicmip
	// nofog //disable to have the water clipped by fog
}

edit: when I use a nodraw brush it makes all terrain surfaces (triangles with the texture that are the riverbed) that are completely inside the nodrawn disappear… which mean I can look to the skybox when being in the water


(Sniper) #7

I had this problem in one of my older EF Maps, I fixed it there, give me some time and I am sure I can find out what’s the problem, it probably has something to do with the blending options in the shaders.


(]UBC[ McNite) #8

Ok, I solved it pretty much.

The prob is, the blending used in the Siwa-shaders doesn’t work with worldspawn _fog or with surfaceparm fog and fogparms an a water shader (to get murky water).

Using the Battery watershader (especially the ocean1 shader) gives a useful shader that gets clipped properly by worldspawn _fog. Nevertheless the clipping on ocean0 or on any other solid surface is smoother compared to clipping on ocean1. I guess its because of the multiple blendings that are used in ocean1.

However it doesn’t seem to be possible to make the water1 shader non-transparent, which I was able to do with the derivate of the siwa-water. This gets worse when I try to make the water murky with a fogparm in the watershader (its impossible to do this within the ocean1-shader, I had to use 2 brushes… anyway didn’t work).

So now I finally found a way to get a (lot less nice-to-look-at) watersurface properly clipped. But the worldspawn _fog gives my frames drops up to 30 FPS now… really bad… if I can’t solve this we ll have The River without fog :disgust:


(Sniper) #9

What might be a possibility is to try Q3ASE if you haven’t done so, you can get it here;

http://www.bpeers.com/software/q3ase/#releases It doesn’t works with all shaders and if you try to load some .shader files it may happen they won’t load due to bad surface parms (Which is logical since it is made for Quake 3 and the updated ET Engine has new Surfaceparms not implented in this version of Q3ASE).

I don’t really know what everyone uses for kind of tools to map in ET so excuse me if it was a stupid suggestion.


(Gringo Starr) #10

The old RTCW method for getting murky water, was to put a fog brush inside the water 1 unit below the surface. Of course, you may have to get rid of the waves though. :frowning:


(]UBC[ McNite) #11

@Gringo: yes I used that method. The prob is that it doesn’t work with the blends used in the siwa-water or the battery water1 (water0 looks even more horrible). What mainly happens then is that when being in the water looking up to the water-surface the watersurface isn’t there (even with cull none for the surface-shader).

So yes, if I want murky water it seems I have to loose the moving-water-effects. Moving water by blends (water0 or water1) nevertheless works with worldspawn fog. I m not sure yet what I ll choose though, depends a bit on the framerates (worldspawn fog makes them drop from at least 15 to more n 30 FPS).


(TFate) #12

Well think of it this way… the more murkier a river is, the less it moves, right? I’ll try the battery shader for my map and see what happens. :wink:

EDIT: OMG, it worked like a charm! :clap:


(Gringo Starr) #13

The water surface usually isn’t seen from underwater. In my experience, it actually looks better when you cannot see it.


(]UBC[ McNite) #14

Well I m pretty sure you won’t like this either… its not the right fog (this is sky-fog that kinda overrides the water-fog) and not the water-shader I used to use, but the effect is absolutely the same…


(Gringo Starr) #15

That would look good if you made it a light brown, and very dense. Here is a shader I used in an RTCW map. I’m not 100% sure it will work in ET.

textures/ww_machogrande/ma_waterfog
{	
	qer_editorimage textures/ww_machogrande/ma_waterfog.tga
        qer_trans 0.3
	q3map_bounce 0	
	surfaceparm	trans	
	surfaceparm	nonsolid	
	surfaceparm	fog	
	surfaceparm	nolightmap	
	//q3map_globaltexture
	//q3map_surfacelight 0	
	fogparms ( .30 .28 .18 ) 220
}

(]UBC[ McNite) #16

With 220 as distance u can’t see shit… or even the condoms floating by :smiley:
Anyway I have a working waterfogshader with 2048, but its no use when you can see things a lot further away that should ve been clipped by the fog but you can see them nevertheless because they are not inside the fogbrush.

textures/river2nd_t/rv2nd_water_nodrawfog //works fine
{
	qer_editorimage textures/river2nd_t/rv2nd_water_02_d03_waterfog_sm.jpg
	qer_trans 0.9
	qer_nocarve

	surfaceparm nodraw
  	surfaceparm nonsolid
  	surfaceparm trans
  	surfaceparm water
	surfaceparm fog // fog inside the watershader after
	fogparms ( 0.07 0.14 0.14 ) 2048 // users.pandora.be/Ariffnet/tutorials/waterfog.html
}

And, yea I know that Ydnar suggested a 2 lines that should do the difference and clip things outside of the fogbrush, but they don’t work for me:

	{ 
		map textures/river2nd_t/rv2nd_fog_02sm.jpg // suggested by ydnar for clipping of objects
		blendFunc GL_ZERO GL_ONE // outside of the fogbrush... doesnt help things in murky water though
	}

(]UBC[ McNite) #17

Just tried out your shader cuz it differs from mine (I have surfaceparm fog, you don’t). With a version of siwa-water (with my textures) this is the result:

There are 2 things I don’t like about this one:
1.) things outside the fogbrush don’t get clipped (the wall at the end is outside the fogbrush)
2.) The surface of the water doesn’t get clipped which looks bad imo. The watersurface is INSIDE the fogbrush because I use 2 brushes here: one with the fogwater only, and a very thin one (2 units) for the surface. 1 unit is outside the fogwater and one inside. You can also notice a slight change in the blue of the watersurface, but that s siwa-water with dark custom textures for you.


(Gringo Starr) #18

You have seperate fog and water brushes, right? I can’t tell, because it looks like you’re using a water texture in the fog shader. The shader I used (which I don’t think should matter with the color set by fogparms), is here.

http://www.the-wildwest.com/GamingForums/gringo/ma_waterfog.tga

Also, your fog brush needs to be touching structural brushes on 5 of the 6 sides. Sorry if that’s common knowledge. :slight_smile:

For the brushes which are half in the water, you may want to split them at the fog. Have an upper non-fogged, and lower fogged portion of each.


(Gringo Starr) #19

[quote=]UBC[ McNite]

textures/river2nd_t/rv2nd_water_nodrawfog //works fine
{
	qer_editorimage textures/river2nd_t/rv2nd_water_02_d03_waterfog_sm.jpg
	qer_trans 0.9
	qer_nocarve

	surfaceparm nodraw
  	surfaceparm nonsolid
  	surfaceparm trans
  	surfaceparm water
	surfaceparm fog // fog inside the watershader after
	fogparms ( 0.07 0.14 0.14 ) 2048 // users.pandora.be/Ariffnet/tutorials/waterfog.html
}

[/quote]

Like I sort of mentioned above, you don’t need surfaceparm water in the fog! It’s just fog, but the player is swimming in the water overlapping it, so they can’t tell. :slight_smile:


(]UBC[ McNite) #20

I m doing it another way: I have a waterbrush with the fogparms in it that has no surface you can see. On top of this I use a 2-unit-thick brush with water-nodraw that gets the texture of the watersurface on the top (so players can see it when looking at the water) and on the underside (so players in the water can see this “surface”).