Page 1 of 1

Levelwide fog and dist culling with _foghull & _farplanedist

Posted: Thu Sep 16, 2010 7:38 am
by Delirium
Does anyone have an example of this in a map?
I've set everything up correctly as far as I can see, but obviously not..

_farplanedist works fine but _foghull doesn't fill the map with fog it only leaves where the skybox brushes are with the solid color of what the fog color should be

I could make my map into a box then add one huge fog brush inside the map to do it but then that would be wasted space. and truely something a noob would do :x

Re: Levelwide fog and dist culling with _foghull & _farplanedist

Posted: Thu Sep 16, 2010 9:37 am
by Noruen
Yes I flirted with this idea, but it doesn't work. Because - originally intended idea, that nothing farest than eg. 512 units will not be drawn doesnt work and also I didn't realize how to use the right fog shader... Maybe I' too stupid, but I really do not know how to make this technology working.

Re: Levelwide fog and dist culling with _foghull & _farplanedist

Posted: Thu Sep 16, 2010 2:39 pm
by jal_
I have one test map using it. This is the setup (the map is just a skybox with a terrain model inside, so there's no use in uploading it).

At worldspawn:

_foghull skybox/skyfogged1
farplanedist 8000

Skybox brushes shader: textures/skybox/skyfogged1

A fog brush containing all the map, with shader: textures/skybox/skyfogged1_fog

shaders:

textures/skybox/skyfogged1
{
qer_editorimage env/skyfogged1/hull_pz.tga
surfaceparm nomarks
surfaceparm noimpact
surfaceparm nolightmap
surfaceparm sky
q3map_sun .9 .9 .9 275 130 35
q3map_lightimage textures/colors/white.tga
q3map_surfacelight 50

skyParms env/skyfogged1/hull 256 -
}

textures/skybox/skyfogged1_fog
{
qer_editorimage textures/colors/white.tga

surfaceparm fog
surfaceparm nodraw
surfaceparm nonsolid
surfaceparm trans
surfaceparm nolightmap
qer_nocarve

fogparms ( 0.5 0.5 0.5 ) 7000
}

Notice1: The _fogull command at worldspawn asumes the root is "textures", so you don't have to write the "textures/" bit in the path. This was the hardest part of making it work for me ;)

Notice2: The _foghull shader has to be of the fog color. It's the background. A flat color one is the easiest for getting it working, although you can add some details at the top of the skybox if you do it carefully.

Notice3: The _foghull and map's skybox shaders are the same. In q3 this condition is not a must and it will just use the _foghull shader. In Warsow they need to be the same.

Notice4: Enemy Territory sets this up completely different. In case you found ET tutorials at google, ignore them, they won't work (happened to me).

Notice5: These are Warsow shaders, but they *should* be working just fine at Q3.

Re: Levelwide fog and dist culling with _foghull & _farplanedist

Posted: Thu Sep 16, 2010 2:44 pm
by ShadoW_86
Why to use at all _foghul at worldspawn if you have brush fog there? Is'n it useless then? Or rather, isn't it suppose to be that you don't need the fog-brush when using the _foghul?

Re: Levelwide fog and dist culling with _foghull & _farplanedist

Posted: Thu Sep 16, 2010 2:47 pm
by jal_
Shadow, because farplanedist cuts the view (skybox included) and the fog isn't there if no polygon is drawn. The foghull is just a skybox that is put there when farplanedist acts. It's a bit confusing (ET does it simpler), but this is the way it works here.

Re: Levelwide fog and dist culling with _foghull & _farplanedist

Posted: Thu Sep 16, 2010 3:18 pm
by obsidian
The worldspawn _farplanedist key acts like a giant box boundary that follows the player around, cropping any map geometry from rendering beyond its dimensions. Simply cropping stuff off from the renderer results in HoM ("hall of mirrors") effect since nothing is being drawn in the frame buffer. You also have a problem with geometry appearing and disappearing as the player moves around. We need to hide these two artifacts.

To hide HoM, we need to create a skybox to render in lieu of the empty pixels. To blend in perfectly this needs to be the same colour as the fog. You point the _foghull key to the skybox shader so that it renders the skybox shader to the frame buffer.

To hide geometry cropping, we use a normal dense fog to hide the boundaries. The fog needs to be opaque enough that you don't actually see the foghull box.

http://robotrenegade.com/q3map2/docs/sh ... ghull.html

Re: Levelwide fog and dist culling with _foghull & _farplanedist

Posted: Thu Sep 16, 2010 11:12 pm
by Delirium
works like a charm now, I was pointing _foghull to my fog shader