Stacked sectors

From ZDoom Wiki

Jump to: navigation, search

Contents

Introduction

Stacked sectors are a nice way to give the illusion of true 3D architecture, though their current implementation is slightly limited thanks to Doom's rendering engine. It's best to use them sparingly and not attempt to use them as often as, for instance, Legacy's 3D floors (which are not a portal trick).

Using

Using stacked sectors is simple. First off you need to add things 9077 and 9078 to your configuration for your editor of choice. Thing 9077 is for the upper sector in the stack and 9078 is for the lower sector in the stack. Both things take a single argument which is the translucency of the floor or ceiling being used for the portal.

To make stacked sectors you first need to create two sectors with the same shape and size. After that place thing 9077 in the sector you want to be the upper sector and 9078 in the same spot in the lower sector and give them both the same TID. If you've ever used TeleportGroup then this works in a similar fashion.

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. So for instance if each sector has an overall height of 128 you should (for instance) 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.

If you'd like for a translucent flat effect, the first argument of each stack thing can be adjusted accordingly. A value of 0 will make the flat invisible and a value of 255 will make it opaque, with values in between being translucent.

Note that you can also use a masked texture or PNG for the floor/ceiling (masked meaning it has transparency in it) of each stack and ZDoom will render it normally (with whatever translucency you set). This isn't shown in the demo map, but it's pretty straight forward.

Limits

Of course there are certain limits to this, as I mentioned before thanks to Doom's quirky rendering engine. First off you will get HOM or flat bleeding errors when certain issues come into play.

When viewing the lower sector from the upper sector any upper textures visible in the lower sector will cause HOM errors on the floor. Likewise, when viewing the upper sector from the lower sector any lower textures will cause similar errors on the ceiling. These problems can be avoided by careful restrictions on where the player can and cannot go or you might want to try some crazy scripting to shift sector heights accordingly to where you are. EDIT: This can be avoided by using 2-sided midtextures as an alternative, but that depends on what you're using it for. You won't be able to see the tops of the stacked sector anyway, so this is mabye the best way to go if you want your portal to be seen anywhere.

The second thing you need to worry about is making sure there is enough room in the stack the player is not in to render the other stack. This works on the same premise as mirrors, if you've ever used Line_Mirror. Simply put you need to make sure that anywhere you stand and see through the floor or ceiling into the other part of the stack there needs to be 'room' for it to be rendered. An easy way to see if there's enough room is to take the stack pieces and overlay them in their respective positions. If the one you moved overlaps another part of the map then there isn't enough room.

I've also encountered ZDoom locking up if you noclip into the void. Also any error you make in making the stacked sectors (for instance if you don't follow the sector height rule) will usually result in ZDoom locking up.

You can stack up to three sectors, but the player can only exist in the middle sector without ZDoom locking up (this may be fixed in the future?).

Demo Map

This demo map is something I 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.

I've also used 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. I'm sure there are lots of other effects possible that I haven't even thought of, so go nuts. Features such as Skyboxes using transparency for an effect similar to quake.

http://cyb.vect.org/zdoom/stacktest.cab (9 KB)

Real 3D Floors

If you're looking for real 3D walk over/under floors without any "illusions", you should refer to GZDoom's 3D Floors.

See Also

Tutorials

Personal tools