Visleaf: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(misleading, mat_wireframe not a useful tool for visualizing leaf cuts.)
(Inserted information from the Visibility optimization article, and stuff.)
Line 6: Line 6:


Visleafs are generated automatically from the [[BSP|BSP tree]] by the [[vvis|VVIS]] compile tool. Each (internal) surface of a visleaf is either a [[World brush]] surface or a ''Portal'' to an adjacent visleaf.  
Visleafs are generated automatically from the [[BSP|BSP tree]] by the [[vvis|VVIS]] compile tool. Each (internal) surface of a visleaf is either a [[World brush]] surface or a ''Portal'' to an adjacent visleaf.  


== Examination ==
== Examination ==


Using the [[Developer Console]], <code>[[mat_leafvis]] 1</code> draws a red wireframe box around the Player's current visleaf, which is redrawn each time a new visleaf is entered.
There are three ways to inspect visleaves:
 
* From the [[Orange Box]] version of Hammer, the leaves of the current map can be viewed directly in the 3D view through the menu option ''Map > Load Portal File''. This displays leaf edges that touch other edges as thick blue lines.
 
* From the desktop, the [[glview]] tool application (located in the ''<user>\sourcesdk\bin\orangebox\bin\'' folder) can be used.
 
{{tip|For even more clarity use auto [[visgroup]]s to remove objects from your map that don't block visibility – i.e. everything but "World Geometry".}}
 
* From the [[Developer Console]], the [[console variable]] [[mat_leafvis]] can be used. (<code>mat_leafvis 3</code> will display all visleaves in the [[PVS]].)
 
{{note|Do not confuse visleaves with the squares outlining worldbrush geography seen if you use <code>[[mat_wireframe]] 3</code>.}}


* With [[Orange Box]] and later games, you can access Hammer's '''Map > Load Portal File''' feature. (Leaf edges that touch other edges will be displayed as thick blue lines.)
* Visleaves can also be examined from the desktop with the [[glview]] tool.


== See also ==
== See also ==

Revision as of 20:50, 17 February 2011

A sample scene with two rooms.
The default visleaf structure for the above scene. Note how leaf 2 cannot see leaf 3.

Each visleaf (sometimes referred to simply as a leaf) is a hollow volume in a map which defines a 'cluster' of visible surfaces. Every visible surface of a map is part of one visleaf or another. Visleafs are used primarily by the Rendering Engine to determine (before rendering each frame) which areas of the map might need to be rendered on screen. When any part of a visleaf is potentially visible from any part of the current visleaf, the entire contents of that visleaf are considered for rendering.

Visleafs are generated automatically from the BSP tree by the VVIS compile tool. Each (internal) surface of a visleaf is either a World brush surface or a Portal to an adjacent visleaf.


Examination

There are three ways to inspect visleaves:

  • From the Orange Box version of Hammer, the leaves of the current map can be viewed directly in the 3D view through the menu option Map > Load Portal File. This displays leaf edges that touch other edges as thick blue lines.
  • From the desktop, the glview tool application (located in the <user>\sourcesdk\bin\orangebox\bin\ folder) can be used.
Tip.pngTip:For even more clarity use auto visgroups to remove objects from your map that don't block visibility – i.e. everything but "World Geometry".
Note.pngNote:Do not confuse visleaves with the squares outlining worldbrush geography seen if you use mat_wireframe 3.


See also

Template:Otherlang:en Template:Otherlang:en:ru