Portal

From Eternity Wiki
(Redirected from Portals)
Jump to: navigation, search

Portals are a powerful mapping feature which allow a variety of rendering effects; they allow an architectural surface to be used as a "window" which can display something besides the texture that would normally cover the surface. Anything from simple fixed plane, to another area of the map can be rendered within these surfaces via the same architecture.

Contents

[edit] Terminology

[edit] Portal Window

'Portal window' refers to the area of the screen that a portal occupies. For example:

Pterminology01.png

This is a simple map with no portal surfaces, and no portal window.


Pterminology02.png

This is the same simple map with a fixed plane portal applied to the ceiling of the sector. The portal window is outlined in white.


Pterminology03.png

This is the map, but the same plane portal is applied to the ceiling and the far wall. The two surfaces display the same portal, and as such, they share a common portal window (also outlined in white).

All surfaces in a scene that have a common portal will share the same portal window.

[edit] Dummy Sector

A sector off of the main map area which is used by line or sector specials as a model, or as housing for lines which need to be a specific size.

[edit] Fixed Plane Portals

Fixed plane portals (as the name implies) render a single, fixed plane into the portal window. The plane is always rendered a the same height and texture offset even when the camera changes its position.

Line specials:

283 Apply fixed plane portal to the ceilings of tagged sectors
284 Apply fixed plane portal to the floors of tagged sectors
285 Apply fixed plane portal to the floors and ceilings of tagged sectors

The front side sector of the special line is used to generate the plane. The ceiling texture, sector light, and ceiling texture scrolling are all used as attributes for the rendered fixed plane. The absolute height of the ceiling is used as the height of the plane. That is, if the special line front sector has a ceiling height of 64, the plane will always render at 64 units above the camera height. If the ceiling height is 128, the plane will always render at 128 units above the camera height, and so on.

For example:

Pfixedplane01.png Pfixedplane02.png

The left image shows a simple map with a small sector off to the side of the rest of the map. One of the lines in this sector has been given a 283 special which will apply a fixed play portal to all tagged sector ceilings. The height of the dummy sector is set to 128, the blue water texture FWATER1 is the ceiling texture, there is no scrolling applied to the ceiling, and the ceiling height is 128.

The right image shows what the map looks like in Eternity. Notice the rendered height of the plane is the same as a ceiling 128 units above eye level.

The line special 289 can be used to apply fixed plane portals to walls as well. The special will find a portal with the same line tag and will display that portal on the surface of the line.

Here is the map from above:

Pfixedplane03.png Pfixedplane04.png

The highlighted wall has been given a special of 289 and tagged to the portal line. In-game, the tagged wall now displays the portal. Note: The 289 line special works for all portal types.

[edit] Horizon Plane Portals

Horizon portals display two planes which appear to go on forever until they meet in the middle (horizon). The plane coordinates are not fixed, and will appear to move with the camera. This can be used to achieve the illusion that water or grass goes off far into the distance without having to make overly large sectors.

Line specials:

286 Apply horizon portal to the ceilings of tagged sectors
287 Apply horizon portal to the floors of tagged sectors
288 Apply horizon portal to the floors and ceilings of tagged sectors

Like the fixed plane portals, the front sector of the special line is used. The top plane uses the front sector ceiling (height, texture, scrolling, light) as its model, and the bottom plane uses the front sector floor (height, texture, scrolling, light) as its model. Example:

Phorizon01.png

This map has a horizon portal applied to the ceiling and wall of the sector where the player starts. Both sectors have a floor height of 0, and a ceiling height of 72, but the floor texture in the dummy sector is set to a grass texture, and the ceiling texture is set to FSKY_1. This produces a field of grass which goes on into the horizon. If the camera moves up or down, the floor plane will appear to move along with it. If the ceiling plane had a regular texture on it, it would also move with the camera and appear to go off into the distance.

Note: If the camera ever travels below the floor height of a horizon portal, the bottom plane will appear to move in the opposite direction of the camera movement until the camera is once again above the floor height.

[edit] Skybox Portals

Skybox portals draw another part of the map into the portal window. The scene in the portal window will use the angle from the player camera, but will render the scene from the location of the skybox camera. This helps create the illusion that the contents of the skybox actually surround the map and are much larger in size than they really are.

Line specials:

290 Apply skybox portals to the ceilings of tagged sectors
291 Apply skybox portals to the floors of tagged sectors
292 Apply skybox portals to the floors and ceilings of tagged sectors

The front sector of the special line becomes the "skybox sector". This is not the only sector that gets rendered, but this sector is where Eternity will look for the skybox camera object which will be the point the skybox is rendered from.

For example:

Pskybox01.png

This map has a skybox portal applied to the ceiling and wall of the sector with the player start. The "Skybox sector" is the small rectangular one which contains the EESkyboxCam object. The camera object always spawns on the floor, so the skybox sector has been made a glass floor 48 units above the surrounding area so the camera will be above the floor of the box.

Pskybox02.png Pskybox03.png

The first image is the view in-game when the player no-clips into the sky box. The second image is the view from inside the main map area with the skybox portal applied. No matter where the player moves inside the map area, the skybox portal will always render from the location of the camera inside the skybox, however, the skybox is rendered from the angle the player is looking. ExtraData also provides a means of assigning a z-height to objects in maps. This could also be used to raise the skybox camera off the floor. If the skybox camera is left on the floor, the floor plane will not render and result in HOM.

The skybox is not restricted to simple boxes. Any map architecture the skybox camera can see can be part of a skybox. Below is an example of a basic mountainous landscape created with map architecture.

Pskybox04.png

[edit] Anchored Portals

Anchored portals are the most powerful and complex of all the basic portal types. Anchored portals will render another area of the map into the portal window, but the portal camera moves as the player moves, creating the illusion that the other area of the map is actually connected to the main area. This can be used to create the appearance of 3D architecture. Before use, however, an understanding of how these portals work is important.

In order to piece the parts of a map together, an anchored portal needs to know how far apart they are. The distance is determined with the use of specific line specials. Each anchored portal needs a "portal line" (the line with the anchored portal special) which usually area the portal should render, and an "anchor line" which is usually located in the main map area. The distance between these lines becomes the offset, that is, how far Eternity needs to move the camera from where the player stands to get the portal area.

Line specials:

295 Apply anchored portal to the ceilings of all tagged sectors
296 Apply anchored portal to the floors of all tagged sectors
297 Apply anchored portal to the floors and ceilings of all tagged sectors
298 Anchor line (for specials 295 and 297)
299 Anchor line (for special 296)

There are two different anchor line types so a different anchored portal can be placed on the ceiling and floor of the same sector. The two portals will share the sector tag.

For example:

Panchored01.png

The above map has a single anchored portal applied to the inner sector of the area the player start is in. The "portal area" is to the right, and the "main area" is to the left. The view height is not changed, so the portal area needs to be set above the main area, or there will be HOM in the portal window. Note that no camera objects are needed for this effect. The portal will create a temporary camera automatically.

Here's how it works:

When the map is loaded, the the centers of both lines (the portal and the anchor line) are calculated, and the distance between those centers is determined:

Panchored03.png

In the example, the distance is 512 units to the east and 0 units north. This set of numbers becomes the "portal offset" (distance between where the player stands and where the portal camera should go) and when the portal is rendered, the portal camera is place 512 map units east of the player camera, and the map is rendered from the portal camera.

If the portal camera becomes obstructed, unwanted results can occur:

Panchored04.png

In the example above, the camera actually "wanders" out of the portal area and into the main part of the map resulting in an unwanted wall rendering in the portal window. To prevent occurrences such as this, it is usually a good idea to place the portal area a good distance away from any other map architecture to prevent the camera from "wandering into" anything else. If the camera moves out of the portal area, it won't cause problems as long as it is not obstructed by other map architecture.

[edit] Portals Faking Reflective Flats

Reflective portals.png

When paired with ExtraData lump, anchored portals can fake a reflecting floor / ceiling effect.

To achieve this you need to:

  • Recreate an z-mirrored copy of the rooms you want to be reflected.
  • Connect portals as you'd normally do.
  • Enable ExtraData definition for a sector (i.e. give a 401 special to a LineDef facing the sector which flat's alpha you want to modify).
  • Add MapInfo lump that calls specific ExtraData script when map is played:
[MAP01]
    levelname = my level
    extradata = EXTRA01
  • Add EXTRA01 lump containing something along those lines:
sector {
	recordnum 1
	portalflags.floor overlay
	overlayalpha.floor 50%
}
See: Portal#Examples for a demonstration file

[edit] Linked Portals

See: Linked portals

[edit] Examples

portals faking reflective floors

Personal tools