Fog and Water... problems solved (more new pics added)


(]UBC[ McNite) #1

I m just curious cuz i messed with that problem last november and a search doesnt indicate someone else worked on this or at least posted on this problem:

Has anybody been able to get a nice watersurface (done by a shader with more n 1 blend stage) working AND looking good with fog in the map?
I ve been trial-and-erroring with fog and water the last 2 days and didn’t find a good solution yet… will post my shaders later today.

Do we have any new approaches to fog in a map other than skyfog, global fog and multivolume fog?


(]UBC[ McNite) #2

Ok here we go… the promised pics and problems.

What i m trying to do is: use sky-fog and make it look good with a water-surface. Skyfog is non-volumetric and doesnt work with shaders taht use lots of blends, so the water-surface has to be simple.

But somehow i get this problem:

I m on the same spot, just turning to the right and taking screenies… look at the surface of the water changing from the original dark tex to something very light. Explanations or approaches anyone?

Here is the water-shader:

textures/tr2redux_t/tr2r_water // works as layer on water_nodrawfog
{
	qer_editorimage textures/tr2redux_t/tr2r_water_ei.jpg
	qer_trans 0.9

	cull disable
	surfaceparm water
	implicitMap textures/tr2redux_t/tr2r_water_02_d03.tga
}

This is the sky-shader:

textures/tr2redux_t/tr2r_skyfog
{
	qer_editorimage textures/tr2redux_t/tr2r_fog_06_ei.jpg
	q3map_sunExt 1 .95 .9 65 60 60 3 16 //65 75 75 3 16
	q3map_lightmapFilterRadius 0 8
	q3map_skylight 50 3

	skyparms - 128 - //low value >> more curved sky

	surfaceparm sky
	surfaceparm noimpact
	surfaceparm nolightmap
	surfaceparm nodlight

	nopicmip
	fogvars ( .4 .4 .45 ) 4800 
	skyfogvars ( .23 .23 .24 ) 0.05

	{
		map textures/tr2redux_t/tr2r_fog_06sm.jpg 		rgbGen identity
	}
	{
		map textures/tr2redux_t/tr2r_fog_06sm.jpg
		blendfunc blend
		rgbGen identity
		tcMod scroll 0.002 0.001
		tcMod scale 1.4 1.4
	}
}

What also bothers me is this:

Its a simple boxmap for testing… look at the strange lines on the sand-tex and the line the fog is drawing on it.
This is the skyfog-shader (made my Tanya Cheex for the map TheRiver for RtCW, the 3 suppressed lines are suppressed by me):

textures/tr2redux_t/tanya_sky_fog
{
	nocompress
	qer_editorimage textures/tr2redux_t/tr2r_sky_011.jpg
	q3map_lightimage textures/tr2redux_t/tr2r_fog_06sm.jpg
	surfaceparm noimpact
	surfaceparm nolightmap
	surfaceparm sky
	q3map_globaltexture
	// q3map_forcesunlight
	q3map_lightsubdivide 512 
	// q3map_sun	.800000 0.783168 0.20851 18 35 35
	// q3map_surfacelight 8
	skyparms full 200 -
	fogvars ( .4 .4 .45 ) 4850	
	skyfogvars ( .23 .23 .24 ) .05

	
	{
		map textures/tr2redux_t/tr2r_fog_06sm.jpg
		tcMod scale 16.0 16.0
		depthWrite
	}
	{
		map textures/tr2redux_t/tr2r_fog_06sm.jpg
		blendfunc blend
		tcMod scroll 0.008 0.00
		tcMod scale 2 1
	}
}

(EB) #3

Remove water all fogparms and add q3map_noFog to the lower header portion.
Doing so will keep your water from being greyed out.

I use the following in a version of siwa_water2 in a map(slightly changed. This one works well with water/fog overlays and requires no additional flim flamming. Just add it to a non-default .SHADER. Use it if you want to.
*SHADERS and PICTURES Listed Below *

textures/deserteb/siwa444444
{
qer_editorimage textures/liquids_sd/siwa_water.tga
qer_trans .5
q3map_globaltexture
cull disable
nocompress
nofog
surfaceparm nomarks
surfaceparm nonsolid
surfaceparm trans
surfaceparm water
nopicmip
q3map_noFog
{
map textures/liquids_sd/siwa_water.tga
blendFunc blend
alphaFunc GE128
rgbgen identity
tcmod scale 0.5 0.5
tcmod scroll -.02 .001

}
{
	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
	
}
{
	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

}
{
	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
	
}

}

textures/liquids_sd/siwa_water_2
{
qer_editorimage textures/liquids_sd/siwa_water.tga
qer_trans .5
q3map_globaltexture
cull disable
nocompress
nofog
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
}
{
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
}
}

I am sure I could have made the shader itself a little tidier but I don’t care if it doesn’t bother the effects. This one works well with water/fog overlays and requires no additional flim flamming. BTW…the fog in the pics above are from a target_fog entity,near 1500,distance 3800,_color .4 .4 .4

As for the other question…that’s just the way it is with culling on fog.<<<This is only if I understand your question right…hmmmmm…that was wierd to say… :stuck_out_tongue:

EDITI had my FPS capped really low to make a demo of a map I am making. That map is not resource hungry.


(]UBC[ McNite) #4

What is a target_fog entity? :eek:


(EB) #5

it works like a target_speaker, you can turn it on or off or even make the fog change colors in map using several of them.

If you click on my signature, you can download the “func_map.pk3” in this I have targeted 3 target_fog’s to change upon activation of a func_invis_user…the target_fogs can be scripted as well. :wink:


(SCDS_reyalP) #6

The problem with the boxmap is likely related to the large brushes. As the brush size approaches the fog distance, things get weird. I suspect if you cut the brushes up into a few segments, it will look normal.


(]UBC[ McNite) #7

Thx reyal, that was the hint i needed… cutting up the surface into 1024x1024 pieces (= my blocksize) made the trick work well :smiley:

EB… the q3map_noFog doesnt change a thing for me… i ll keep messing around, then post some shader.


(Chruker) #8

no no no, not yet another foggy map. I really liked the map in its non-foggy version…


(]UBC[ McNite) #9

Maybe yes maybe no… the problem without fog is that snipers have too much power. But anyways… we r only in conception phase and you are welcome to post your opinion and/or experiences with The River II here

Now some pics of what it looks like with the fog and nice water surface… compile was with VIS -fast so don’t look at the FPS… without VIS -fast they are about 15-25 FPS better compared to River without fog.


(Ifurita) #10

Nice


(EB) #11

Well, show me the shader and I will show you what to do again or just edit it for you. :stuck_out_tongue:
Don’t forget…post the shader. ok?


(Chruker) #12

If you keep the fog, you might want to tone down the water and grass textures. They seem to colorfull for the lighting.


(]UBC[ McNite) #13

EB, here is the watershader:

textures/tr2redux_t/tr2r_water
{
	qer_editorimage textures/tr2redux_t/tr2r_water_ei.jpg
	qer_trans 0.9

	cull disable
	nofog
	surfaceparm water
	q3map_noFog
	implicitMap textures/tr2redux_t/tr2r_water_02_d03.tga
}

This is what you get above and below the watersurface with this watershader:


(EB) #14

The following does not need any extra textures to be packed into the .pk3.
It uses default texture paths with a renamed end directory for the shaders use.
You can just replace the water shader you have with this one.

textures/tr2redux_t/tr2r_water
{
qer_editorimage textures/liquids_sd/sea_bright_na.tga
qer_trans 0.9
q3map_globaltexture
q3map_noFog
cull disable
nocompress
nofog
surfaceparm nomarks
surfaceparm nonsolid
surfaceparm trans
surfaceparm water
nopicmip
{
Map textures/liquids_sd/sea_bright_na.tga
}
}
(Some unnec. shader keywords could be removed but they won’t hurt anyways. Better off leaving it as is.)

-Cheers

P.S. use the newer shader and recompile…see if the fog still appears below the water line. BTW…are you using a No_draw_water brush with the top face textured in the water shader ?


(]UBC[ McNite) #15

Up to now I m using my shader on all sides of the water-chunks (only way to get the surface looking good was to cut it into chunks of 1024x1024) and a pure nodraw on the sides of the chunks where the player has to swim/ see through… works fine this way.

I ll try your shader tomorrow :slight_smile:

edit: I guess once i use the nofog inside that brush i wont be able to use a waterfog with a lower distance right? But that doesnt hurt anyway because combining waterfog with a distance of like 1024 and the real fog in the map never worked together as well… the fog of the map kinda overrides the fog in fogvolumes.


(]UBC[ McNite) #16

Here we go EB… just had a short look at what happens when i use your proposed shader for a water in my testboxmap:

below the watersurface:

watersurface from above:

I d say… its the fog i m using that doesn’t work with your shader. There is no difference to my shader when you are swimming in the water, and it looks a lot worse than my water when u r not in the water.
Well… i m fine with it. There are only 2 steps of improvement possible now:

1.) get the grey fog out of the water so u can see the riverbed all way long
2.) get murky water working with a fog in the whole rest of the map

I thought your shader might do the trick for 1. but didn’t (no biggie).
About 2… I tried a lot but the fog in the whole map is “stronger” than the volumetric fog I m using as “murky water” and u can see it nevertheless. I figure the only way to get around that would be to have the distance you can see in the water until there is a riverbed tex a lot smaller than the fog-clip distance of the map-fog. That way the map-fog wouldn’t start its effect.


(EB) #17

[my shader is on the right in the pic above.]
I figured you could fix the fog below the water after you’re satisfied with the above the water appearance.

A water shader that is not effected by fog isn’t what you want. What you do want is one that works better with the fog and doesn’t turn white with a different viewing angle ?
It would look funny using that shader (w/o fog) on a river anyways.

Well whatever you choose to do…good luck.

**[edit] Lowlife (the one that makes maps with Marko) is good with fog type things from what I remember about their old forums. New ones >>> http://marko.hd.free.fr/forums/ [/edit]


(]UBC[ McNite) #18

Hmmm EB… the issue with the changing color when u change the angle of looking at the watersurface had already been solved with the help of reyal… the idea to cut up the water into chunks (i made them about 1024x1024 = blocksize) solved that problem perfectly. Sorry for the misunderstanding…

About the fogtypes… i tried multivolume fog and global fog.
Multivolume fog is done with large brushes that get a nodraw-etc. shader with fogparms. Its the only way to get fog in a map without having it inside the buildings too. You can use this fog to get murky water too.
“Global fog” is set in the worldspawn. Its difficult to set, often screwed up my map (got total black map after the compile).
Both multivolume and global fog affect the FPS seriously making them drop by 15-30 frames in River.

The fog that I m using now is “sky-fog”. That s how i call it lol cuz u do the settings in the skyshader as you can see in the shader I posted above. Its a non-volumetric fog (that s what ydnar said about it on the q3map2 forum last year). It improves the FPS in River by 15 to 25 depending on where you are. Only drawback: it really screws up with shaders that use more n 1 blend-stage (that s what i experienced as real shitty looks on the terrain and how ydnar explained it).