Game Development Community

Portal/Zone Weirdness

by Mitovo · in Torque 3D Beginner · 02/09/2015 (2:28 pm) · 8 replies

So, I have a strange issue that I can't seem to work out, regarding the use of portals and zones inside a building.

First, here's a basic diagram I created to illustrate what's happening, so my explanation should make more sense...

Now, in case it's a curiosity to anyone, Portal 2 extends so far into Zone 2 because I realized that I have to make sure I'm inside a portal at any point where there's a line-of-sight to the exit door (Portal 1). Otherwise, everything outside the door/portal 1 is hidden and then suddenly "pops" in once I've entered Zone 1.

That said, the picture more or less illustrates what's happening.

When I'm standing in Portal 2, and looking toward the walls in the direction of the Scenery, in Wireframe mode, I'm able to see that scenery... even though there's a Zone in the way, and no windows/portals to see through.

Why is that?

I was under the impression that the only way to see out of a zone is if there's a portal to see through. Since Portal 2 "sees into" Zone 2... shouldn't the Scenery on the outside of the building be hidden? Why is the Scenery still being rendered?

It seems like being inside a Portal has the effect of letting you see anything/everything, as though the Zones aren't there at all, which seems to defeat the purpose of using them.... Unless I'm missing something?

Hopefully I've explained myself well.

Any assistance with this is appreciated, 'cause I'm at a loss here.

Thanks!


#1
02/09/2015 (6:22 pm)
Portals are for joining zones - while you are in a portal I suppose you probably can see everything. I always make them very thin slices that are wide/tall enough to match the opening and only thick enough to intersect with the two zones involved. That way it's less likely that someone would be actually standing in a portal - if you place them correctly and size them right it should be pretty tough to get the camera just right....
#2
02/09/2015 (8:42 pm)
Hmm, then I might have to reconfigure the zones in that setup, because if I make the portal too thin (Portal 2, specifically), then I have the issue I described above, where if I can see out the door while still in Zone 2, then everything outside the building vanishes, until I enter Zone 1, which is really ugly. If I had to choose one or the other, I'd sooner have the scenario of "scenery" being rendered through the walls.

But... I might not have to make that choice. Let me try a different setup. I think I know something that will work. Let's see if I have the right idea.

Edit...

Okay, got it to work. It's funny, I considered this layout earlier, but for some reason thought it wouldn't work. Go figure, right?

Here's a pic of how it's set up now

So, that's one issue solved. At least in the future, I'll have a better idea of how to approach these things.

So, I'm 1 for 2 today. Not terrible.

Now to figure out the lighting issue in my other thread.

Thanks!
#3
02/10/2015 (1:21 am)
The best results portals will be like windows, doorways, corridors etc. In you example you have 2 zones connected with a portal(2) in one room. I'm afraid there's not a whole lot to gain with that, beside improper culling; or did you see an increase in fps?
#4
02/10/2015 (4:38 am)
I think the convex shapes(the sketch tool) can be converted to zones if the reason your doing it this way is because of the "L" shape. You can make that one zone.
#5
02/10/2015 (5:18 am)
I'm using the convex tool to create the zone/portal shapes, then converting them.

I have the two zones because I want the entire interior to be zoned.

Trying to use one large zone puts a large chunk of it outside the building, which results in stuff disappearing if I'm standing inside the portion of the zone that extends outside the building (inside the corner of the 'L'). That's not desirable, either.

In what I've seen/read about zones/portals, I haven't seen anything that would indicate an alternative way to set that up, without having the two zones, and a portal between them, to avoid the drawing issues I had with the previous setup....?

#6
02/10/2015 (6:22 am)
Technically, an L-shaped object isn't convex, so I don't know if that would work as a zone. It should, but I haven't personally done it. I remember the discussion talking about n-gons for covering non-square convex volumes but I don't remember anyone mentioning arbitrary "polysoup" geometry.

Personally, I might have reversed the split - make the area from the door to the back wall "zone 1" and the part in the dead end "zone 2," but it really doesn't matter as far as I can tell.
#7
02/10/2015 (6:36 am)
Hiya, Richard,

Your suggestion (for the other zone layout) is what I'd done to begin with (see the linked pic in my first post). That created the problem where the portal between Zones 1 and 2 had to be wide enough that at any point where I could see from that dead end area (what would be Zone 2 in that setup) to the door, I'm inside a portal, else anything outside the door wouldn't render, and there's a really obnoxious pop-up that occurs once I step into Zone 1.

The real problem with that setup, though, is the problem I opened the thread with.. where as long as I'm inside a Portal, it's rendering scenery that should, technically (or at least intuitively) be culled, through the use of the zones. So, making Portal 2 that large solves one problem, but creates another.

As for using concave shapes over convex, to my knowledge the sketch tool doesn't allow you to create a single, concave object. Any time I extrude to create a concave shape, it creates a new and separate convex object instead.

Only way to have a true concave object would be to use a custom polymesh object. I'm not aware of any way to convert a poly mesh to a zone? Haven't tried, but I haven't seen any mention of it in my searching/reading.
#8
02/10/2015 (12:17 pm)
Ah - I guess standing at that angle it would be more likely that you would intersect that portal with the camera.

I'll have to start playing with this stuff a little - I remember finding spots where I had a zone in a building and portals connecting door and window to the "outdoors" where if you stood in the doorway just so the terrain stopped rendering....