Fogculling problems.


(Kaziganthe) #1

Most of the times that I’ve attempted to do some foghulling in q3, I’ve had very similar problems, but now it’s almost neccessary that I use it. Now, the setup.

Path to sky directory:
textures/kazdm2_sky/

Image files within that directory (all 8x8 pixels):
kazdm2_ft.jpg
kazdm2_bk.jpg
kazdm2_lf.jpg
kazdm2_rt.jpg
kazdm2_up.jpg
kazdm2_dn.jpg

Foghull shader name:
kazdm2_sky.shader

Shader Contents:


textures/kazdm2_sky/foghull
{
	surfaceparm nolightmap
	surfaceparm trans
	surfaceparm nonsolid
	surfaceparm sky

	skyparms textures/kazdm2_sky/kazdm2 0 -
}

Fog shader contents:


textures/sfx/xlightgreyfog
{
qer_editorimage textures/sfx/fog_grey.tga
surfaceparm	trans
surfaceparm	nonsolid
surfaceparm	fog
surfaceparm	nolightmap
qer_nocarve
fogparms ( 0.7 0.7 0.7 ) 1400

}

My fog brush:

My worldspawn values:
_foghull - kazdm2_sky/foghull
_farplanedistance - 700

My compile lines:
-meta -vis -light -fast -filter -gamma 1 -compensate 1

(I might interject now that I know -filter is outdated.)

In-game screenshot:

Now, if you look at the above shot, you’ll notice that geometry isn’t being culled by the foghull at all. If you look at the editor shot, you’ll see that the total size of the map is definitely more than 700 units across. What am I doing wrong? Thanks.

Edit: code tagged stuff :banana:


(cis) #2

ur fog culling distance is 1400, which might be a bit high judging your position and mapsize by the screenshot for getting opaque fog between u and the architecture shown. that the things are not culled by ur farplanedist (dont mix this up with fog culling, which simply obscures the view, farplanedist culling makes stuff not being drawn at all, also not with showtris) might be related to ur -vis.

if ur vis data size allows it, maybe try a blocksize of 256 256 0 in worldspawn and add one or 2 hint brushes to ur map. make the hint brush in x and y the inner size of ur map’s hull, and in hight maybe 128 units. let it’s bottom start at 128 hight. if thats not enough, add another brush above it, either touching the hint below for a single portal layer or higher up for 2 portal layers.

the smaller blocksize should get the farplanedist working. u will have to fine tune the relation between the fog’s distance to opacity, farplanedist culling and the map’s blocksize for optimal effect.

i dont know how it is in q3v, but in sof2 the optimal farplane dist seems to be much smaller then what looks like to be right. for ur mapsize in sof2 i would already try a 256 or 512 farplane dist with a xy blocksize of 128-256. u will have to play around with the values to find the optimum.

just note that farplane dist culls whole vis blocks and not single parts of geometry, and stuff reaching into a drawn vis block might get drawn even if a lot of it is in a not drawn block.

the map seems very nice, got a screen without show tris? what are those black blurry lines in the sky?

ps.: the foghull doesnt cull the architecture at all, it just prevents the map from getting a hom effect when its outter hull gets culled by farplanedist. it’s creating a sphere with the fog color around the player, and it encloses the whole map. like this its always in between u and the void, which prevents the hom effect.

edit: with fog culling i mean the fog’s distance to opaque :wink:


(obsidian) #3

Your fogparms “distance to opaque” value is 1400.
Your worldspawn “_farplanedistance” value is 700.

Your _farplanedistance value must always be greater than the distance to opaque value.


(Kaziganthe) #4

So farplane culling culls blocks of vis and not individual brushes right?

Diagram:

Do I understand correctly that the blocksize sets the vis chunks?

I set the blocksize to 256 and stuck a big hint brush in the middle of the map and it still doesn’t cull anything. :confused:


(obsidian) #5

Looking at your screenshot of the editor reveals that your _farplanedist value is far too high considering the size of your map.

Your _farplanedist value is set at 700, meaning that it will start to cull geometry beyond a radius of 700 game units away from the player. Your entire map has a boundary of 1024x1024 game units. That doesn’t leave much room for the foghull to actually cull anything.


(cis) #6

the big hint was only meant to create portals in z plane, as i suggested 256 256 0 as blocksize (x y z). they are not needed for the culling, maybe u dont need it at all. but if u have structural brushes (that dont go up to meet with the top of the hull), which u want to block vis with, then its needed (unless u prefer that workaround with using sky brushes to create “rooms”, but then those brushes are obviously not trespassable anymore).

it culls blocks of vis, yep. and the blocks are either made by the blocksize values (x y and z) or manualy by placing hints. its the blocks u can see with the prt viewer in gtk. the blocks probably also have a real name i suspect :wink: (leafs maybe?)

to get the culling working in ur map so u have a point to start working from, try blocksize 128 128 0 and a _farplanedist of 256 (make sure u had _farplanedist and not _farplanedistance as key, in sof2 we use a different key but in q3 its _farplanedist iirc). thats pretty extreme values, but once u see it works u can start finding the balance between farplanedist and blocksize, to cull as much as possible without making stuff disappear that is closer to you then the fogs distance to opacity (then u see the popping effect).

i think the farplanedist culling should measure from the outer rim of the vis block u r in. from that point it measures the distance (for example 512 units) and all blocks that can be reached with 512 units do not get culled. all blocks that cant be reached with 512 units do get culled. at least this is the only logical explanation i can see for needing to use quite small values (compared to the values that seem right).

so if u set ur fog shader to a distance of 500 and the blocksize to 256 and the _farplanedist to 512 then theoreticaly it should work fine for culling roughly half of ur map. but something seems to be inconsistent about it (at least in sof2) so u will most likely have to simply try around to get the values that realy do what u want. the smaller the blocksize the more exact u should be able to adjust the culling to ur liking.

edit: oops, was late :wink:


(ratty redemption) #7

very useful posts guys, I`m new to this type of culling and am learning a lot from this :slight_smile:


(Kaziganthe) #8

Lol, it was the misspelling of _farplanedist. I had _farplanedistance. All is good :slight_smile: Thanks


(ydnar) #9

Incidentally, use -skyfix in the bsp phase to get rid of the black lines on the edges of the skybox.

y


(Kaziganthe) #10

Actually, because skyfix sometimes doesn’t completely rid me of the lines, in this case I made a _skybox that contained 6 grey (same color as my fog) images so that the sky wouldn’t be an issue.