cod-sdk/Tools/docs/Portals.htm
2003-11-21 00:00:00 +00:00

190 lines
8.8 KiB
HTML
Raw Permalink Blame History

<html>
<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<meta name=Generator content="Microsoft Word 10 (filtered)">
<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><u><span style='font-family:
Arial'>Portals</span></u></b></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-family:Arial'>&nbsp;</span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-family:Arial'>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.</span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-family:Arial'>&nbsp;</span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-family:Arial'>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; </span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-family:Arial'>&nbsp;</span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-family:Arial'>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.</span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-family:Arial'>&nbsp;</span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-family:Arial'>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 CoD 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. </span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-family:Arial'>Too
few portals can slow the game down because it quickly decides to draw too much.</span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-family:Arial'>&nbsp;</span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-family:Arial'>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;</span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-family:Arial'>&nbsp;</span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-family:Arial'>portalnodraw
is just like nodraw but is designed to be used with portal.</span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-family:Arial'>&nbsp;</span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-family:Arial'>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>. </span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-family:Arial'>&nbsp;</span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-family:Arial'>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. </span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-family:Arial'>&nbsp;</span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-family:Arial'>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.</span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-family:Arial'>&nbsp;</span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-family:Arial'>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. </span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:Arial'>&nbsp;</span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-family:Arial'>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.
</span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:Arial'>&nbsp;</span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>############</span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>#&nbsp;2&nbsp; /<2F><> 3</span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'># &nbsp; /</span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>#&nbsp; /########</span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'># / #</span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>#/&nbsp; #</span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>#&nbsp;1 #</span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:Arial'>&nbsp;</span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-family:Arial'>&nbsp;</span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-family:Arial'>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.</span></p>
<p class=MsoNormal style='text-autospace:none'>&nbsp;</p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 4</span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>&nbsp;</span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>##########-------##########</span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>#<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;
font-family:"Courier New"'># <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;
font-family:"Courier New"'>#<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;
font-family:"Courier New"'>#<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;
font-family:"Courier New"'>#<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-family:Arial'>&nbsp;</span></p>
</div>
</body>
</html>