Setting variable cull distances?


(G0-Gerbil) #1

Dunno if there’s a way of doing it already, but I am considering a map that will consist of two distinct areas - a jungle / forest bit, and an open plains style situation.

Ideally the jungle will have EXTREMELY dense foliage using a combination of ET’s foliage / terrain parameters and lots and lots of tree models. The aim is to limit visibility massively, for a close combat style area.

Of course, you are all immediately thinking ‘crap framerates’, but I can get around this by having an extremely short culling distance (won’t even really need fog since the foliage will obscure everything).

However, of course this is totally not going to help the open plains bit.

So… I came up with the idea of either creating a new compile-time entity or a new texture (although entity idea is a damn sight easier), both to acheive the same effect, which is basically an area-defining cull distance effect.

It doesn’t need to be complicated, so a quick run-down could be:

  • You create an axial-aligned brush (same sort of thing as volumetric fog)
  • Paint it with trigger texture
  • You turn it into a misc_cull_distance entity
  • You set a key / value pairing in the entity of something like:
    cull_distance
    1024

As far as I can tell it only needs to be a compile-time option. misc_cull_distance entity would override worldspawn cull distance, and would affect any portal calculations crossing the entity brush boundary as well, eg a ray going into it from outside would have portals inside using the entity cull distance, while rays going outside from inside would check portals outside using the outside cull_distance

I reckon this flexibility should be relatively easy to implement (har, famous last words - I wonder if Ydnar is sick of people second-guessing his workload? :wink: ), and would be pretty useful in a variatey of situations - certainly it would allow the type of map I describe (some areas of extreme detail, others not) very simply, which you currently can’t really do.


(ydnar) #2

That wouldn’t be that hard, I suppose.

It’d have to be a special hint-type brush that worked with fog, that let you specify culling distance inside of it.

Hm.

y


(G0-Gerbil) #3

Yeah, as I said, initially I thought of it like a texture you painted a brush with, but adding the distance parameters would mean creating a new texture for each area. While not indeed hard, it’s simplicity itself to create a new entity which would make the key / value thing much simpler.
Given that radiant will import multiple DEF files, you could just create your entity in cull_distance.def, let people install it and away you go.

He said, once again placing his own judgement before Ydnar’s rather larger knowledge of the whole thingy :smiley:

If you get the urge to implement this, I’ll donate to the Ydnar beer fund \o/

Out of curiosity (and semi-related, given I want close culling), is there a way to specify the NEAR plane of fogging?
I do my own 3D code, and I rarely set the near fog plane to zero, which is what it appears to be in every iteration of the Q3 engine I’ve seen. It’s kind of annoying, because if I had a close draw distance, I’d want the near fog plane to be further ahead so you get at least some area of clean visibility.


(pazur) #4

very good idea. i would like to see that too :wink:


(G0-Gerbil) #5

Erk, just realised why you are thinking of making it a texture as opposed to an entity - ignore me, I’ll only pipe up again if you implement it.
Do you accept paypal? :smiley: