Difference between revisions of "Leak:zh-cn"

From Valve Developer Community
Jump to: navigation, search
m (Formatting & category cleanup)
Line 96: Line 96:
[[Func_viscluster]] can also cause leaks when they cross areaportal surfaces, or are too close to them. Disabling all func_visclusters and compiling to see if the leak is gone should be done, at least as last resort. {{Todo|How do you ''actually'' fix this?}}
[[Func_viscluster]] can also cause leaks when they cross areaportal surfaces, or are too close to them. Disabling all func_visclusters and compiling to see if the leak is gone should be done, at least as last resort. {{Todo|How do you ''actually'' fix this?}}
=== False leaks ===
=== 假泄漏 ===
Although very rare, it is possible VBSP reports false leaks in your level. If you are sure that there should not be a leak reported by VBSP, copy your map and paste it into a fresh new map file. If it compiles fine, then your old file could have been corrupted.
== Conclusion: An ounce of prevention ==
== Conclusion: An ounce of prevention ==

Revision as of 20:51, 18 October 2019

English Deutsch Русский 


BSP 地图本身必须保证完全封闭。关卡内部,即世界的任何部分不能和外部,即虚空相连。即便是天空也必须要用tools/toolsskybox纹理的固体封闭地图。当地图没有封闭好,或者有实体在虚空,则在编译地图的时候VBSP就会发生泄露事故,当这种情况发生时,VBSP无法判定地图的哪部分在内部,哪部分在外部,使得无法正常编译地图。




ProcessBlock_Thread: 0...1...2...3...4...5...6...7...8...9...10 (0)
**** leaked ****
Entity light (-1607.69 -1094.12 -183.00) leaked!


Note.png 注意: 通常提到的实体不是泄漏的原因——这是泄漏的来源之一。删除它只会使报告中提到另一个实体,这将无法完全解决问题!解决泄漏的一种情况是:将其放置在可玩区域之外。本文稍后将对此进行介绍。
Note.png 注意: 如果在编译时地图中没有实体,则VBSP可能会报告泄漏,因为VBSP无法确定地图的内部还是外部是可玩区域。
Note.png 注意: 传送门2中,如果发生泄露事故,则无法编译地图。
Note.png 注意: 传送门2反恐精英:全球攻势异形求生中,如果发生泄露事故且跳过VVIS的话,则不会编译天空盒。


A leak in a level has a number of bad effects. VBSP will report the leak, and it will not correctly produce a portalfile (mapname.prt), if at all. The portal file is used by VVIS to perform its visibility calculations. Since there is no portal file, VVIS will not run correctly/at all. When this happens, VRAD will also work incorrectly, or only perform direct lighting - no light bounces.

Maps are usually not playable at all. VVIS may tell the engine to render the entire map at once, which is bad for framerates, or have entire areas be invisible. At worst, a leak can make VRAD render your entire map black.

Wasting time with leaks

VBSP will always report any leaks it finds, but spending hours of full compile time and game execution just to find out that your map is broken after compilation, simply isn't efficient. Make sure you've tested that your map doesn't have a leak before you even begin to worry about your map's visibility and lighting. If you notice that VBSP leaked while the compile is happening, press Ctrl+C to abort the compile.

Finding leaks

Sometimes these gaps aren't quite as obvious as the above example. They can be a fraction of a unit wide and still cause a leak. VBSP provides you with a pointfile to help you locate the leak. It draws a line from the void of the map to the entity it found during the leak check. After receiving a leak error, a mapname.lin file will be created in the same directory as your .vmf map file.

Loading a Pointfile

The pointfile can be loaded into the Hammer Editor to show you precisely where the leak is inside the level. To load a pointfile for the level, use the Load Pointfile command in the Map menu.

The Load Pointfile command shows the path to the leak in the Hammer viewports.

This image shows the pointfile loaded into the previous example. Notice that the red line appears in both the 3D and 2D views, and is traced back from the entity through the gap.

Using this visual aid, you can find the source of the leak by following the red line to the outside of the level. It's best to start at the entity specified by VBSP, and then follow the line until you find the gap in the geometry. Close the gap and recompile the level to see if you have fixed the leak.

Finding the endpoint

If you're having trouble locating the start entity, you can use the Go to Coordinates command on the View menu to find the entity and the start of the pointfile line. Simply enter the coordinates given by VBSP for the entity location, and the 2D and 3D views will be centered on that location. Follow the line to find your leak.

Another method to find the source of the leak is to zoom out in one or more of the 2D views. After loading the pointfile, zoom out until you see the red line. Follow the line until you reach the entity at the one of the endpoints. Then select the entity, and choose Center 3D Views on Selection from the View menu. Now you can follow the pointfile line to find the leak.

Other causes of leaks

Besides gaps in outside geometry, there are other map errors that can cause VBSP to generate a leak error.

Entities outside the level

Placing any entity in the void will cause a leak.

All entities need to be inside the playable level space or skybox. VBSP treats all brush entities as if they are not there, so attempting to seal a map with a brush entity, such as a func_door, will create the same condition as if there were a gap in their place.

Improperly constructed areaportals

Areaportals that do not seal areas will cause leaks.

Leak error messages can also be generated when an areaportal does not properly seal the two areas it connects. Find leaks with areaportals using the same methods as geometry gap leaks.

Special geometry does not seal the world

Seal areas behind non-solid geometry to prevent leaks.

Displacements and water also do not seal maps and will cause leaks. You can fix this type of leak by adding a solid brush behind them to seal the map. Using a brush with the tools/toolsnodraw material will seal the map, but not add any additional rendering cost, so it's a great way to seal the map behind displacements. Water should be sealed off with whatever is sealing off the area above it (probably tools/toolsskybox or another typical texture, such as bricks.) Do not use nodraw to seal off water, as this will cause a weird trailing effect.

Mismatched entity origins

An origin helper separated from its parent entity and moved outside the level will cause a leak.

A more subtle cause of leaks can be with any entities that have origin helpers, such as func_door_rotating or func_rot_button. While the entity itself may be inside the world, if the origin helper is outside the map, the entity will cause a leak. If you find a pointfile heading to a empty spot outside of the map, and there is no entity there, an origin helper is a good thing to look for.

One way to quickly tell if an entity origin is causing the leak is to:

  1. Load the pointfile.
  2. Find the endpoint(s) of the pointfile.
  3. Choose Select All from the Edit Menu.
  4. Make sure Show Helpers is checked on the View Menu.
  5. If you see an origin helper appear at the pointfile, you know that's the problem.

If you have an origin helper causing a leak, you can select the object and manually move the origin back into the world, use the Center Origins command from the Tools Menu, or simply right-click on the origin helper and select Center on entity.

Mismatched entity origins usually occur when a brush entity with one of these helpers is moved while in Solids mode. Moving a brush entity in solids mode does not move the entity's origin helper.

Translucent geometry

Brushes with translucent materials, like glass, can also cause leaks if they're on the edge of a map. If your pointfile is going straight through a brush, check the textures on all sides of that brush.


Func_viscluster can also cause leaks when they cross areaportal surfaces, or are too close to them. Disabling all func_visclusters and compiling to see if the leak is gone should be done, at least as last resort. To do: How do you actually fix this?



Conclusion: An ounce of prevention

Using the pointfile tools makes finding leaks relatively painless, but one of the most important ways to fix leaks is by preventing them in the first place. Taking your time when building, and making sure brushes are snapped properly to the grid can go a long way towards eliminating leaks before they occur. The cleaner and more organized your geometry, the more likely you are to be able to spot leaks when they occur, or even prevent them from happening in the first place. You can also help prevent lots of extra work by compiling your level as you go along, instead of building your whole level before trying to compile it. Finding one leak at a time while the map is only partially complete is a lot easier and faster than finding leaks in a complete map that is full of geometry.