UDN
Search public documentation:
PrecomputedVisibility
日本語訳
中国翻译
한국어
Interested in the Unreal Engine?
Visit the Unreal Technology site.
Looking for jobs and company info?
Check out the Epic games site.
Questions about support via UDN?
Contact the UDN Staff
中国翻译
한국어
Interested in the Unreal Engine?
Visit the Unreal Technology site.
Looking for jobs and company info?
Check out the Epic games site.
Questions about support via UDN?
Contact the UDN Staff
Precomputed Visibility
Document Changelog: Created by Daniel Wright.
Overview
Setting up a game to use precomputed visibility
- PlayAreaHeight - The height above a surface that the camera can be. This is usually your tallest players eye height + jumping height. The default is 220.
Setting up a level to use precomputed visibility
Cell placement
Visualizing results
- First, setup the level for precomputed visibility and build lighting.
- Setup your viewports. A 1x1 Vertical split works well. All views need to have realtime update enabled. Move your perspective viewport into the play area (inside a visibility volume, somewhat near the ground) so that it will be inside a cell. You will know that it is working when you get a non-zero value for 'Statically Occluded Primitives' when you enter 'stat initviews' on the console and enable stats for the perspective view.
- Type 'ToggleOcclusion' into the console to turn off the dynamic occlusion system. You should get the message 'Occlusion queries are now disabled' in the log. This will allow us to look at only the results of precomputed occlusion.
- In the perspective view, click 'View Culling/Occlusion' in viewport drop down.
Visibility Settings
Relevant Stats
- 'Statically occluded primitives' under 'stat initviews' shows how many primitives were determined invisible by precomputed visibility after frustum culling took place. 'Occluded primitives' shows how many primitives were determined invisible by both precomputed visibility and the dynamic occlusion system. The difference between these two stats is how many primitives the dynamic occlusion system culled that precomputed visibility missed. When precomputed visibility is working well, 'Statically occluded primitives' should be within 50-80% of 'Occluded primitives'. Precomputed visibility culls less objects because it stores information for large cells and doesn't handle dynamic or masked occluders (see the Limitations section). Note: this stat is most reliable in game or PIE, and not in the editor, due to all the debug stuff that gets drawn in the editor.
- 'Decompress Occlusion' under 'stat initviews' shows how much time was spent decompressing precomputed visibility.
- 'Precomputed Visibility Memory' under 'stat memory' shows how much runtime memory is used by precomputed visibility. Note: this stat is not reliable in PIE, check it in the editor or in game instead, since it is counting both PIE and editor memory when in PIE.
Results
- 1739 primitives statically occluded out of 2180 occcluded total
- Savings of 2.7ms of rendering thread time on Xbox 360 compared to without precomputed occlusion (35.4ms ->32.7ms). Note that the main benefit of using precomputed visibility is that it is instantly active, while the dynamic occlusion system can take a while to converge. So frame time when coming around a corner for the first time or rotating the view rapidly should be better with precomputed visibility enabled, but these cases are difficult to measure reliably.
- 627Kb of precomputed visibility data
- Tiny 1ms hitch on the rendering thread when moving to a new area and occlusion gets decompressed for that area
Limitations
- Doesn't handle movable objects or movable occluders
- Doesn't handle non-opaque occluders, because masked occluders often have small holes that are difficult to detect
- Only places cells above surfaces, so games with flying modes won't get much benefit
- Doesn't handle streaming levels efficiently, all data is stored in the persistent level instead of streamed in and out with the streaming levels
- Only static shadow casting triangles will occlude. This means that a lightmapped interpactor will occlude when it shouldn't, and a non-movable object that doesn't cast shadows will also not occlude when it should.
Debugging visibility issues
-
TogglePrecomputedVisibility
- Toggles the use of precomputed visibility data. -
ShowPrecomputedVisibility
- Toggles debug visualization of precomputed visibility cells