cod2-sdk/docs/portals/portals.htm

206 lines
7.5 KiB
HTML
Raw Permalink Blame History

<html>
<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<meta name=Generator content="Microsoft FrontPage 5.0">
<title>Portals</title>
<style>
<!--
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman";}
/* Page Definitions */
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
{page:Section1;}
-->
</style>
</head>
<body lang=EN-US style='text-justify-trim:punctuation'>
<div class=Section1>
<p class=MsoNormal style='text-autospace:none'><b><font size="6">Portals</font></b></p>
<p class=MsoNormal style='text-autospace:none'>&nbsp;</p>
<p class=MsoNormal style='text-autospace:none'>Portals
divide the world into cells.&nbsp;Each cell is a non-solid, non-detail volume
inside the BSP that does not cross any portals.&nbsp;Every non-solid part of
the map exists in exactly one cell.&nbsp;Cells can have any arbitrary shape,
such as L or cube.&nbsp;Portals connect two cells.&nbsp;The classic example is
doorways in a house, where each room is a cell and the doorways are portals.</p>
<p class=MsoNormal style='text-autospace:none'>&nbsp;</p>
<p class=MsoNormal style='text-autospace:none'>Whenever
a cell is determined to be at least partially visible, all of the world
geometry in that cell gets drawn.&nbsp;If a world surface exists on both sides
of a portal, it gets drawn if either of the two cells are drawn.&nbsp; </p>
<p class=MsoNormal style='text-autospace:none'>&nbsp;</p>
<p class=MsoNormal style='text-autospace:none'>Note:
model bounding boxes will get clipped against the portals so they may not get
drawn even if they are in a cell that is drawn.</p>
<p class=MsoNormal style='text-autospace:none'>&nbsp;</p>
<p class=MsoNormal style='text-autospace:none'>Portals
gives better culling than PVS since they effectively do the exact cell-to-cell
PVS for a single view point.&nbsp; Portals can even cull geometry when you turn
the mouse, rather than being fixed for a given point.&nbsp; Too many portals
can slow the game down because it does too much time calculating what to
draw.&nbsp; Portals do frustum culling of triangles, (strafe in front of a
doorway in CoD2 with r_showtris 1 to observe this in action). Because of this it
is not necessary to have portals inside of rooms, only at the windows and doors.
Use r_showportals 1 in the game to see where IW placed their portals. </p>
<p class=MsoNormal style='text-autospace:none'>Too
few portals can slow the game down because it quickly decides to draw too much.</p>
<p class=MsoNormal style='text-autospace:none'>&nbsp;</p>
<p class=MsoNormal style='text-autospace:none'>You
have to&nbsp;place portals in radiant for portal-based rendering.&nbsp; A
portal can be any brush face; it doesn't have to be axial and it doesn't have
to be square.&nbsp;To create a portal, create a brush and then make most sides
<EFBFBD>textures / common / portalnodraw<61> and one side &quot;textures / common /
portal&quot;.&nbsp;</p>
<p class=MsoNormal style='text-autospace:none'>&nbsp;</p>
<p class=MsoNormal style='text-autospace:none'>portalnodraw
is just like nodraw but is designed to be used with portal.</p>
<p class=MsoNormal style='text-autospace:none'>&nbsp;</p>
<p class=MsoNormal style='text-autospace:none'>Only
structural brushes can make up the other walls of a cell with portals. Open a
map and filter out the patches (Alt-3), detail brushes (Ctrl-d) and entities
(Alt-2) and observe whats left. Usually this will be just a few simple walls, the
sky and some caulk brushes. This is what the portal render <20>sees<65>. </p>
<p class=MsoNormal style='text-autospace:none'>&nbsp;</p>
<p class=MsoNormal style='text-autospace:none'>Portals
are not allowed to have the same cell on both sides.&nbsp;If the compiler
detects this, it will ignore the portal and issue a warning. This is known as a
portal leak and it will generate a .lin file the same as a regular leak. </p>
<p class=MsoNormal style='text-autospace:none'>&nbsp;</p>
<p class=MsoNormal style='text-autospace:none'>Portals
are not allowed to have one side completely against a solid brush (partially is
okay, including partially inside solid).&nbsp;If the compiler detects this, it
will ignore the portal and issue a warning.</p>
<p class=MsoNormal style='text-autospace:none'>&nbsp;</p>
<p class=MsoNormal style='text-autospace:none'>Portals
are not allowed the T-junction with other portals. The portal whose face is
touching the edge of the other perpendicular portal must have its face split
along the edge it shares with that portal. </p>
<p class=MsoNormal style='text-autospace:none'>
<span style='font-size:10.0pt;
'>&nbsp;</span></p>
<p class=MsoNormal style='text-autospace:none'>An
example of placing 2 portals to cull geometry around a corner: The diagonal
portals here each share 1 edge exactly on the inside corner of this hallway.
Cell number 1 can not see the portal face which divides cell 2 from cell 3.
Since it can not see this portal, it does not draw the triangles inside cell 3. </p>
<p class=MsoNormal style='text-autospace:none'>
<span style='font-size:10.0pt;
'>&nbsp;</span></p>
<p class=MsoNormal style='text-autospace:none'>
<span style='font-size:10.0pt;
'>############</span></p>
<p class=MsoNormal style='text-autospace:none'>
<span style='font-size:10.0pt;
'>#&nbsp;2&nbsp; /<2F><> 3</span></p>
<p class=MsoNormal style='text-autospace:none'>
<span style='font-size:10.0pt;
'># &nbsp; /</span></p>
<p class=MsoNormal style='text-autospace:none'>
<span style='font-size:10.0pt;
'>#&nbsp; /########</span></p>
<p class=MsoNormal style='text-autospace:none'>
<span style='font-size:10.0pt;
'># / #</span></p>
<p class=MsoNormal style='text-autospace:none'>
<span style='font-size:10.0pt;
'>#/&nbsp; #</span></p>
<p class=MsoNormal style='text-autospace:none'>
<span style='font-size:10.0pt;
'>#&nbsp;1 #</span></p>
<p class=MsoNormal style='text-autospace:none'>
<span style='font-size:10.0pt;
'>&nbsp;</span></p>
<p class=MsoNormal style='text-autospace:none'>&nbsp;</p>
<p class=MsoNormal style='text-autospace:none'>Another
example. Position 4 can see through the portal into the cell where position 5
is, however... frustum culling keeps the observer at position 4 from drawing
the object at position 5.</p>
<p class=MsoNormal style='text-autospace:none'>&nbsp;</p>
<p class=MsoNormal style='text-autospace:none'>
<span style='font-size:10.0pt;
'><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 4</span></p>
<p class=MsoNormal style='text-autospace:none'>
<span style='font-size:10.0pt;
'>&nbsp;</span></p>
<p class=MsoNormal style='text-autospace:none'>
<span style='font-size:10.0pt;
'>##########-------##########</span></p>
<p class=MsoNormal style='text-autospace:none'>
<span style='font-size:10.0pt;
'>#<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> #</span></p>
<p class=MsoNormal style='text-autospace:none'>
<span style='font-size:10.0pt;
'># <20>5<EFBFBD><35><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> #</span></p>
<p class=MsoNormal style='text-autospace:none'>
<span style='font-size:10.0pt;
'>#<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> #</span></p>
<p class=MsoNormal style='text-autospace:none'>
<span style='font-size:10.0pt;
'>#<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> #</span></p>
<p class=MsoNormal style='text-autospace:none'>
<span style='font-size:10.0pt;
'>#<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> #</span></p>
<p class=MsoNormal style='text-autospace:none'>&nbsp;</p>
</div>
</body>
</html>