Jump to content
The Dark Mod Forums

Visportals vs func_portals vs antiportals


SteveL

Recommended Posts

Occluders would be an addition that does a lot less but is much easier to use. Basically they would be 2D shapes that mappers can place in a map (and that can be controlled by scripts, triggers etc, or be bound to moving entities) that simply act like a blackened pane of glass, preventing anything behind them from being sent to the graphics card.

 

Ok, that's a good explanation.

 

I assume the functionality is limited to single-sided planes, like visportals? Otherwise, wouldn't it be ideal to just add that functionality to brushes by default?

Link to comment
Share on other sites

Ok, that's definitely a consideration... However, AFAIK, this is a discussion about a new map object called func_ occluder rather than changing anything that maps currently use ( other than the Visportal alignment fix).

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

True, but we don't want the occluder to occlude things that need to be seen. I think it was mentioned above that if a func_static is entirely behind an occluder, it's okay for it not to be rendered (good), but if some parts are behind and some are not, we don't want the occluder to find the parts that are behind and thus take the entire func_static out of the scene (bad).

  • Like 1
Link to comment
Share on other sites

True, but we don't want the occluder to occlude things that need to be seen. I think it was mentioned above that if a func_static is entirely behind an occluder, it's okay for it not to be rendered (good), but if some parts are behind and some are not, we don't want the occluder to find the parts that are behind and thus take the entire func_static out of the scene (bad).

 

Exactly. And this is also why the mapper must place it manually, and we can't just add this to worlspawn brushes on general. The places where one would use it are rather limitied, in most cases visportal is the better choice.

 

Techncally, yeah, one could go overboard with the occluders. Cart on wheel? Add occluder! Free-standing bar top? Add occluder! Clothes on a zip line? Add occluder! (The thief might somehow hower in the air in front of the clothes) and so on. In a lot of cases the occluder would only bring minor performance gains in selected circumstances (e.g. the player has to be on one side, massive geometry on the other side hidden 100%).

 

However, it has it's places in outdoor scenarioes or in caes where half-broken wall covers sometimes an open doorway (with a large view behind).

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

Very brief update because my brain ran out of steam shortly after that last post and I left further actions for this evening.

 

Entity culling does what was expected, and AI don’t get put back in stage 3. I’ll step through that bit of code later to make sure I understand why. I have a couple of weird bugs to look into though. I can occlude a barrel or an AI ok, but if I stand them next to one another, they vanish and repop at the same time, when either is occluded. No idea what’s causing that but it was first-draft code and it feels fixable.

 

After entities, there’s lights to be considered. They can be taken out of play too if their entire volume is occluded.

 

A design question: should occluders be 1-sided or 2-sided? The coding default is 2-sided: if we want them 1-sided we’d need an extra test to see whether the view was on the right or wrong side. But that’s no big deal. It’ll make no difference to performance unless 2-sided would mean lots of useless occlusion in many situations, so it comes down to how they’d be easiest to use.

 

If people let occluders get outside of a visible model, they’ll see some weirdness. AI heads are separate entities from the body, so if you use a bare occluder and position yourself right you can see an AI head float past and greet you.

Link to comment
Share on other sites

A design question: should occluders be 1-sided or 2-sided? The coding default is 2-sided: if we want them 1-sided we’d need an extra test to see whether the view was on the right or wrong side. But that’s no big deal. It’ll make no difference to performance unless 2-sided would mean lots of useless occlusion in many situations, so it comes down to how they’d be easiest to use.
If the performance difference is marginal, I'd say two-sided. Having to decide which way it should face to work can become confusing (to people unfamiliar with how engines work, it's unintuitive enough that a single one-sided plane won't drop shadow if it's facing a light).
Link to comment
Share on other sites

If the performance difference is marginal, I'd say two-sided. Having to decide which way it should face to work can become confusing (to people unfamiliar with how engines work, it's unintuitive enough that a single one-sided plane won't drop shadow if it's facing a light).

True, that's a strong point in favour of two sided. I need to retract or clarify what I said about performance though. An occluder that doesn't hide anything is a bad thing for performance, because stuff will get tested against it without any benefits. Maybe that would happen a lot with 2-way occluders.

 

Spawnargs are an option too of course.

 

I need to think more about how the occlusion tests will be ordered in reality. That might shed more light on it. Right now in my test map I'm simply testing every entity in every open visleaf against every "visible" occluder. There might well be more efficient ways to do it, although most of the tests will end up being very cheap as we can do a quick bounding box check or screen rectangle check to exclude most entities before doing a more expensive comparison against the actual shape of the occluder.

Link to comment
Share on other sites

Do occluders stop rendering everything behind them, or do they only close visportals that are behind them?

Link to comment
Share on other sites

Plan is they should block all entity models and lights as well as VPs.

 

I have the VP-closing working already. I'm working on testing entities. Lights I haven't tried yet.

 

If I can get it working right, entities and lights will only be culled if their entire bounding box sits within the occluded zone. That's a 3d shape that starts at the occluder surface itself, and continues "back" into the screen. The sides spread out slightly because.... actually I'll take 5 to do a quick diagram. Should save some typing!

 

post-29566-0-07514200-1408373994_thumb.png

 

The yellow area is the player's view, the area that would normally generate light/surface interactions and load stuff to the graphics card. The blue bar is the occluder, and the pink area is the occluded zone. It spreads out from the occluder face because it's shaped from the player's eye position.

 

In this pic, 1 light, 1 barrel, and one VP get occluded. The tall thin light volume doesn't, because it sticks out of the occluded zone. Likewise the second barrel.

  • Like 1
Link to comment
Share on other sites

Cool!

 

Again, I have to wonder, in a perfect world wouldn't we want this to happen by default for all regular brushes? Is it just too difficult to do?

Link to comment
Share on other sites

Another intriguing idea. It mightn't be too difficult to do from a coding point of view... you could generate occluders from the silhouettes of solid opaque brushes. But there's a danger it could slow the renderer down, if there are too many tests done to see whether any entities are hidden by an occluder when for that occluder the answer always turns out to be "no". I can't predict which way that would go. It might work out great, it might not. We'll probably know more after we've had a chance to play around with occluders a bit.

 

One issue is that a lot of (most?) opaque brushes already occlude because they face out on to a different visleaf or the void. Adding occluders for those would be pure waste. So we'd have to figure out a way to tell the difference before generating the occluders.

Link to comment
Share on other sites

NB I've not even got as far as working out where occlusion should happen in the rendering flow yet, which is why I can't think about the brush question much yet. The most fundamental choice will be:

  • Should occlusion happen after the entities and lights in view have been discovered, so it tests and filters the stuff that's about to be rendered ?
  • Or should it happen before that process, so that it filters the lights and entities that get considered for viewing?

I'll need to do some profiling in real maps to figure out that one. At a quick glance, the occlusion tests look faster than the in-view tests because they generally have less work to do. They're just figuring out "is this blocked?" whereas the current renderer tests answer questions like "exactly which parts of this model are in view?". But both processes have ways of cutting down their workload by doing quick tests that deal with the commonest cases before moving on to precise tests when the first test passes, so without actually taking some measurements on real maps it's hard to guess how much work will get done by any given chunk of code.

Link to comment
Share on other sites

One issue is that a lot of (most?) opaque brushes already occlude because they face out on to a different visleaf or the void. Adding occluders for those would be pure waste. So we'd have to figure out a way to tell the difference before generating the occluders.

 

Yes, that's a good point. It would only make sense for brushes that are within an open leaf (it would be a waste to have any occluders operating inside closed leafs, wouldn't it?).

Link to comment
Share on other sites

Last theoretical note from me before I get back to work: we don't yet know whether there'll be noticeable performance benefits. The engine is already highly efficient at culling unnecessary work. It caches a lot of data that it used last frame, and it doesn't apply shaders to entities tris until it knows they'll be seen on screen. So the gains might be a bit marginal. But there're grounds for cautious optimism: other games find them beneficial; they'll certainly be able to cut out unnecessary animated mesh updates (which is pure front-end); and we know VPs do help a lot with rendering time. So extending the VP method of culling stuff to more situations might well squeeze out some more fps.

Edited by SteveL
Link to comment
Share on other sites

Yes, that's a good point. It would only make sense for brushes that are within an open leaf (it would be a waste to have any occluders operating inside closed leafs, wouldn't it?).

 

Not sure what you mean by open/closed leafs?

Link to comment
Share on other sites

Very brief update because my brain ran out of steam shortly after that last post and I left further actions for this evening.

 

Entity culling does what was expected, and AI don’t get put back in stage 3. I’ll step through that bit of code later to make sure I understand why. I have a couple of weird bugs to look into though. I can occlude a barrel or an AI ok, but if I stand them next to one another, they vanish and repop at the same time, when either is occluded. No idea what’s causing that but it was first-draft code and it feels fixable.

 

After entities, there’s lights to be considered. They can be taken out of play too if their entire volume is occluded.

 

A design question: should occluders be 1-sided or 2-sided? The coding default is 2-sided: if we want them 1-sided we’d need an extra test to see whether the view was on the right or wrong side. But that’s no big deal. It’ll make no difference to performance unless 2-sided would mean lots of useless occlusion in many situations, so it comes down to how they’d be easiest to use.

 

If people let occluders get outside of a visible model, they’ll see some weirdness. AI heads are separate entities from the body, so if you use a bare occluder and position yourself right you can see an AI head float past and greet you.

 

:D

 

Me thinks it makes sense to add "r_showOccluders" so you can visually debug them (like visportals).

 

As for one-sided - would there ever be a case you'd want it only be occluding from one side?

 

I can think maybe of "half-transparent" windows - you can look in from the street, but you cannot look out once you are inside. (because the street is huge). But I'm not sure this special case is really needed?

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

Cool!

 

Again, I have to wonder, in a perfect world wouldn't we want this to happen by default for all regular brushes? Is it just too difficult to do?

 

I'd rather have this to be a manual tool. There are an aweful lot of brushes, you'd end up with thousands of occluders that never occlude anything (like the floor).

 

Plus, then you could not stick an occluder into a barrel, f.i. (the barrel could even be moveable and still contain a cross-sectin of two occluders.

 

Let's first get the implementation right, then we can worry about using it automatically.

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

Not sure what you mean by open/closed leafs?

 

I think Springheel meant that if the occluder is itself in a leaf that is closed (e.g. not rendered), then the occluder can be inactive. You only need to test occluders that are in the currently visible space.

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

A closed leaf is any area behind a closed portal.

Ah yes, not sure why I didn't understand that first time round. That's right, occluders will only be used by the renderer if they sit in open leaves that are in front of the player's viewpoint.

 

:D

 

Me thinks it makes sense to add "r_showOccluders" so you can visually debug them (like visportals).

Already implemented, even at this stage in testing :) Currently using DebugWinding() to draw it in cyan.

Link to comment
Share on other sites

Ah yes, not sure why I didn't understand that first time round. That's right, occluders will only be used by the renderer if they sit in open leaves that are in front of the player's viewpoint.

 

Already implemented, even at this stage in testing :) Currently using DebugWinding() to draw it in cyan.

 

Splendig! :wub:

  • Like 1

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

As for one-sided - would there ever be a case you'd want it only be occluding from one side?
I can think of a couple. Basically any time the shape of an object doesn't allow for occluder's placement inside of it. E.g. a privacy screen, or curtains you can hide behind. With two-sided you risk accidentally occluding the object itself, or other small objects close to it. It's a pretty rare case though, and the use of an occluder probably wouldn't be justified in the first place.
  • Like 1
Link to comment
Share on other sites

I can think of a couple. Basically any time the shape of an object doesn't allow for occluder's placement inside of it. E.g. a privacy screen, or curtains you can hide behind. With two-sided you risk accidentally occluding the object itself, or other small objects close to it. It's a pretty rare case though, and the use of an occluder probably wouldn't be justified in the first place.

 

Hm, thinking about this, yeah, if you have a wave-shaped curtain, and wand to stick a strait occluder in it, that wouldn't work. But it is a special case, isn't it?

 

I envision of the occluder like a visportal (Steve, please correct me if I'm wrong): e.g. it is a brush, where all faces are no-draw, except one face.

 

The question is, is this face one-sided (e.g. the engine ignores it from one direction) or two-sided (like visportals).

 

If it is one-sided, then you can make it two-sided by just adding the same shader/texture to the other brush face. (Adding it to the small side-faces of the brush is also possible, but pointless for thin brushes. It make sense for larger brushes, tho).

 

If the occluder-face is always two-sided, then there is no way to make it one-sided.

 

There really might be cases where you want the occluder to only occlude from one side, the "window-see-through only from the outside" is one case. The "wall with large objects behind it" might be a second case, f.i. if the player either cannot get on the other side of the wall, or if he can get, there is nothing in the other direction that occluding makes sense (albeit moveables might enter the occluded space...)

 

Another case where one-sided makes sense is a "occluding box". If you stick three two-sided occluders into a crate perpendicular to each other, you can hold the crate in front of you and it properly occludes (given that occluders can be moved around, tho). With one-sided occluder faces you can also build a slightly smaller box and stick it in the crate. It would then use the 6 one-sided occluders, vs. 3 two-sided ones. The 3-two-sided only fors for boxes tho, for other geometries (like barrels, trapezoids etc.) you might be better of with one-sided faces approximating the geometry...

 

Decisions! :)

 

So, from the point of flexibility, I think a one-sided texture would be more versatile. It would, however, mean that we either need two different textures to cover both cases, or always have two faces on a brush painted with the occluder, so both sides occlude in the other direction. The latter case means two occluders (instead one with two side), tho, unless the engine could combine them somehow into one two-sided face..

Edited by Tels

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recent Status Updates

    • OrbWeaver

      Does anyone actually use the Normalise button in the Surface inspector? Even after looking at the code I'm not quite sure what it's for.
      · 6 replies
    • Ansome

      Turns out my 15th anniversary mission idea has already been done once or twice before! I've been beaten to the punch once again, but I suppose that's to be expected when there's over 170 FMs out there, eh? I'm not complaining though, I love learning new tricks and taking inspiration from past FMs. Best of luck on your own fan missions!
      · 4 replies
    • The Black Arrow

      I wanna play Doom 3, but fhDoom has much better features than dhewm3, yet fhDoom is old, outdated and probably not supported. Damn!
      Makes me think that TDM engine for Doom 3 itself would actually be perfect.
      · 6 replies
    • Petike the Taffer

      Maybe a bit of advice ? In the FM series I'm preparing, the two main characters have the given names Toby and Agnes (it's the protagonist and deuteragonist, respectively), I've been toying with the idea of giving them family names as well, since many of the FM series have named protagonists who have surnames. Toby's from a family who were usually farriers, though he eventually wound up working as a cobbler (this serves as a daylight "front" for his night time thieving). Would it make sense if the man's popularly accepted family name was Farrier ? It's an existing, though less common English surname, and it directly refers to the profession practiced by his relatives. Your suggestions ?
      · 9 replies
    • nbohr1more

      Looks like the "Reverse April Fools" releases were too well hidden. Darkfate still hasn't acknowledge all the new releases. Did you play any of the new April Fools missions?
      · 5 replies
×
×
  • Create New...