Stacked sectors
Contents |
Introduction
Stacked sectors, also known as portals are a nice way to give the illusion of true 3D architecture, though their current implementation is slightly limited thanks to ZDoom's rendering engine. It is best to use them sparingly and not attempt to use them as often as 3D floors.
Using
To make stacked sectors you first need to create two sectors with the same shape and size (it isn't strictly necessary that the sectors be the same shape, but this is a good way to start). Next you need to set the sector heights accordingly. The ceiling of the lower sector should be the same as the floor of the upper sector. Again, this isn't strictly necessary, but is a good way to get started. For instance, you could make the lower sector have a floor height of 0 and a ceiling height of 128 and the upper sector a floor height of 128 and the ceiling a height of 256.
Note that the outlines of upper and lower sectors do not need to match. Any sector whose floor or ceiling is to act as a portal into another area must have a stacked sector thing in it, but the sectors in the region that the player is looking into do not.
Once both areas are done, there is two different ways of establishing the portals. The linedef method is especially interesting when there are many sectors that must share the same portal view.
With a linedef special
Choose two linedefs that are at the "same" place in both areas. Mark them both with special 57:Sector_SetPortal and give them appropriate parameters as explained on the special's page.
With stack points
Place thing 9077 in the sector you want to be on top, place thing 9078 in the same spot in the lower sector, and give them both the same TID. If you've ever used TeleportGroup you can think of this as working in a similar fashion, thing placement-wise.
If you'd like a texture to be drawn 'between' the sectors, set the first argument of each stack thing to the desired opacity, where 0=totally transparent, and 255=totally opaque. If the texture has transparent parts, those parts will always be drawn completely transparent. In this way you could, for example, make a net (X pattern at 255 opacity) or glass with streaks (/ pattern at maybe 128) between the upper and lower areas.
This way of defining portals has been deprecated. For new maps it is advised to use the linedef based methods because it creates far more robust portal setups.
Limits
Keep in mind that ZDoom treats mid-textures on 1-sided lines as extending infinitely far up and down, lower textures infinitely far down, and upper textures infinitely far up. This has the implication that, the sector you are looking into must not have any walls or upper/lower textures that would occlude the 'portal' (the area of the floor/ceiling where the 2 sectors appear to meet) if the player were standing behind those walls in the corresponding part of the 'viewed' sector. If you did not follow that, perhaps this diagram will explain things better.
P = player U = upper sector L = lower sector < = east-facing wall > = west-facing wall I = imp . = point of interest Lower region: P . L Upper region: < > U I
In the map illustrated above, you might expect the player to be able to see the imp through the hole in the ceiling. Instead, the hole will appear to be filled with the east-facing wall in the upper region. To avoid this situation, the mapper would either have to make sure that the player can never see the hole in the ceiling from behind the point of interest, (re)move the east-facing wall, or replace the wall with a lowered (almost but not quite to the floor) ceiling. The west facing wall, on the other hand, should not pose any problems, be it a 1-sided line or the lower texture on a raised floor; since that wall faces away from the player, ZDoom would never draw it.
Demo map
This demo map is something quickly whipped up to demonstrate some of the things possible with this new effect. First off you'll notice the bridge (if you noclip out of the bridge it will seem like you are floating) which is a pretty straight forward effect. The second part makes use of flat translucency to make a faked reflection effect.
It also features stacked sectors in conjunction with teleporters and Transfer_Heights to allow the player to 'jump down into' the lower part of the stack from the upper part, though as mentioned before there are certain limits with visible textures.