Occlusion proxy Documentation

From Nexus Mods Wiki
Jump to: navigation, search

Occlusion proxy helps the engine determine what exactly is needed to be rendered in a frame. It is used in one of the two coverage buffer occlusion techniques. First and the more important one is reprojecting data from previous frames, but the drawback of it is, that if something wasn't yet visible back then it is not taken into account. With fast camera sweeps during player's turning this can be even third of the whole screen and that's where static occlusion mesh comes to save the day.

It is being rendered on the current frame before everything else on CPU (that's why it is extremely important to keep it as light as possible) and the information is added to the information from reprojection. 

The occlusion mesh is independent on rendermesh, but is usually being created in 3ds Max to fit specific cgf. It is then placed into the level in specific layer(s) and then exported and saved in level's root as occluder.ocm file. This contains all the occluders in the level. 

For further info see http://docs.cryengine.com/display/SD...repare+a+Level

!!!Important!!! You can only place occlusion meshes to where geometry won't change during the gameplay. Do not place them where layeres are streamed out or in.

Terrain occlusion proxy

There is also occlusion proxy for terrain. It's created from the real terrain mesh by simplifying it in 3ds Max (ProOptimizer...), split into segments and exported into the level into designated layer. Simplified mesh can protrude through real terrain, this is why whole occluder terrain mesh is translated several meters down. Also make sure important terrain holes remains present after simplification (mine entrances etc.)

Creation

  1. Create and export occluder as ordinary cgf in the 3ds max.
  2. Place it into the level and align it to the render cgf.
  3. Set Occluder flag
  4. Move it to proper layer.
  5. Export occluder.ocm.

1. While creating the occlusion mesh, it is of paramount importance to keep it as light as possible. Keep the triangle count as close to single digit as possible. Really!

You don't have to bother with proper triangulation and connection between the triangles. Usually everything can be cheaper if you build it out of planes. This saved almost 40 % of triangles without compromising occluding in any way on the example below.

RTENOTITLE
Small features of the mesh can be disregarded completely.  Note how the small collumn between the windows on an image below was omited. Only big shapes are cost efficient on occlusion proxies.

RTENOTITLE

It is also unnecessary to create mesh for interior/interior walls (including floors and ceilings), but interior/exterior walls needs to have the mesh from both sides – only the side facing the camera is occluding.

It is a good practise to align occluder's pivot to the pivot of the visual mesh it belongs to, this will make placing in the level easier.

Regarding naming, please add _occ suffix to the name of the proxy.

 

2. Load the occluder mesh cgf into the level and place it where you want it to be

 

3. Set occluder flag in object properties:

RTENOTITLE

 

4. Our occlusion meshes must be all under the _occlusion_meshes layer separated into corresponding region layers.

RTENOTITLE

 

5. When you're done adding all the meshes you need, you can hit File->Export Occlusion Mesh and save it into the level's root as occluder.ocm. Make sure you have all the occluder layers loaded, otherwise objects in those layers won't get into the occluder.ocm. Also make sure you have latest Data (i.e. latest all other occluder cgfs).

RTENOTITLE

Debug

You can debug the content of the buffer with e_coverageBufferDebug = 1. You can also specify what part of coverage buffer you want to see:

  • e_coverageBufferReproj = 2 - only reprojection
  • e_coverageBufferReproj = 4 - only static occlusion mesh
  • e_coverageBufferReproj = 6 - both

Please note, in order to see changes after regenerating occluder.ocm, you need to restart the Editor because the file is not reloaded on the fly.