Reducing draw distances using fog


(Danyboy) #1

Ok - any help useful on this question

I am planning a map made of 3 tiers (heights: beach, hill, upper hills)

since its a fairly squareish map and it gunna be pretty big in length i don’t want the ppl on the highest tier able to see to the lowest since they will be seeing the majority of the map.

If I were to place a large fox brush(es) outside would this help the compiler or engine during play? Would the lowest tier - provided there is enough fog - not be drawn by the engine?

Not too concerned about compile times - just the in game fps


TLR200


(Prophesy) #2

While we are at it, Id like to add a few more questions that are somewhat connected :blah:

About the stunningly beautiful Battery map:

  1. How was the “fading” horizon created, the end of the sea and sky?

  2. When looking at coastline from up above, it looks like you can see the waves coming in, the water looks brighter where it is more shallow. Hmm… maybe not the best way to ask, but perhaps you still understand what I mean. How was this very nice effect created?


(Wils) #3

If you’re planning on a totally open map with fog to block visibility across the entirity of the map, you’ll need to do the same thing we did in Railgun, and have the compiler split the map up into blocks for vis.

Fog in ET doesn’t block visibility by default. Although it can cull polygons, this is probably too CPU intensive for your needs. To properly block visibility, you need to divide the map up into blocks and cull each based on its distance from the player (aka farplane culling).

To do this you’ll need to place the following keys/values in your worldspawn entities:

[i]_fog <your fog shader>

_blocksize <integer value, defines the size of the vis blocks>

farplanedist <distance at which the farplane exists>

fogclip <distance at which a fully opaque fog bank is drawn, which takes values from your fog shader>[/i]

_blocksize should probably be a power of two (we used 512 in Railgun, you might find 1024 is enough). Bear in mind that the smaller you make this number, the more blocks your map gets split into.

More blocks leads to exponentially higher vis data sizes, which is a Bad Thing because your map will use too much memory and take ages to load. Not enough blocks means you end up drawing more than you need to and your FPS will suffer.

farplanedist and fogclip should be the same value, and should match the last value in the fogparms for your fog shader.

With this all set up, when you compile your level with the ET tools it should only draw the area you’re currently in, plus any areas in your view frustum that fall within the farplane distance.

Any areas beyond that will be culled, and any polys that fall within the spaces between the vis block and the farplane should be culled by the world fog.

On the subject of fog, you can add a global fog shader to ET maps and get similar world fog to RTCWs (except that it’s now compiled into the map and can’t be turned on or off with a cvar), so you don’t need to add fog brushes unless you’re trying to do something specific with them, such as low lying fog in a valley.

Hope that helps (and I’m sure one of the code monkeys will correct me if I’ve got any of this arse-backwards :)).

Wils


(Wils) #4

It uses a metashader in the same way terrain does (it’s actually non-solid terrain with deformvertexes and a big invisible water brush). At the edge of the horizon it blends to a full transparent layer.

If you mean the wash, it’s the same as above - it’s a seperate layer on the terrain which gets blended in around rocks or the shore.


(Danyboy) #5

If i were to set the worldspawn with the fog keys/values - would that create fogs in buildings i place in the map?


(chavo_one) #6

affirmative, at least it was that way in RtCW.


(Danyboy) #7

hmm - Railgun central building (with command post) has no fog in it


(chavo_one) #8

The fog distance is probably greater than the building length in that case. But if you use a thick fog in the worldspawn, I believe you will notice it inside of buildings.


(Danyboy) #9

hmmm - something gone tits up with the fog

i add the _fog into worldspawn and it produces error - map doesnt even load up

Error:

Fog brushnumber out of range

  • erm - hmm?