MODSon[line.com] Wiki - Beta 1.0

Mapping: Portal

From MODSonline Wiki

Jump to: navigation, search

Contents

[edit] Intro

A portal used by the BSP (Binary space partitioning) to split the map into different pieces. How portals work is a hard concept to understand and you might not get it right away. In the end it is easier to see how portals work in game before you fully understand what a portal is.

[edit] Short Rap

This is just a quick over view on want a portal is, and what you are getting yourself into. A portal is used to split the map into different parts for rendering. Portals create portal cells. Portals cells must be closed with the portal texture or with a structural brush. This means that portals can leak though detailed brushes. Portals help the game determine what needs to be rendered so things behind a player, in another portal cell, don't get rendered.

[edit] What is a portal?

First let's define a portal. A portal is a element used by the BSP to make the map run fast by not rendering things the player can't see. If you could see the Portal texture in game, it would be a 2D texture. You can see this by opening your console and typing the following commands:

 /sv_pure 0
 /developer 1
 /devmap mp_dawnville
 *Once map loads:
 /r_showportals 1

You should now see blue squares on your screen that weren't there before. Each of these squares represents a portal texture in the map, and as you can see it is 2D. You can also see portal cells created. A cell is where the blue lines meet and box of a part of the map. This is one portal cell.

[edit] How a portal works

Now that we have defined a portal, why don't we talk about how it works. A portal is simply a division between two parts of the map, or how many portal cells you have. A portal cell is a cell or area created when a portal, or many portals, make an enclosed area. So let's say you have two rooms with one door and in the door there is a portal. There are two portal cells created. Room 1 and Room2. Portal cells split the map into different pieces. If those pieces can't be viewed by the player, then the cell doesn't get rendered, or the objects in the cell don't show up, which saves resources and makes the game run faster. What use is it showing something the player can't see? This is the purpose of portals.

When a player steps into a cell, everything in that cell is rendered, or displayed, including everything behind the player. This is why portal cells need to be placed at correct locations. Place them in wrong locations can put portals to minimum or no use at all. If you put them at key points and used correctly, then you can increase the speed of your map! This is why portals are important.

[Example on how portals work coming soon!]

[edit] Mapping with portals

In order to have portals in your map, you have to add them into your map using two textures: portal, and portal_no_draw. You should have portal on the side of a brush that needs it and texture the rest with portal_no_draw.

The portal texture is the physical texture the compiling process uses to split the map into its different portal cells. This texture you should view as a 2d texture. Think that the portal_no_draw texture as not being there. It just helps to see if portals line up and complete a portal cell.

[edit] Where are portals used?

This is another thing that needs to be answered. Portals should be used to group areas of the map together. Having to little portals is bad, but so is to many. Not enough portals, your game displays to much and lags. Same with to many, except the game is trying to calculate what to show and what not for to many things, causing the game to lag.

Most people over do portals and still ask why their game lags. They add more portals and in turn make it worse. You need to find the perfect amount in between. This is where people aren't sure what to do an what the right amount would be.

[edit] How many portals should I have?

This question can be answered in many different ways, but there is one major way of deciding where to put portals and how many to have.

For a starter, or someone not as advanced, I would start adding portals to a building's windows and outside doors. Then once you start learning the mapping concept and understanding it, you can get into harder portal techniques. Most smaller buildings are made up of no more than three portal cells, so try and keep it around there. If you still are not sure how many to have in a building, just see how the developers did it! Use the console commands given to you earlier at Mapping:_Portal#What_is_a_portal.3F What is a portal? to see how they did it.

Now for more advanced users I would say first you need to think of a couple things.

1. How much can the player see from a point AND

2. How much area a portal should cover.

Find out where key portal spots are. Look at bends and corners the most. Corners and bends are great places for portals because they can block out the most cells. When the player is in a wide open area you would think that you need more portals because the player can see more of a wide area. This is false! Take a look at the amount of portals in mp_brecourt. There is less than 20 portals. Now take a look at mp_trainstation. Big difference! Train station is smaller, but has much more portals. Why is this?

Simple really, the more area, the more the player can see at one time. If the player can see half the map at a location, the portal cells need to be big in size and small in amount. Once you get into a map like train station, you need to have smaller sized cells with more of them. Really it is the question of "why would you try and hide something if the player can see it most of the time anyways?" So you need to decide if your need a big portal cell and less of them, or more portals but smaller in size.

[edit] Inserting portals into your map

This part is far by the most important. Creating portals in the map is hard itself. If you have a portal misplaced, you have a serious issue. Like what was said earlier, you need to view the portal texture as 2D. You have to make sure that portals cells can not see into another cell. This is explained latter on.

[edit] Where to start?

You should start portaling with buildings. Buildings are easy to portal, most of the time. You only have windows and outside doors able to leak. Leaks occur when a portal can see its other side of itself though a direct path. This can be as simple as a gap between it and the other side, or a detailed brush that caused it to loop around. You will run into these errors every once and a while, but they are less common with buildings.

You will want to cover the outer part of the windows and doors, or the parts that are closest to the outside. Especially when your frame is a detailed brush! Portals leak though detailed brushes because they aren't structural. It is the same reason your map would leak if you didn't have a skybox or if the skybox was detailed.

[edit] Web links

Here is a list of links to further help you along while this page is being fully developed and edited! Good luck and have fun mapping!

[edit] Video Tutorials

Portals 1: Defining portals, what are they. What can they do, and hurt. Leafnodes, cells with Detail vs Structural.

Portals 2: Covering the textures and applying.

Portals 3: Showing what the portals CULL from a map. Using r_showtris 1. How portals really work.

Personal tools