Levelwide fog and dist culling with _foghull & _farplanedist

Discussion for Level editing, modeling, programming, or any of the other technical aspects of Quake
Post Reply
Delirium
Posts: 102
Joined: Mon Apr 27, 2009 10:05 am

Levelwide fog and dist culling with _foghull & _farplanedist

Post 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
[url=http://gotdelirium.com/][img]http://www.gotdelirium.com/stuff/gdd.png[/img][/url]
Noruen
Posts: 308
Joined: Thu Jan 28, 2010 11:45 pm

Re: Levelwide fog and dist culling with _foghull & _farplanedist

Post 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.
jal_
Posts: 223
Joined: Mon Mar 24, 2008 4:13 pm

Re: Levelwide fog and dist culling with _foghull & _farplanedist

Post 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.
Last edited by jal_ on Thu Sep 16, 2010 3:42 pm, edited 4 times in total.
ShadoW_86
Posts: 270
Joined: Tue Jan 08, 2008 1:20 pm

Re: Levelwide fog and dist culling with _foghull & _farplanedist

Post 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?
[url]http://shadowsdomain.wordpress.com/[/url]
jal_
Posts: 223
Joined: Mon Mar 24, 2008 4:13 pm

Re: Levelwide fog and dist culling with _foghull & _farplanedist

Post 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.
Last edited by jal_ on Fri Sep 17, 2010 10:01 am, edited 1 time in total.
obsidian
Posts: 10970
Joined: Mon Feb 04, 2002 8:00 am

Re: Levelwide fog and dist culling with _foghull & _farplanedist

Post 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
[size=85][url=http://gtkradiant.com]GtkRadiant[/url] | [url=http://q3map2.robotrenegade.com]Q3Map2[/url] | [url=http://q3map2.robotrenegade.com/docs/shader_manual/]Shader Manual[/url][/size]
Delirium
Posts: 102
Joined: Mon Apr 27, 2009 10:05 am

Re: Levelwide fog and dist culling with _foghull & _farplanedist

Post by Delirium »

works like a charm now, I was pointing _foghull to my fog shader
[url=http://gotdelirium.com/][img]http://www.gotdelirium.com/stuff/gdd.png[/img][/url]
Post Reply